ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Leaf falling expression to a stop

FAQ   •   VIEW ALL Leaf falling expression to a stop on May 22, 2019 at 7:56:34 am

I came across this expression for emulating the falling of leaves. However, it just keeps "falling" forever. I was wondering if there is anyway of making it stop after some point, i.e., when 'y' is bigger than a specific value, say 1080 (the border of the screen.

position

sp=2;
amp=150;
gravity = 50;
x = Math.sin(time*sp)*amp;
y= time*time*gravity;
value + [x,y];

rotation:

sp=2;
amp=5;
x = Math.sin(time*sp)*amp;
value - x;

 Return to posts index Re: Leaf falling expression to a stopon May 22, 2019 at 9:40:33 am

Just an update, I did find a solution for the "height" value. I renamed the variables in the Comp a little bit (its name is "Shape Layer 4"). I came up with this:

```x = thisComp.layer("Shape Layer 4").transform.position.valueAtTime(time); y = thisComp.layer("Shape Layer 4").position.valueAtTime(time); sp=2; amp=150; gravity = 50; a = Math.sin(time*sp)*amp; b = time*time*gravity; if (b >= 900) value + [a,900] else value + [a,b];```

However, I still don't know how to make the "Length" value pause, because I'd need a way to make it stop going from side to side, but at the value it was when it reached that point.

I'd also probably need to do something similar to the rotation.

Anyone has any ideas?

 Return to posts index