Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Flapping based on speed

  • Flapping based on speed

    Posted by Micah Haun on October 26, 2009 at 7:32 pm

    I have a logo in segments that I want to ‘flap’ as the whole piece moves. I figured I could take the speed of the Z movement and interpolate it to XYZ rotation so that at a certain speed it lands in the fully ‘flapping’ position. To isolate the Z speed I sent the Z position to the X Y and Z of a null layer called “Flap”.

    All of that works, but my problem is that speed is apparently an absolute value and will be the same regardless of whether it’s moving forward or backwards. Is there a way to calculate which direction it is moving as well as how fast? That would be the easiest way to make it flap both directions, though I’m open to other suggestions for making this work.

    Thanks!

    Postion - Allows the segments to drift apart a bit. The m value is the max speed value:
    x = thisComp.layer("Null 1").transform.position[0];
    y = thisComp.layer("Null 1").transform.position[1];
    z = thisComp.layer("Null 1").transform.position[2];
    s = thisComp.layer("Flap").transform.position.speed;
    m = thisComp.layer("Flap").effect("MAX")("Slider");
    [x+linear(s, 0, m, 0, -10), y+linear(s, 0, m, 0, -40), z]

    One of the rotation values. Fin is the rotation value at full speed. The other two are the same, just pointing to their respective rotation axis:
    m = thisComp.layer("Flap").effect("MAX")("Slider");
    fin = effect("RotX")("Slider");
    linear(thisComp.layer("Flap").transform.position.speed, 0, m, 0, fin)

    Xinlai Ni replied 16 years, 6 months ago 2 Members · 1 Reply
  • 1 Reply
  • Xinlai Ni

    October 26, 2009 at 8:45 pm

    Instead of using position.speed, you can use position.velocity which is a dim-3 array containing the velocity components of the x,y,z direction.

    Xinlai Ni
    Software Engineer, Google Inc.

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