JavaScript motion framework multi-value motion (4) and javascript motion framework
Multi-value movement, that is, for an object, not only is one of the attribute values changing, but also many, such as width, height, Font, transparency, and so on.
Of course, there is a problem with the multi-value games, that is, when the timer is closed! Of course, only when all attribute values are moved to the target value can the timer be cleared, that is, the slowest. It's like a dinner for ten people. You can't eat it when you get there!
The first few articles talk about the motion of an attribute in an element object. This time we talk about the buffering motion of multiple attribute values in the same element object, so each attribute has an end point (target point ), we can write these attributes and their target values as an object, or json-like! The common speed function is used here, but some property values are from 100-> 101, and some property values are from 100-> 600, you have to wait until the longest time-consuming attribute value reaches the target value to close the timer of the obj. The design idea is to set a bStob = true for each round-robin function; when scanning attributes in json, set the attribute to false as long as it has not reached the target value, so that the timer will not close, even if some attribute values have reached the end point, at this time, the scanning will still be performed, but the speed of this attribute is zero and it will not be moved. That is, before:
if(attr == cur) { cleartInterval(obj.timer);}
To be enhanced:
if (bStop) { clearInterval(obj.timer);}
<! 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.