Skip to content

Instantly share code, notes, and snippets.

@shaan360
Created September 6, 2012 16:11
Show Gist options
  • Save shaan360/3657966 to your computer and use it in GitHub Desktop.
Save shaan360/3657966 to your computer and use it in GitHub Desktop.
Using Dojo 1.6.
<h1 id="a"></h1>
var anis = [];
var combo;
var init = function(){
var a = dojo.byId("a");
var factor = 80;
var text = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum"
a.innerHTML = "";
dojo.forEach(text, function(el, i){
var span = document.createElement("span");
span.innerHTML = el;
a.appendChild(span);
})
dojo.forEach(dojo.query("span"), function(el, i){
var animation = {
node:el,
curve:[1,0],
delay:(6*i) + 100,
duration:400,
onAnimate:function(c){
var amount = ~~(c * factor);
this.node.style['textShadow'] = -amount+"px " + -(c*200) +"px " + amount + "px rgba("+~~(c*255)+",0,0,"+(1-c)+")";
}
}
anis.push(new dojo.Animation(animation).play());
})
combo = dojo.fx.combine(anis);
dojo.connect(combo, "onEnd", function(){
a.innerHTML = text;
a.style.color = "black";
})
combo.play();
}
init();
body{
backgruond:#a8d8d8;
}
#a{
color:rgba(0,0,0,0);
font-size:40px;
font-family:monaco;
width:1200px;
-webkit-transform:translate3d(0px,0px,0px);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment