Skip to main content
Participant
April 20, 2017
Answered

After Effects Combine x2 Expressions - Bounce & loopOut

  • April 20, 2017
  • 2 replies
  • 4497 views

I'm after help combining x2 expressions. A bounce expression like below...

n = 0;

if (numKeys > 0){

n = nearestKey(time).index;

loopOut("cycle");

if (key(n).time > time){

n--;

}

}

if (n == 0){

t = 0;

}else{

t = time - key(n).time;

}

if (n > 0){

v = velocityAtTime(key(n).time - thisComp.frameDuration/10);

amp = .05;

freq = 4.0;

decay = 2.0;

value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);

}else{

value;

}

...with the standard loopOut("cycle") expression. I have a few key frames to lift an object slowly then to drop it quickly (hopefully with a bounce) and I need to repeat this indefinitely. Can any one help?

This topic has been closed for replies.
Correct answer Mylenium

loopOut()requires keyframes, not expressions. You cannot simply combine these two expressions. You have to apply the bounce first, convert to keyframes and then apply the loop expression, which ideally you might do on duplicate layers to not mess up your original keyframing.

Mylenium

2 replies

Participant
April 24, 2017

Realised I had copied the loopOut expression into the bounce code in line 4. Can anyone help to get these working together?

Mylenium
MyleniumCorrect answer
Legend
April 25, 2017

loopOut()requires keyframes, not expressions. You cannot simply combine these two expressions. You have to apply the bounce first, convert to keyframes and then apply the loop expression, which ideally you might do on duplicate layers to not mess up your original keyframing.

Mylenium

Participant
April 25, 2017

Hi Mylenium,

Brilliant I hadn't thought of doing that. Thanks.

Szalam
Community Expert
Community Expert
April 20, 2017

Going to have a moderator move your post to the Expressions forum.