Created
March 4, 2010 02:46
-
-
Save bnolan/321343 to your computer and use it in GitHub Desktop.
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
/* | |
* A wiggley text thingy for jquery | |
*/ | |
var WiggleText = function(message){ | |
var el = $("<div></div>").addClass("wiggletext").css({position: 'absolute'}); | |
for(i=0;i<message.length;i++){ | |
$("<span>" + message.charAt(i) + "</span>").css({position: 'relative'}).appendTo(el); | |
} | |
el.appendTo("body"); | |
el.css({ | |
top : ($(window).height() - el.height()) / 2, | |
left : ($(window).width() - el.width()) / 2 | |
}); | |
var ticker = 0; | |
setInterval(function(){ | |
var offset = ticker+=0.2; | |
el.find("span").each(function(){ | |
var x = Math.cos(offset) * 15, | |
y = Math.sin(offset) * 15; | |
offset += 0.1; | |
$(this).css({ | |
left : x, | |
top : y | |
}); | |
}) | |
}, 30); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment