Multi-Object Motion frame

Source: Internet
Author: User

    functionStartmove (Obj,attr,itart) {//object, attribute, target valueClearinterval (Obj.time);//Note that the timer must be cleared firstObj.time = SetInterval (function () {            varicur = 0;//values for the current non-inline style            if(attr = = ' opacity ') {//if it's 0.3,Icur = parseint (parsefloat (GetStyle (obj,attr)) *100);//To avoid the occurrence of decimals.}Else{icur= parseint (GetStyle (obj,attr));//take the whole            }            varspend = (itart-icur)/8;//buffered motion, speed spend = spend>0? Math.ceil (spend): Math.floor (spend);//greater than 0 o'clock rounding up, less than 0 o'clock down rounding            if(Icur = = Itart) {//whether to reach the endClearinterval (Obj.time);//after reaching the finish, clear the timer}Else{                if(attr = = ' opacity ') {Obj.style.filter= ' Alpha (opacity: ' + (icur+spend) + ') '; Obj.style.opacity= (icur+spend)/100; document.getElementById ("Txt1"). Value =obj.style.opacity; }Else{obj.style[attr]= icur+spend+ "px";//before you arrive                }            }        },30); }

Multi-Object Motion frame

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.