Creative COW SIGN IN :: SPONSORS :: ADVERTISING :: ABOUT US :: CONTACT US :: FAQ
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

linear expression

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Share on Facebook
Andrew Falklinear expression
by on May 21, 2012 at 11:38:43 pm

so i am trying to animate as a test first, a simple square moving from right to left. as it approaches the center of the comp it scales up, as it continues to move past center it will scale back down.

I have posted the code i am trying to use

what am i doing wrong here?

any and all help is appreciated :)

x=transform.position[0];
scaleInStart=thisComp.layer("CONTROLLER").effect("SI")("Slider");
scaleInStop=thisComp.layer("CONTROLLER").effect("SU")("Slider");
scaleOutStart=thisComp.layer("CONTROLLER").effect("SO")("Slider");
scaleOutStop=thisComp.layer("CONTROLLER").effect("SD")("Slider");

scaleUP = linear(x,100,200,scaleInStart,scaleInStop);
scaleDown = linear(x,100,200,scaleOutStart,scaleOutStop);

linear(x,100,200,scaleUp,scaleDown);


Return to posts index
Reply   Like  

Dan EbbertsRe: linear expression
by on May 22, 2012 at 12:13:55 am

I haven't tested this, but I would replace the last three lines with this (it assumes that 200 is your center x position):


if (x < 200)
linear(x,100,200,scaleInStart,scaleInStop)
else
linear(x,200,300,scaleOutStart,scaleOutStop);



Dan



Return to posts index
Reply   Like  

Andrew FalkRe: linear expression
by on May 22, 2012 at 12:26:54 am

I will try that tonight, thanks. I had a feeling i needed an (if-else) statement in there, but wasnt sure.

Thanks, Ill let you know if it works.


Return to posts index
Reply   Like  


Andrew FalkRe: linear expression
by on May 22, 2012 at 12:28:48 am

i assume i could use the same thing for a rotation as well?


Return to posts index
Reply   Like  

Dan EbbertsRe: linear expression
by on May 22, 2012 at 12:32:35 am

The same idea should work for rotation.

Dan



Return to posts index
Reply   Like  

Andrew FalkRe: linear expression
by on May 22, 2012 at 4:19:15 pm

That doesnt seem to work. i get the "expression result must be of dimension 2, not 1"


Return to posts index
Reply   Like  


Dan EbbertsRe: linear expression
by on May 22, 2012 at 4:26:52 pm

Ah yes, sorry. For scale it would be like this:


if (x < 200)
linear(x,100,200,[scaleInStart,scaleInStart],[scaleInStop,scaleInStop])
else
linear(x,200,300,[scaleOutStart,scaleOutStart],[scaleOutStop,scaleOutStop]);


The other form should work for single-dimension properties like rotation.

Dan



Return to posts index
Reply   Like  

Andrew FalkRe: linear expression
by on May 22, 2012 at 4:31:08 pm

whoo, hoooo that worked. Me and a colleague were looking at the code, when your reply came through.

Thanks alot Dan!!!


Return to posts index
Reply   Like  

Andrew FalkRe: linear expression
by on May 22, 2012 at 4:59:28 pm

one last question, if i wanted to ease the animation, do i replace "linear" with "ease"?


Return to posts index
Reply   Like  


Dan EbbertsRe: linear expression
by on May 22, 2012 at 5:19:20 pm

That's correct.

Dan



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
© 2014 CreativeCOW.net All rights are reserved. - Privacy Policy

[Top]