Skip to content

Instantly share code, notes, and snippets.

@Jaballadares
Last active August 29, 2015 14:15
Show Gist options
  • Save Jaballadares/11d7282592300f2cf7e0 to your computer and use it in GitHub Desktop.
Save Jaballadares/11d7282592300f2cf7e0 to your computer and use it in GitHub Desktop.
SCSS Center Hack from Codepen
<h1><span>t</span><span>r</span><span>a</span><span>m</span><span>p</span><span>o</span><span>l</span><span>i</span><span>n</span><span>e</span><span>s</span></h1>
$(function(){
var x = $(window).width();
var y = $(window).height();
$(window).mousemove(function(e){
var xpos = e.pageX;
var ypos = e.pageY;
var xpct = 100 - Math.floor(xpos / x * 100);
var ypct = Math.floor(ypos / y * 100);
$("span").css("transform-origin", xpct + '% ' + ypct + '%');
});
});
@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,800,300);
$strength : 180;
$shade : 40%;
$letters : 11;
$size : 14vw;
$background : desaturate(navy, 80%);
html, body { height: 100%; }
body {
display: flex;
justify-content: center;
align-items: center;
background:
radial-gradient(
$background,
shade($background, 40%)
);
overflow: hidden;
cursor: -webkit-grab;
font: 900 $size Open Sans;
line-height: $strength * 1vh;
letter-spacing: -$size*.15;
text-transform: uppercase;
text-shadow: 0 2px 15px $background;
}
span {
display: inline-block;
position: relative;
@for $i from 1 through ceil($letters/2) {
&:nth-child(#{$i}) {
$z : ceil($letters/2) - $i;
z-index: $z;
}
}
@for $i from 1 through ceil($letters/2) {
&:nth-child(#{$i}),
&:nth-last-child(#{$i}) {
$color : adjust-hue(red, 31% * $i);
$shade : shade($color, 30%);
transform:
rotateX($i*8deg);
color: $color;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment