Copy link to clipboard
Copied
Hello,
I am trying to make a triangle shape in After Effects swing in a pendulum motion which decays. This is the expression I have used:
timeToStart = 8;
if (time > timeToStart)
{ Math.sin((time-timeToStart)*10)*50/Math.exp(time-timeToStart)
; } else {
; value
}
The problem that I am having is that after the 8 second mark, the triangle returns to the original position it was in, before I put the code in. To explain better, at the beginning of the animation the triangle does a circular rotation and then stops in a specific almost horizontal position. And what I want it to do after it does that circular motion, at the 8 second mark, is swing down from it's horizontal position to a top down position (meaning that the long pointed end of the triangle is pointing up). The anchor point is in the long point of the triangle which is pointing up. I hope that makes sense - I want it to swing down from it's anchor point in a pendulum motion which decays until it is still in a completely vertical position.
However what is happening is that the expression I have used overrides the rotation and causes the triangle to jerk up into its original almost horizontal position, and then it does the pendulum-decay-animation. The animation is perfect, but the position is wrong.
Any idea on how to fix this? Hopefully this wasn't too confusing to understand 😕
Copy link to clipboard
Copied
Try changing the third line to:
{ value + Math.sin((time-timeToStart)*10)*50/Math.exp(time-timeToStart)
Copy link to clipboard
Copied
Thanks for your answer! But the problem still persists. now the code is like this:
timeToStart = 8;
if (time > timeToStart)
{ value + Math.sin((time-timeToStart)*10)*50/Math.exp(time-timeToStart)} else {
; value
}
the triangle still returns to it's original wrong position when it does the animation.
Any idea why it does that?
Copy link to clipboard
Copied
It's hard to picture exactly how you have things set up, but see if this gets you closer:
timeToStart = 8;
val = value;
if (time > timeToStart)
val = value*Math.cos((time-timeToStart)*10)/Math.exp(time-timeToStart);
val
Copy link to clipboard
Copied
That seems to cancel out the animation and the triangle just sits still. Yeah I understand it's probably hard for you to help me without seeing the set up! But thank you anyway! I think I will just try going a different way with the animation. But thanks for all of your help!