Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Controlling the ease of a swinging effect?

  • Controlling the ease of a swinging effect?

    Posted by Dawood Al-kiyumi on December 14, 2016 at 10:55 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;
    }else{
    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,
    Dawood

    Dawood Al-kiyumi replied 9 years, 8 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy