Share Posted August 9, 2013 Hi, I've created this little See the Pen kqoeu by omnider (@omnider) on CodePen to demonstrate what my problem is. Is there any chance to make the animation smoother? Now you can clearly see the image going from pixel to pixel .. is there any way to do some sort of subpixel animation? So far I've tried this, the same with x/y, turning off the autoRound plugin, none of which seems to do it any good. Any ideas would are appreciated Cheers Link to comment Share on other sites More sharing options...
Share Posted August 9, 2013 The browsers force "top" and "left" values to get rounded, so they'll only land on whole pixels even if GSAP is setting the values with precise decimals. Some browsers also apply rounding to 2D transforms as well. However, if you kick things into 3D, it can (in many browsers) offload things to the GPU in a way that allows sub-pixel rendering. You could set a z property to something like 0.01 or recent versions of GSAP have a "force3D" boolean that you can set. Here's a revised codepen that looks smoother at least in webkit browsers: http://codepen.io/GreenSock/pen/e8caea66998087e88d25deb2ed6096b8 Firefox appears to still force some rounding though, so this isn't a perfect fix in all scenarios (I don't think there is such a thing). 5 Link to comment Share on other sites More sharing options...
Author Share Posted August 13, 2013 Thanks a lot for that. Brilliant solution as always! Link to comment Share on other sites More sharing options...
Share Posted August 14, 2013 Hi, Nothing to add to Jack's answer, but this post ( including the video ) will make the things about animating with top/left vs x/y a little bit clear: http://www.paulirish.com/2012/why-moving-elements-with-translate-is-better-than-posabs-topleft/ Link to comment Share on other sites More sharing options...
Share Posted January 20, 2014 You could set a z property to something like 0.01 or recent versions of GSAP have a "force3D" boolean that you can set. Perfect! I tried setting translateZ in CSS but naturally that didn't work as 2D transforms in GSAP use the matrix syntax, not translate3d. Link to comment Share on other sites More sharing options...
Share Posted January 20, 2014 Hey Jens. Actually, it shouldn't matter what syntax you use (matrix or list or whatever). If you're having any trouble, feel free to post a simple codepen or jsfiddle that demonstrates the issue and we'll take a peek. 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