• Global community
• Language:
• Deutsch
• English
• Español
• Français
• Português
• 日本語コミュニティ
Dedicated community for Japanese speakers
• 한국 커뮤니티
Dedicated community for Korean speakers
Exit
• After Effects expressions - pendulum motion not wo...

# After Effects expressions - pendulum motion not working properly

Community Beginner ,
Apr 14, 2023 Apr 14, 2023

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 😕

TOPICS
Expressions

Views

662

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
4 Replies 4
Community Expert ,
Apr 14, 2023 Apr 14, 2023

Copied

Try changing the third line to:

``{ value + Math.sin((time-timeToStart)*10)*50/Math.exp(time-timeToStart)``

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Beginner ,
Apr 15, 2023 Apr 15, 2023

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?

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Expert ,
Apr 15, 2023 Apr 15, 2023

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``````

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Beginner ,
Apr 16, 2023 Apr 16, 2023

Copied

LATEST

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!