A Pen by Bennett Feely on CodePen.
Created
February 21, 2017 06:23
-
-
Save CodeMyUI/6806e969ac2e8add53682082034ae161 to your computer and use it in GitHub Desktop.
Laser Text animation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1><span>L</span><span>a</span><span>s</span><span>e</span><span>r</span><span> </span><span>T</span><span>e</span><span>x</span><span>t</span></span></h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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