Mike Clasby
Forum Replies Created
-
This is a modification (scale for position) of the first expression on Dan’s page on Trails:
delay = 10; //number of frames to delay
d = delay*thisComp.frameDuration*(index – 1);
thisComp.layer(1).position.valueAtTime(time – d)To make this work the first layer to scale is the top layer (layer 1) and the expression goes on the layer you want to follow in its scaling. There can be other layers in the comp, the lead scaling layer just needs to be the top layer.
Here’s the page:
https://www.motionscript.com/mastering-expressions/follow-the-leader.html
-
This is a modification (scale for position) of the first expression on Dan’s page on Trails:
delay = 10; //number of frames to delay
d = delay*thisComp.frameDuration*(index – 1);
thisComp.layer(1).position.valueAtTime(time – d)To make this work the first layer to scale is the top layer (layer 1) and the expression goes on the layer you want to follow in its scaling. There can be other layers in the comp, the lead scaling layer just needs to be the top layer.
Here’s the page:
https://www.motionscript.com/mastering-expressions/follow-the-leader.html
-
Oops, I meant this to go above on another expression.
-
Oops, I meant this to go above on another expression.
-
I think I like that the best of all your Follow the Leader expressions, it’s so Loosie-Goosie-organic
-
I think I like that the best of all your Follow the Leader expressions, it’s so Loosie-Goosie-organic
-
Here a set of expressions,very nice with squish a squash as the ball bounces, not as hairy as it looks if you can copy/paste expressions (Alt + Click the Stopwatch for the property you want to apply the expression to, then paste)
I just remembered Dan had a nice bouncing animation expression from this post:
Name: Dan Ebberts
Date: Sep 14, 2004 at 11:40:45 am
Subject: Re: bouncing animationHere are a couple of bounce simulation expressions. The first one is for position and the second is for scale. With the parameters set the way they are, your object will drop until it reaches y = 400 (“floor”) and then bounce. You can control everything with the parameters (even better- assign them to sliders). You can use Vx0 and Vy0 to give your object an initial velocity – turning it into a projectile. For best results, move the anchor point of your object to the bottom. Here’s the expression for poisition:
Vy0 = 500; //initial y velocity (pixels/second)
Vx0 = 100; // initial x velocity (pixels/second)
g = 2500; // gravity (pixels/second/second)
floor = 400;
e = .85; //elasticityd = .03; //squash factor
spd= 10; //speed of squash oscillation
decay= 10.0; //how fast squash slows downb = floor – position.valueAtTime(0)[1];
h = b + Vy0*Vy0/(2*g);
T = Vy0/g + Math.sqrt(2*h/g);if (time < T){ x = scale[0]; y = scale[1]; }else{ Vy = -(Vy0 - g*T); while (true){ max_dev = e*Vy*d; Vy *= e; t = T; T += 2*Vy/g; if (time < T){ t = time - t; x=scale[0]+max_dev*Math.cos(spd*(t))/Math.exp(decay*t); y=scale[0]*scale[1]/x; break; }else if (T - t < thisComp.frameDuration){ x = scale[0]; y = scale[1]; break; } } } [x,y] And for scale: Vy0 = 0; //initial y velocity (pixels/second) Vx0 = 0; // initial x velocity (pixels/second) g = 2500; // gravity (pixels/second/second) floor = 400; e = .85; //elasticity d = .02; //squash factor spd= 10; //speed of squash oscillation decay= 10.0; //how fast squash slows down b = floor - position.valueAtTime(0)[1]; h = b + Vy0*Vy0/(2*g); T = Vy0/g + Math.sqrt(2*h/g); if (time < T){ x = scale[0]; y = scale[1]; }else{ Vy = -(Vy0 - g*T); while (true){ max_dev = e*Vy*d; Vy *= e; t = T; T += 2*Vy/g; if (time < T){ t = time - t; x=scale[0]+max_dev*Math.cos(spd*(t))/Math.exp(decay*t); y=scale[0]*scale[1]/x; break; }else if (T - t < thisComp.frameDuration){ x = scale[0]; y = scale[1]; break; } } } [x,y] Dan
-
Here a set of expressions,very nice with squish a squash as the ball bounces, not as hairy as it looks if you can copy/paste expressions (Alt + Click the Stopwatch for the property you want to apply the expression to, then paste)
I just remembered Dan had a nice bouncing animation expression from this post:
Name: Dan Ebberts
Date: Sep 14, 2004 at 11:40:45 am
Subject: Re: bouncing animationHere are a couple of bounce simulation expressions. The first one is for position and the second is for scale. With the parameters set the way they are, your object will drop until it reaches y = 400 (“floor”) and then bounce. You can control everything with the parameters (even better- assign them to sliders). You can use Vx0 and Vy0 to give your object an initial velocity – turning it into a projectile. For best results, move the anchor point of your object to the bottom. Here’s the expression for poisition:
Vy0 = 500; //initial y velocity (pixels/second)
Vx0 = 100; // initial x velocity (pixels/second)
g = 2500; // gravity (pixels/second/second)
floor = 400;
e = .85; //elasticityd = .03; //squash factor
spd= 10; //speed of squash oscillation
decay= 10.0; //how fast squash slows downb = floor – position.valueAtTime(0)[1];
h = b + Vy0*Vy0/(2*g);
T = Vy0/g + Math.sqrt(2*h/g);if (time < T){ x = scale[0]; y = scale[1]; }else{ Vy = -(Vy0 - g*T); while (true){ max_dev = e*Vy*d; Vy *= e; t = T; T += 2*Vy/g; if (time < T){ t = time - t; x=scale[0]+max_dev*Math.cos(spd*(t))/Math.exp(decay*t); y=scale[0]*scale[1]/x; break; }else if (T - t < thisComp.frameDuration){ x = scale[0]; y = scale[1]; break; } } } [x,y] And for scale: Vy0 = 0; //initial y velocity (pixels/second) Vx0 = 0; // initial x velocity (pixels/second) g = 2500; // gravity (pixels/second/second) floor = 400; e = .85; //elasticity d = .02; //squash factor spd= 10; //speed of squash oscillation decay= 10.0; //how fast squash slows down b = floor - position.valueAtTime(0)[1]; h = b + Vy0*Vy0/(2*g); T = Vy0/g + Math.sqrt(2*h/g); if (time < T){ x = scale[0]; y = scale[1]; }else{ Vy = -(Vy0 - g*T); while (true){ max_dev = e*Vy*d; Vy *= e; t = T; T += 2*Vy/g; if (time < T){ t = time - t; x=scale[0]+max_dev*Math.cos(spd*(t))/Math.exp(decay*t); y=scale[0]*scale[1]/x; break; }else if (T - t < thisComp.frameDuration){ x = scale[0]; y = scale[1]; break; } } } [x,y] Dan
-
There is a script call Gravity.jsx
Select the layer you want to apply gravity to,
File > Run Script > Choose File > and you should open up to the folder (demos)
Note: (demos) is a folder nested here (on a PC): C drive > Program Files > Adobe > After Effects 6.5 > Support Files > Scripts > Demos
there should be a file there named “Gravity.jsx”
select it.
Now when you click the “Run Simulation” in the Gravity script palette you’ll get keyframes of the chosen gravity attributes (chosen in the palette). Also a cool plus, if you keyframe position as in moving the ball (or whatever layer is selected when you open the script) you’ll get a nice moving ball bouncing, note two that the layer bounce around a box created in the palette, just click he “?” for details> -
There is a script call Gravity.jsx
Select the layer you want to apply gravity to,
File > Run Script > Choose File > and you should open up to the folder (demos)
Note: (demos) is a folder nested here (on a PC): C drive > Program Files > Adobe > After Effects 6.5 > Support Files > Scripts > Demos
there should be a file there named “Gravity.jsx”
select it.
Now when you click the “Run Simulation” in the Gravity script palette you’ll get keyframes of the chosen gravity attributes (chosen in the palette). Also a cool plus, if you keyframe position as in moving the ball (or whatever layer is selected when you open the script) you’ll get a nice moving ball bouncing, note two that the layer bounce around a box created in the palette, just click he “?” for details>