Copy link to clipboard
Copied
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?
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
Copy link to clipboard
Copied
Going to have a moderator move your post to the Expressions forum.
Copy link to clipboard
Copied
Realised I had copied the loopOut expression into the bounce code in line 4. Can anyone help to get these working together?
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Hi Mylenium,
Brilliant I hadn't thought of doing that. Thanks.