Recently, David Bovill wrote: > Are there any ideas for natural type movements - straight acceleration > (maybe with ease in and / or ease out)?
You're welcome to use the following (watch wraps). It's set up as a handler with parameters to allow for easing (moving) multiple objects at once. So you can place the code in the card script, for example, and call "easeObject..." for each object on the card you want to move. (Requires Rev 2.7 or later for object fading.) # EASE IN/OUT ANIMATION SCRIPT # # VARIABLE DESCRIPTIONS # pObj = LONG ID OF OBJECT TO MOVE # pStartLoc = STARTING LOCATION # pDestLoc = ENDING LOCATION # pMethod = "IN" OR "OUT" -- "IN" DECELERATES, "OUT" ACCELLERTATES # pDuration = DURATION OF EASE EFFECT # pStartTime = TIME IN MILLISECONDS WHEN EASE EFFECT BEGINS # pFade = "IN" OR "OUT" -- OPTIONAL FADE IN/OUT OF EASED OBJECT # pHost = LONG ID OF OBJECT TO RECEIVE 'EASEDONE' MESSAGE on easeObject pObj,pStartLoc,pDestLoc,pMethod,pDuration,pStartTime,pFade,pHost put (the millisecs - pStartTime)/pDuration into phi # REQUIRED FOR SHORT MOVE TIMES if phi > 1 then put 1 into phi # USE APPROPRIATE FUNCTION if pMethod = "in" then put (2*phi - phi^2) into tEase # EASE IN if pMethod = "out" then put phi^2 into tEase # EASE OUT # MOVE OBJECT put (item 1 of pDestLoc - item 1 of pStartLoc) into xDist put (item 2 of pDestLoc - item 2 of pStartLoc) into yDist put item 1 of pStartLoc + round(tEase * xDist) into newX put item 2 of pStartLoc + round(tEase * yDist) into newY set loc of pObj to newX,newY if pFade = "in" then set blendLevel of pObj to 100 - (phi * 100) if pFade = "out" then set blendLevel of pObj to (phi * 100) # EXIT WHEN OBJECT REACHES ITS DESTINATION if ((newX,newY) = pDestLoc) or (phi >= 1) then send "easeDone pObj" to pHost exit easeObject end if # LOOP SCRIPT send "easeObject pObj,pStartLoc,pDestLoc,pMethod,pDuration,pStartTime,pFade,pHost" to me in 10 milliseconds end easeObject Regards, Scott Rossi Creative Director Tactile Media, Multimedia & Design _______________________________________________ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution