-
Auto orient path on shape layer
Hello there,
I’m trying to do something that sounds very simple to do but which is not (to me, at least)
I have a shape layer with a stroke, an offset path and a trim path. The trim path animates the line. To the line I attached an arrow shape with a simple polygon with 3 points (so, a triangle). The triangle is following exactly the line thanks to the old trick and copying the vector path of the stroke to the position parameter of my triangle.
Now I need the triangle to auto orient along that position path. Of course I could use the old trick of retrieving the orientation from a null objet with auto orient on.
But I don’t want to do that, I want every thing to be contained inside a simple and unique shape layer.
So I used this expression to the rotation property of the triangle :vecSpeed = content("Group 1").transform.position.velocity;
radians = Math.atan2(vecSpeed[1], vecSpeed[0]);
radiansToDegrees(radians)+90Which works fine except that the angle snaps at the beginning and the end of the animation, when the velocity is equal to 0.
I tried to solve this problem with if/else expressions, trying to block the value to the frame before the last keyframe when the velocity is equal to 0, but that exceeds my level of knowledge.
Anyone has an idea to solve this ?
Here is the aep file