Activity › Forums › Adobe After Effects Expressions › Scale Expression
-
Scale Expression
Posted by Moog Gravett on August 22, 2006 at 8:19 amHi guys,
apologies if this is more suited to the beginner board (let me know and i’ll post such things there in future) but…
I’m just trying to get a handle on expressions (thought it’s about time) so want to start with something simple yet useful.
I’d like to scale a layer up and down – but smoothly, like the scaling is sinusoidal.
THEN, i want to have another layer copy the same scaling motion, but with a slight delay (i’m thinking a percentage of the comps time)
I’ve checked the boards and tuts etc, but my problem is, I don’t really know what I’m looking for – apart from a quick fix 😉
cheers for any help
Moog
Video Editor
Kuju Entertainment
http://www.kuju.comMoog Gravett replied 19 years, 8 months ago 4 Members · 7 Replies -
7 Replies
-
Mylenium
August 22, 2006 at 9:51 amAnimate your scale as one cycle with keyframes, then use loopOut(“cycle”,0). You can offset your animation by either moving the keyframes or the entire layer in the timeline.
Mylenium
[Pour Myl
-
Moog Gravett
August 22, 2006 at 10:00 amthanks for that,
but i specifically wanted to use an expression for scale to ensure I had a perfect sinusoidal motion,
and theres also the other part about controling the length and offset of the scale of a different layer relation to the comps length.but i appreciate the help anyway
moog
-
Mike Clasby
August 22, 2006 at 11:10 amThis earlier post from Dan (Sinusoidal Motion, position expression for y motion below) is a good place to start:
Name: Dan Ebberts
Date: Jul 22, 2004 at 05:27 gmt
Subject: Re: Move something in a wave/sinusoidal motion?
What do you mean? You can use Math.sin with a position expression. Here’s a simple example, this will move your layer up and down + and – 50 pixels three times a second:freq = 3; //frequency (cycles per second)
ampl = 50; //amplitude (pixels)
y = ampl*Math.sin(time*freq*Math.PI*2);
value + [0,y]
Dan
I dunno expressions much, but I love to hack Dan’s, so I hacked away and got this for scale (both x and y):
freq = 3; //frequency (cycles per second)
ampl = 50; //amplitude (pixels)x = ampl*Math.sin(time*freq*Math.PI*2);
y = ampl*Math.sin(time*freq*Math.PI*2);value + [x,y]
Change the Freq and Ampl to change the rhythm of sinusoidal change. You can even link those (Freq and Amp) to Sliders to make the changes easy and fast, but that’s another post. Lots to chew over here. Oh, yeah, the”value” in the last line just lets you change the size before the expression takes over, you can even set keyframes and then the wave action plays around those.
For a graphic version see jjgifford’s site, Geometry, here:
https://jjgifford.com/expressions/geometry/harmonic.html
Go back an forward a few pages to cover the sine stuff.
Dan’s site is a great place for expressions too:
This is just the basic sine scale you asked for, as far as the change with relation to comp length, that’s beyond my play grade, you’ll need someone else to tackle that.Welcome to expressions, they are a blast, even if you’re just a hacker like me.
-
Mike Clasby
August 22, 2006 at 11:34 amOK, here’s another hack for your delay, but not off a percentage of the comp length (still beyond me). Again this is a Dan Hack, from his site,the page on Creating Trails:
https://www.motionscript.com/mastering-expressions/follow-the-leader.html
It the next expression after the heading “An Interesting Variation” a third of the way down the page (I just changes rotation to scale):
delay = 1; //number of frames to delay
d = delay*thisComp.frameDuration*(index – 1);
thisComp.layer(1).scale.valueAtTime(time – d)This expression tells the second layer down (the “index-1” part) to take the top layers scale but delayed by 1 frame. You can put any number in for the 1, but a number like Dan’s 5 for the rotation example on his page makes it jumpy and the 1 makes a nice smooth wave that ripples down the copies, anyway tweak to taste.
So that expression from my first post is on the top layer, and then this scale expression on a Dup (Ctrl D) second layer, then just Dup that as many times as you want copies, each will be delayed one frame from the layer above. If you put a different type of layer on the top, this expression will take it’s orders from that layer, for instance a pic without an expression for scale (your original Sine one) sitting on top will kill everyone down the line.
-
Moog Gravett
August 22, 2006 at 2:43 pmooh ooh ! awesome, cheers yikesmikes!
this is just the stuff i’m after…
can I ask one more thing and I’ll leave you alone 😉
how about if I wanted to make each layer incrementally larger than the one above? I’ve been searching the sites but I guess i’ll need to study up a little more before I really understand what I’m on about!
Moog
-
Colin Braley
August 22, 2006 at 8:23 pmYou could use something like this as an expression for scale:
//–begin expression
sBegin = [100, 100];//Scale of first layer
increment = [10, 10];//amound to increase scale by
sBegin + increment * index
//–end expressionHope this helps.
~Colin -
Moog Gravett
August 23, 2006 at 10:46 amthats the ticket!! thanks colin, and to all for your help 😀
Reply to this Discussion! Login or Sign Up