(39) JS motion buffering and 39js motion Buffering
Basic Idea: the timer is used to make the object move to the right. In the process of motion, it is not a constant speed, but fast and slow, that is, the larger the distance, the faster the speed, the smaller the distance, the lower the speed, but when the end point is reached, you must use the rounded up Math function. ceil () and the entire down function Math. floor (); in this way, you can reach the end point correctly, instead of having any discrepancies.
<! Doctype html> <! ----> <Html> :
Initial status, starting from left and from right respectively:
If there is no integer, the title indicates the end position and speed:
There is no error in rounding:
Js Buffer Effect menu code
Make a fake buffer and start to represent it with a buffer image. Call the function three seconds later, and then click the navigation bar.
Pages that can be cached by JS
Do you mean to save some information in a js object?
You can declare a global variable to save the data, which can be used throughout the page.
However, pay attention to the value assignment of variables. If the data remains unchanged, it can be used as a constant;
When assigning values midway through, be sure to avoid errors caused by not assigning values to variables for operations such as page refreshing!