Created
June 1, 2012 09:13
-
-
Save lsauer/2850630 to your computer and use it in GitHub Desktop.
JavaScript - Pure Text based animation fun with Unicodes / ASCII
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
<html><head></head><body> | |
<div id="timer">◉</div> | |
</body></html> |
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
// www.lsauer.com 2012 | |
// character animations based on various sequences of similar characters with geometric shapes | |
//check: | |
document.querySelector('#timer').outerHTML | |
//>"<div id="timer">◉</div>" | |
(function() | |
{ | |
var cnt=0 | |
,charanim1 = ['◔', '◒', '◕', '●'] //semi-filled circles | |
,charanim2 = ['◉', '◎', '◍', '●', '◌', '○'] //Circles | |
,charanimsq = ['▤', '▥', '▦', '▧', '▨', '▩'] //Squares | |
,quarcsani = ['◜','◝','◞','◟'] //quarter arcs | |
,trgnani = ["◬", "◭", "◮"] //triangles, looks good w. a 100msec interval | |
// See: http://en.wikipedia.org/wiki/Geometric_Shapes | |
var setAnimation = function(a, tm){ | |
setInterval( function(){document.querySelector('#timer').innerHTML = a[cnt++%a.length];}, tm ); | |
} | |
setAnimation(charanimsq, 200); | |
}).call(this); | |
//clear all timers | |
var clearTimers = function(){ for(var i=0;i<1000;window.clearInterval(i++)); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment