Details about the parabolic motion example of js elastic potential energy animation, and js Potential Energy
Parabolic motion: When the drag ends, we make the current element move horizontally + vertically at the same time.
In the same moving distance, we move the mouse fast, and the move method triggers less times. On the contrary, the moving speed is slow, the move method is triggered more times-> the browser will trigger each move action at a minimum time.
Through observation, we found that the horizontal direction of the box is not necessarily related to the moving speed and the moving distance when the drag and drop ends, nor to the speed at which the drag starts, it is only related to the speed of the mouse at the last moment that is about to be released. If the mouse moves fast at the last moment, the distance and speed of our horizontal movement are also relatively large. -> Get the speed when the mouse is about to be released for the last time.
In the JS box model, offsetLeft is used to obtain the left offset of the current element and the obtained value.There will never be decimal places, and the true left value will be rounded to the decimal point for calculation.
The Code is as follows:
<! DOCTYPE html>
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.