blase Posted October 7, 2009 Share Posted October 7, 2009 what is this exactly? snapping to whole pixels? can this be applied to any tween? (in which ofcourse x and y are used) thanks! Link to comment Share on other sites More sharing options...
GreenSock Posted October 7, 2009 Share Posted October 7, 2009 Yep, roundProps can be used to snap x/y coordinates to whole pixels, but you can use it for more than that if you want. It's for any values that should be snapped to whole numbers. TweenMax.to(mc, 2, {x:200, y:100, roundProps:["x", "y"]}); //x and y get rounded every time they're updated TweenMax.to(customObject, 2, {customProperty:300, roundProps:["customProperty"]}); //customObject.customProperty gets rounded every time it's updated. Link to comment Share on other sites More sharing options...
blase Posted October 10, 2009 Author Share Posted October 10, 2009 TweenMax.to(mc, 2, {x:200, y:100, roundProps:["x", "y"]}); is this the same if i write? TweenMax.to(mc, 2, {x: int(200), y: int(100) }); Link to comment Share on other sites More sharing options...
GreenSock Posted October 10, 2009 Share Posted October 10, 2009 Nope, that's completely different. Your code would just make sure that the END values are rounded downwards, but when you use the roundProps special property, it ensures that at every point during the tween (every time it renders), the values are rounded before being applied to your object. That way, it would always be placed on whole pixels all along the way. Make sense? Link to comment Share on other sites More sharing options...
jayzonhe3 Posted April 10, 2013 Share Posted April 10, 2013 TweenMax.to(container, speed, {bezier:[{y:middle.y},{scaleX:1, scaleY:1,y:middle.y},{scaleX:1, scaleY:1,y:middle.y},{y:end.y,x:end.x, scaleX:.6,scaleY:.6}], startAt:{x:start.x, y:start.y, scaleX:.6,scaleY:.6, alpha:1}, endAt:{scaleX:.2, scaleY:.2, alpha:0}, roundProps:["y", "x"], ease:Sine.easeInOut, repeat:-1, delay:delay}); I have this code that I am using I want the X and Y positions to be constrained to int but the scale needs to be a number. This code seems to round all props. Am I doing something wrong? Link to comment Share on other sites More sharing options...
GreenSock Posted April 10, 2013 Share Posted April 10, 2013 Hmm...what's that "endAt" for? That's not a supported special property (unless my memory is failing me) Also, for bezier tweening, every object in the array must contain the same properties. It looks like your first one only has a "y" property but the others have "scaleX" and "scaleY" and one even has "x". Are you using v12? If so, you can now simplify the roundProps to roundProps:"x,y" instead of roundProps:["x","y"], although the format you used should still work fine. I think the problem is likely in your bezier values and the fact that you don't have consistency. 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