Posts

Showing posts from July, 2012
Cool Animated Fire Effects with CSS3 and jQuery JQuery <script type="text/javascript"> var step = 1; function nextShadow(){ $('#onfire span').each(function(){ y = parseFloat($(this).attr("y_pos")); y += step + Math.random()*3; $(this).attr("y_pos", y); shaking = Math.random(); shadow1 = "0px 0px "+(y%5)+"px white"; shadow2 = shaking*24/y*Math.cos(y/5)*15+"px -"+(shaking*4/y+(y%17))+"px "+(shaking+(y%17))+"px red"; shadow3 = shaking*24/y*Math.cos(y/7)*15+"px -"+(shaking*4/y+(y%31))+"px "+(shaking+(y%31))+"px #993"; shadow4 = shaking*24/y*Math.cos(y/13)*15+"px -"+(shaking*4/y+(y%41))+"px "+(shaking+(y%41))+"px yellow"; $(this).css("text-shadow", shadow2+", "+shadow1+", "+shadow4+", "+shadow3); }); } $(function(){ $('#onfire span')