Activity › Forums › Adobe After Effects Expressions › simple scale expression
-
simple scale expression
Posted by Robert Mutchler on April 14, 2008 at 3:28 pmI’m totally NEW to expressions and need to know how to do a simple scale expression over 30 seconds or just make it a loop.
I’m scaling a cartoon sun and just want to make the sun flames scale in and out over 30 seconds.
scale X,Y needs to go from 100 to 105 and back to 100.
thanks
Robert Mutchler
Wave Action VideoCaleb Minear replied 12 years, 8 months ago 3 Members · 10 Replies -
10 Replies
-
Dan Ebberts
April 14, 2008 at 5:50 pmSomething like this should work:
rampStart = 0;
rampEnd = 30;
startVal = [100,100];
maxVal = [105,105];rampMid = rampStart + (rampEnd – rampStart)/2;
if (time < rampStart || time > rampEnd){
value
}else if (time < rampMid){ ease(time,rampStart,rampMid,startVal, maxVal) }else{ ease(time,rampMid,rampEnd,maxVal,startVal) } Dan -
Robert Mutchler
April 14, 2008 at 6:47 pmThanks Dan,
It didn’t work for whatever reason. I copy and pasted the formula just how you wrote it.
Robert Mutchler
Wave Action Video -
Dan Ebberts
April 14, 2008 at 6:52 pmDid it generate an error, or did it just not do anything? Scaling from 100% to 105% and back over 30 seconds is going to be barely perceptible.
Dan
-
Robert Mutchler
April 14, 2008 at 6:55 pmno error but I guess I wrote my question wrong. I want the layer to scale back and fourth from 100-105 over time. say every 15 frames it bounces back and forth from 100-105. sorry about the confusion.
Robert Mutchler
Wave Action Video -
Dan Ebberts
April 14, 2008 at 7:20 pmSomething like this then, maybe:
period = 15;
maxVal = 105;
minVal = 100;f = 1/(period*thisComp.frameDuration);
amp = (maxVal – minVal);
s = amp*(Math.sin(f*time*Math.PI*2 – Math.PI/2) + 1)/2;value + [s,s]
Dan
-
Robert Mutchler
April 14, 2008 at 7:31 pmThat work! I change the period to 30 from 15. It was a bit quick. One more question if it’s easy to answer. I got the first 3 lines of code but the rest is confusing. I’m not great at math so I don’t know if even breaking it down will help. Thanks again.
Robert Mutchler
Wave Action Video -
Dan Ebberts
April 14, 2008 at 8:18 pmFirst I convert the period to a frequency to use with the sine wave. The rest is just setting the sin wave up to start at 0, oscillate between 0 and 5, and ride on top of the static value (presumably 100 in this case).
Dan
-
Caleb Minear
September 4, 2013 at 8:23 pmHey! I found this and the first expression,
rampStart = 0;
rampEnd = 30;
startVal = [100,100];
maxVal = [105,105];rampMid = rampStart + (rampEnd – rampStart)/2;
if (time < rampStart || time > rampEnd){
value
}else if (time < rampMid){
ease(time,rampStart,rampMid,startVal, maxVal)
}else{
ease(time,rampMid,rampEnd,maxVal,startVal)
}Works for what I need, i just need to make it happen faster. How do I do this?
Reply to this Discussion! Login or Sign Up