-
Flapping based on speed
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)