Share Posted February 1, 2013 Hello, I'm just starting with TweenLite and I have a very basic question: I tween a movieclip in a mouseup event (it is a simple scroll), using this: TweenLite.to(mc, 2, {throwProps:{x:200, y:0}, ease:Strong.easeOut}); The effect looks good, but I need to limit the movieclip "mc" X. The mc may have a maximum X value of 0, and a minimum of -1500, so I can tween the mc without showing the background under the mc. Is there any way to limit the tween or to stop the tween when the mc reach the limits? Thank you very much. Link to comment Share on other sites More sharing options...
Share Posted February 1, 2013 Sure, there is a full explanation of min and max values for throw props Tweens with sample code right in the docs: http://api.greensock.com/as/com/greensock/plugins/ThrowPropsPlugin.html To use the Strong.easeOut easing equation and impose maximum and minimum boundaries on the end values, use the object syntax with the max and min special properties like this: TweenLite.to(mc, 2, {throwProps:{x:{velocity:500, max:1024, min:0}, y:{velocity:-300, max:720, min:0}}, ease:Strong.easeOut}); Notice the nesting of the objects ({}). The max and min values refer to the range for the final resting position (coordinates in this case), NOT the velocity. So mc.x would always land between 0 and 1024 in this case, and mc.y would always land between 0 and 720. If you want the target object to land on a specific value rather than within a range, simply set max and min to identical values. Also notice that you must define a velocity value for each property. Link to comment Share on other sites More sharing options...
Author Share Posted February 4, 2013 Thank you, with this and some tests with the velocity, now I have a very good scroll that works perfectly in iOS, even in a iPhone 3Gs. The GreenSock club membership is totally worth it. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now