JavaScript motion framework multi-value motion (4) and javascript motion framework

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.