How would I animate individual characters of text on a page in HTML5. Like this example in flash.
http://www.greensock.com/splittextfield/
How would I animate individual characters of text on a page in HTML5. Like
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’d have to wrap each character in a
<span>then move that span using CSSposition/top/left.You couldn’t completely reproduce what the Flash example did, because that example uses a blur effect. CSS can’t do that; SVG could, and IE’s non-standard
filtercould, but that would mean a total code branch.You could change the size of each letter by setting the
font-size, but to so the kind of shear/rotate effects the example does you’d have to use a CSS transform. This isn’t standardised yet and there are holes in browser support.Here’s a proof-of-concept I just hacked up mainly for Firefox (sorry for the code length):
This could be improved by adding gravity and better 3D-space modelling of the currently-completely-random transforms, plus better browser support for the scale/rotation in browsers other than Firefox.
(IE has its own non-standard CSS transform filters it might be possible to support; Webkit and Opera have
webkitTransformandoTransformstyles, but they refuse to transform relative-positioning inline spans, so you’d have to absolute-position each character, which would mean reading all their normal positions to use as baseline. I got bored at this point.)