ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Controlling the ease of a swinging effect?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Dawood Al-Kiyumi
Controlling the ease of a swinging effect?
on Dec 14, 2016 at 10:55:25 am

Hello everyone,

I'm creating a rig using expressions to make fins-like movement for a robotic fish, which will be applied later for a 3D model imported by Element 3D. The expression below is used on multiple layers placed next to each other to have this wavy effect.

So, I want to be able to control the frequency, amplitude, delay (between layers) and randomness (when it's needed).
I used Dan Ebberts' expression (with some modifications) to be able to control the frequency. So here is the expression:

freq = comp("Animation Study 2").layer("Fins Controller").effect("Frequency")("Slider");
amp = comp("Animation Study 2").layer("Fins Controller").effect("Amplitude")("Slider");
delay = thisComp.layer("Fins Controller").effect("Delay")("Slider");

seedRandom(thisComp.layer("Fins Controller").effect("Random Seed")("Slider"), true);

if (thisComp.layer("Fins Controller").effect("Random")("Checkbox") == true) {
Random = random(thisComp.layer("Fins Controller").effect("Random Scale")("Slider")) }
else {
Random = 0

n = freq.numKeys;
if (n > 0 && freq.key(1).time < time){
accum = freq.key(1).value*(freq.key(1).time - inPoint);
for (i = 2; i <= n; i++){
if (freq.key(i).time > time) break;
k1 = freq.key(i-1);
k2 = freq.key(i);
accum += (k1.value + k2.value)*(k2.time - k1.time)/2;
accum += (freq.value + freq.key(i-1).value)*(time - freq.key(i-1).time)/2;
accum = freq.value*(time - inPoint);
value + amp*Math.sin(accum*Math.PI*2 + delay*index + Random)

It's working fine. But now I want to give it more organic feeling by controlling the ease. I mean, I want the movement to get a lot slower as it reaches the amplitude, and gets faster in the middle of the swing.

I'm not sure how to add this controller. Any tips?

Thanks a lot,

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved