Letter Animate

Animate each letter in a string.

by chapmanc

HTML

<div id="test">TESTING</div>

JavaScript

var text = $('#test').text();

var doAnimate = function() {
    $('span').each(function() {
        var that = $(this);
        setTimeout(function() { 
            that.animate({ fontSize: "90px" }, 1500 )
                .animate({ fontSize: "50px" }, 1500 );
        },that.index()*100);
    });
}
    
$('#test').html('');

for(i=0; i<text.length; i++) {
  $('#test').append('<span>'+text[i]+'</span>');
    if(i==text.length-1) doAnimate();
}