Creative COW SIGN IN :: SPONSORS :: ADVERTISING :: ABOUT US :: CONTACT US
Creative COW's LinkedIn GroupCreative COW's Facebook PageCreative COW on TwitterCreative COW's Google+ PageCreative COW on YouTube
ADOBE AFTER EFFECTS:HomeForumBasicsExpressionsTutorialsPodcastsAE TechniquesCreative Cloud DebateFAQ

snapping with expressions?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Share on Facebook
sorbetsnapping with expressions?
by on Oct 24, 2006 at 11:29:13 pm

This should be easy. I'm trying to figure out a way (through expressions) that I can snap to different px increments. For example, if you keyframed a square to move from left to right, it would snap to 100px increments.

I realize you can snap to guides or the grid, but I'd like to have it snap constantly, even when you animate something.

Any ideas?



Return to posts index
Reply   Like  

Colin BraleyRe: snapping with expressions?
by on Oct 25, 2006 at 12:04:04 am

This should do it for you:

xSnap = 100;
ySnap = 100;
[ Math.round(value[0]/xSnap) * xSnap , Math.round(value[1]/ySnap) * ySnap ]

Just change xSnap and ySnap to whatever increments you want to snap to. However, note that sometimes if you have an object animated near the edge of the comp it might snap to a value out of the comp window. Have fun.

~Colin


Return to posts index
Reply   Like  

Filip VanduerenRe: snapping with expressions?
by on Oct 25, 2006 at 12:08:11 am

for a hard snap use this:

for a 2D-layer:
[Math.round(value[0]/100),Math.round(value[1]/100)] * 100;

for a 3D layer:
[Math.round(value[0]/100),Math.round(value[1]/100),Math.round(value[2]/100)] * 100;

so it divides each co


Return to posts index
Reply   Like  


sorbetRe: snapping with expressions?
by on Oct 25, 2006 at 12:48:14 am

Thanks guys! Works perfect!



Return to posts index
Reply   Like  

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Share on Facebook


FORUMSTUTORIALSFEATURESVIDEOSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

Creative COW LinkedIn Group Creative COW Facebook Page Creative COW on Twitter
© 2013 CreativeCOW.net All rights are reserved. - Privacy Policy

[Top]