Creative COW SIGN IN :: SPONSORS :: ABOUT US :: CONTACT US
ADOBE AFTER EFFECTS: ForumAE BasicsAE ExpressionsTutorialsArticlesPodcastsMotion GraphicsTrainingCinema 4D

Exponential Functions in AE Expressions

Cow Forums : Adobe After Effects Expressions
cow
Exponential Functions in AE Expressions
by Roman Alvarado on Jun 30, 2008 at 1:00:32 pm

Hello. I am completely new to AE and recently began working with Expressions from scratch. I want a 2D object to scale from 10% to 100% over a modifiable length of time. However, I do not want the transformation to be linear and I don't want to create keyframes since this effect will later be triggered by another layer's properties.

begS=10;//initial and minimum scale
dK=.95//decay rate, must be < 1
xScale=begS+90-(90*(dK^time));// initial time + 90- a value that decreases with time from 90, never reaching 0.
yScale=xScale
[xScale,yScale]

I suspect it's a noob's syntax or language issue because the formula looks right in a graphing calculator. Basically, when I use this expression the animation jumps around and begins at 100% scale.

Anything to the 0 power is 1, so the scale value at time=0 should be: 10+90-(90*1)=10%.
At time=1, the scale should be: 10+90-(90*.95)=14.5%... and so on.

Thanks you for any help.




I searched the forums and found no explicit discussion about exponential notation within After Effects Expressions.

Respond to this post     Return to posts index

cow
Re: Exponential Functions in AE Expressions
by Darby Edelen on Jun 30, 2008 at 5:39:46 pm

[Roman Alvarado] "I searched the forums and found no explicit discussion about exponential notation within After Effects Expressions."

You can use any JavaScript math functions in AE expressions.

http://www.javascripter.net/faq/mathfunc.htm

I believe the one you're looking for is Math.pow(a,b)

Darby Edelen
Lead Designer
Left Coast Digital
Santa Cruz, CA

Respond to this post     Return to posts index

cow
Re: Exponential Functions in AE Expressions
by Roman Alvarado on Jun 30, 2008 at 7:26:30 pm

Ha! I knew it was a simple mistake. That's what I was looking for, thank you. I did manage to figure out a very roundabout solution to create a similar effect, but not as adjustable:

timeToFrames(t = time + thisComp.displayStartTime, fps = 1.0 / thisComp.frameDuration, isDuration = false)
timePos=((thisComp.layer("Shape Layer 1").transform.position[0])-position[0])/fps;
hxPos=thisComp.layer("Shape Layer 1").transform.position[0];
pPos=position[0];
sx=10+90-(90*Math.exp(-timePos));
sy=sx;
sz=sx;
if(hxPos>pPos){
[sx,sy,sz];
}else{[10,10,10]};

Thanks for the response.


Respond to this post     Return to posts index

<< PREVIOUS THREAD   •   VIEW ALL THREADS   •   PRINT   •   NEXT THREAD >>


FORUMSTUTORIALSMAGAZINEDVDsBOOKSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

© CreativeCOW.net All rights are reserved.

[Top]