开发者

Javascript text animation: Bigger and bigger, then disappear

I need some kind of JavaScript which can do the following:

I need some small green text. This text should then grow larger and larger and then disappear in some way. This should take around 2-3 seconds in total. I will need several of these texts different places on the website, which means it has the following requirements:

  • These texts should only be visual. It should not interfere with what a user can click upon and such

  • The JavaScript shouldn't be very heavy to load/use for the user, as the website already is quite heavy

  • Should be implementable in ASP.NET

I do know this is quite hard to describe. The best idea I can give is World of Warcraft / other games. Each time you shoot, you get some small number describ开发者_开发技巧ing how much you hit. This is the same idea: You do some action on the website, and then the user is informed by this text animation graphically...

How do you come around this?

Thanks so much on beforehand...


This is easy to achieve with jQuery.animate:

http://api.jquery.com/animate/

You can try something like this, which changes the opacity from 100% to 0% and fontSize from current to 5em over the course of 5000 ms:

$('.someDiv').animate({opacity:0,fontSize:'5em'}, 5000);

Working example is here: http://jsfiddle.net/Gfca4/


If you can find it Walter Zorn JS Graphics had a javascript graphics engine that worked by creating single pixels using 1x1 divs. It is able to draw lines, shapes, and text. The site had a double buffer animation example by hiding the div you're drawing in then swap with the visible improves performance.

Walter Zorn's website is down

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜