问题
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