Package | com.greensock.plugins |
Class | public class DynamicPropsPlugin |
Inheritance | DynamicPropsPlugin TweenPlugin Object |
TweenLite.to(mc, 3, {dynamicProps:{x:getMouseX, y:getMouseY}}); function getMouseX():Number { return this.mouseX; } function getMouseY():Number { return this.mouseY; }
Of course you can get as complex as you want inside your custom function, as long as it returns the destination value, TweenLite/Max will take care of adjusting things on the fly.
You can optionally pass any number of parameters to functions using the "params" special property like so:
TweenLite.to(mc, 3, {dynamicProps:{x:myFunction, y:myFunction, params:{x:[mc2, "x"], y:[mc2, "y"]}}}); function myFunction(object:MovieClip, propName:String):Number { return object[propName]; }
DynamicPropsPlugin is a Club GreenSock membership benefit. You must have a valid membership to use this class without violating the terms of use. Visit http://www.greensock.com/club/ to sign up or get more details.
USAGE:
import com.greensock.TweenLite; import com.greensock.plugins.*; TweenPlugin.activate([DynamicPropsPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. TweenLite.to(my_mc, 3, {dynamicProps:{x:getMouseX, y:getMouseY}}); function getMouseX():Number { return this.mouseX; } function getMouseY():Number { return this.mouseY; }
Copyright 2008-2013, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for Club GreenSock members, the software agreement that was issued with the membership.