开发者

Animate person jumping with jQuery

Would you be able to animate a person jumping from the bottom of the screen to the top of the screen and have the scroll bar follow the person jumping? I'm pretty sure that's not possible, but I've been wrong before.

Here's a link to a pdf of what I'm describing.

http://docs.google.com/fileview?id=0B-nXtGvomnuqNzE4MjdjMWMtNzA5NC00NGZiLTg2YmItNjJ开发者_C百科mNGY0YjQ5MTM0&hl=en&authkey=CO_RnYAG


Well of course this is possible, how much of this should/can be done in jQuery is another story, anyway here's what you could do:

  • Create several PNG images with the person in various animated position.
  • Preload these images.
  • Use document.body.scrollTop to scroll the document.
  • Use jQuery's animate() or similar to move the dude using some kind of elastic easing, not sure exactly which one fits best.

Not sure how good/smooth this would be though.


A nice example:

http://www.dontcodetired.com/live//jQueryLiveExamples/bouncingball.htm

Almost looks like jumping but then upside down. It should give you a headstart though.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜