Skip to content

Instantly share code, notes, and snippets.

@CodeMyUI
Created February 21, 2017 06:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CodeMyUI/6806e969ac2e8add53682082034ae161 to your computer and use it in GitHub Desktop.
Save CodeMyUI/6806e969ac2e8add53682082034ae161 to your computer and use it in GitHub Desktop.
Laser Text animation
<h1><span>L</span><span>a</span><span>s</span><span>e</span><span>r</span><span>&nbsp;</span><span>T</span><span>e</span><span>x</span><span>t</span></span></h1>
@import url('https://fonts.googleapis.com/css?family=Alegreya+Sans:300');
$chars : 10;
$duration : .25s;
$bounce : cubic-bezier(.4,1.4,.75,.9);
$scale : 5000;
html, body {
height: 100%;
overflow: hidden;
user-select: none;
}
body {
display: flex;
align-items: center;
justify-content: center;
background: radial-gradient(#1a1a1a, #000);
}
h1 {
font: 300 50px/1 Alegreya Sans, monospace;
white-space: nowrap;
color: whitesmoke;
}
span {
display: inline-block;
animation: stretch $chars*$duration $bounce infinite;
transform-origin: center;
@for $i from 1 through $chars {
&:nth-of-type(#{$i}) {
animation-delay: $i*$duration;
}
}
}
@keyframes stretch {
5% {
transform: scaleX($scale);
opacity: .1;
}
15% {
transform: scaleX(1);
opacity: 1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment