Acceleration with jQuery

北城以北 提交于 2019-12-12 01:18:15

问题


I am trying to create a free-falling effect under the action of gravity in my browser. Basic Physics should tell you that the more the body (a div in this case) falls the faster should be its velocity.

Any ideas how to implement this?

Basically the velocity of the object should be equal to 'at' at all times. Where t = time period and a = acceleration = 9.8.


回答1:


Theres a jQuery 'physics' plugin that allows you to apply physics to elements. You can create vectors and assign velocity/gravity etc: http://plugins.jquery.com/project/jphysics

Hope that helps :)




回答2:


If you are animating your effect, it would be easier for you to use the time period on the object using the time of effect in jquery.



来源:https://stackoverflow.com/questions/4755852/acceleration-with-jquery

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!