Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

- Home
- >
- After Effects
- >
- Overshoot/Bounce Back Expressions Mess up Orient A...

Highlighted
##

Overshoot/Bounce Back Expressions Mess up Orient Along Path

New Here
,

Oct 14, 2020

Copy link to clipboard

Copied

Hi,

I have a series of layers animating along a path. I have each one oriented along the path. I'm trying to add bounce back/overshoot expressions, but this creates crazy unwanted effects with the orientation, causing the layers to switch direction randomly, or suddenly at the end.

I don't have a very deep understanding of expressions, but I definitely don't plan on creating this bounce back manually.

Any advice is appreciated. The screenshot shows my animation without expressions. Here are the expressions I'm trying to use:

Keyframe Overshoot Expression: freq = 3; decay = 5; n = 0; if (numKeys > 0){ n = nearestKey(time).index; if (key(n).time > time) n--; } if (n > 0){ t = time - key(n).time; amp = velocityAtTime(key(n).time - .001); w = freq*Math.PI*2; value + amp*(Math.sin(t*w)/Math.exp(decay*t)/w); }else value

Keyframe Bounce Back Expression: e = .7; g = 5000; nMax = 9; n = 0; if (numKeys > 0){ n = nearestKey(time).index; if (key(n).time > time) n--; } if (n > 0){ t = time - key(n).time; v = -velocityAtTime(key(n).time - .001)*e; vl = length(v); if (value instanceof Array){ vu = (vl > 0) ? normalize(v) : [0,0,0]; }else{ vu = (v < 0) ? -1 : 1; } tCur = 0; segDur = 2*vl/g; tNext = segDur; nb = 1; // number of bounces while (tNext < t && nb <= nMax){ vl *= e; segDur *= e; tCur = tNext; tNext += segDur; nb++ } if(nb <= nMax){ delta = t - tCur; value + vu*delta*(vl - g*delta/2); }else{ value } }else value

TOPICS

Expressions,
Scripting

Community Guidelines

Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Overshoot/Bounce Back Expressions Mess up Orient Along Path

New Here
,

Oct 14, 2020

Copy link to clipboard

Copied

Hi,

I have a series of layers animating along a path. I have each one oriented along the path. I'm trying to add bounce back/overshoot expressions, but this creates crazy unwanted effects with the orientation, causing the layers to switch direction randomly, or suddenly at the end.

I don't have a very deep understanding of expressions, but I definitely don't plan on creating this bounce back manually.

Any advice is appreciated. The screenshot shows my animation without expressions. Here are the expressions I'm trying to use:

Keyframe Overshoot Expression: freq = 3; decay = 5; n = 0; if (numKeys > 0){ n = nearestKey(time).index; if (key(n).time > time) n--; } if (n > 0){ t = time - key(n).time; amp = velocityAtTime(key(n).time - .001); w = freq*Math.PI*2; value + amp*(Math.sin(t*w)/Math.exp(decay*t)/w); }else value

Keyframe Bounce Back Expression: e = .7; g = 5000; nMax = 9; n = 0; if (numKeys > 0){ n = nearestKey(time).index; if (key(n).time > time) n--; } if (n > 0){ t = time - key(n).time; v = -velocityAtTime(key(n).time - .001)*e; vl = length(v); if (value instanceof Array){ vu = (vl > 0) ? normalize(v) : [0,0,0]; }else{ vu = (v < 0) ? -1 : 1; } tCur = 0; segDur = 2*vl/g; tNext = segDur; nb = 1; // number of bounces while (tNext < t && nb <= nMax){ vl *= e; segDur *= e; tCur = tNext; tNext += segDur; nb++ } if(nb <= nMax){ delta = t - tCur; value + vu*delta*(vl - g*delta/2); }else{ value } }else value

TOPICS

Expressions,
Scripting

Community Guidelines

Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

laurw

Oct 14, 2020
0
/t5/after-effects/overshoot-bounce-back-expressions-mess-up-orient-along-path/td-p/11508385
2
Replies
2

Adobe Community Professional
,

Oct 14, 2020

Copy link to clipboard

Copied

Orient along a path does exactly that. The layer orientation is controlled by the motion along the path so if the direction of the motion changes because of the expressions so does the orientation. There is no bug.

What you have to do is set up a parallel path using a null that is not oriented to the path, adjust the timing of the duplicate path, and then use Vector Math to make the layer with bounce and overshoot look at the reference path. I don't have the time to set up a sample comp with some expressions right now, but that is the general workflow.

Community Guidelines

Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Reply

Loading...

Rick Gerard

Oct 14, 2020
0
/t5/after-effects/overshoot-bounce-back-expressions-mess-up-orient-along-path/m-p/11508466#M152329
Dan Ebberts
LATEST

Guide
,

Oct 14, 2020

Copy link to clipboard

Copied

You could try turning off auto orient and using this rotation expression:

```
p = position;
n = 0;
if (p.numKeys > 0){
n = p.nearestKey(time).index;
if (p.key(n).time > time) n--;
}
if (n > 0){
t = p.key(n).time;
}else{
t = p.key(1).time;
}
v = p.velocityAtTime(t);
radiansToDegrees(Math.atan2(v[1],v[0]))
```

Community Guidelines

Reply

Loading...

Dan Ebberts

Oct 14, 2020
0
/t5/after-effects/overshoot-bounce-back-expressions-mess-up-orient-along-path/m-p/11508782#M152342
Using the Community
Experience League
Terms of Use
Privacy Policy
Cookie preferences
AdChoices
Language:

- Deutsch
- English
- Español
- Français
- 日本語コミュニティ
- Português

Copyright © 2020 Adobe. All rights reserved.