Created
May 23, 2013 15:36
-
-
Save majman/5636981 to your computer and use it in GitHub Desktop.
A CodePen by GreenSock. Letter by Letter Animation - http://forums.greensock.com/topic/7440-fade-in-one-word-at-a-time/
This file contains hidden or 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
| <div id="textDiv">a quick sample of letter by letter animation</div> |
This file contains hidden or 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
| var textDiv = $("#textDiv"), | |
| sentence = textDiv.html().split(""), | |
| tl = new TimelineMax({repeat:10, repeatDelay:0.4, yoyo:true}); | |
| TweenLite.set(textDiv, {css:{perspective:500, perspectiveOrigin:"50% 50%", transformStyle:"preserve-3d"}}); | |
| textDiv.html(""); | |
| $.each(sentence, function(index, val) { | |
| if(val === " ") { | |
| val = " "; } | |
| var letter = $("<span/>", {id : "txt" + index}).html(val).appendTo(textDiv); | |
| tl.to(letter, 1, {autoAlpha:1, ease:Back.easeOut, rotationX:360, transformOrigin:"50% 50% -20"}, index * 0.05); | |
| }); |
This file contains hidden or 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
| body { | |
| background-color:#000; | |
| font-family: Arial, Helvetica, sans-serif; | |
| margin: 10px; | |
| color: #fff; | |
| } | |
| #textDiv span{ | |
| display:inline-block; | |
| position:relative; | |
| top:20px; | |
| visibility:hidden; | |
| font-size:36px; | |
| -webkit-font-smoothing:antialiased; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment