FORUMS TUTORIALS FEATURES VIDEOS PODCASTS EVENTS SERVICES JOBS NEWSLETTER NEWS BLOGS
 ADOBE AFTER EFFECTS: Home Forum Basics Expressions Tutorials Podcasts AE Techniques Creative Cloud Debate FAQ

# If Else Easy Ease

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
 If Else Easy Ease by Barry Suydam on Jan 20, 2012 at 3:50:06 pm

Was wondering if it was possable to add an ease in to this expression below?

```if (transform.xRotation > 90) { 0 } else { value };```

 Re: If Else Easy Easeby Dan Ebberts on Jan 20, 2012 at 5:44:06 pm

What are you easing from and to, and over what range? You could do something like this, but I doubt it's what you're after:

r = transform.xRotation;
ease(r,80,90,value,0)

Dan

 Re: If Else Easy Easeby Barry Suydam on Jan 20, 2012 at 6:21:10 pm

thank you for responding i really appreciate your help.

I have layers revealing like a flap using one of your inertial bounce expressions. I keep them at 0 opacity until they reach 90 degrees at which time the become 100 opacity and the bounce(flap) and rest at 0 degrees based on a decay parameter. They go from off to on I was hoping they could ease from 0 opacity to 100 opacity over 5 frames or so...so they didn't just pop on screen and continue to be 100 for the remaining duration of the layer in the timeline

 Re: If Else Easy Easeby Dan Ebberts on Jan 20, 2012 at 7:12:56 pm

Is there a rotation keyframe at 90 degrees? You need something to trigger the ease expression, otherwise you have to create a loop that goes back in time to find the transition to 90 degrees?

Dan

 Re: If Else Easy Easeby Barry Suydam on Jan 20, 2012 at 7:58:09 pm

x rotation is keyframed starting at 180 over 30 frames it goes to 0 with the following expression tied to it:

amp = .3;
freq = 1.0;
decay = 2.0;
n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
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);
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{value}

Opacity has the following expression tied to it:

if (transform.xRotation > 90) {
0
} else {
value };

I sincerely thank you for taking the time to work with me on this.

 Re: If Else Easy Easeby Dan Ebberts on Jan 20, 2012 at 8:18:22 pm

Assuming the x rotation reaches 90 degrees half way between the first two keyframes, this should work:

rX = transform.xRotation;
t = (rX.key(1).time + rX.key(2).time)/2;
if (time >= t)
else
0

Dan

 Re: If Else Easy Easeby Barry Suydam on Jan 20, 2012 at 8:38:37 pm

Perfection! Thank you...so much! Works perfect just changed the keyframes to 3. AWESOME!

 Re: If Else Easy Easeby Scott Green on May 9, 2012 at 3:40:48 pm

Hi, I'm just reading up about expressions and learning the basics and came across this post while searching for a way to ease a rotation effect I've got attached to a null that controls a camera.

This expression affects the rotation which stops at 180 degress:

t=time*5 +10;
if(t<180){[t];
}else{[180];
}

How can I ease this effect so that the camera doesn't stop so sudden?

Thanks.

Creative Multimedia Design Manchester | S©tt Green | Splurj

 Re: If Else Easy Easeby Dan Ebberts on May 9, 2012 at 4:31:54 pm

One way:

easeOut(time,0,34,10,180)

Dan

 Re: If Else Easy Easeby Scott Green on May 9, 2012 at 6:11:35 pm

Thanks Dan,

can you tell me what each of the numbers represent please, I haven't got that far yet :)

(time,0,34,10,180)

Creative Multimedia Design Manchester | S©tt Green | Splurj

 Re: If Else Easy Easeby Dan Ebberts on May 9, 2012 at 6:18:52 pm

The expression just says "as time varies from zero to 34 seconds, vary the output from 10 to 180 degrees". I chose 34 seconds because that's the time it takes your original expression to get to 180.

Dan

 Re: If Else Easy Easeby Adrien Girault on Jul 26, 2015 at 7:21:27 am

Hi, I was wandering if someone could help with the 'ease' in this expression:

I have footage which I've linked to the 'sound key' values so as to automatically speed up and revert back at a certain value.
but I'd like to add an ease expression to smooth the transition between both states.
The max value is 20.
I've tried a few different thing but no luck.

Any input would be greatly appreciated.

```>x = time*2; y = value; if ( thisComp.layer("Adjustment Layer 2").effect("Sound Keys")("Output 1") > 10) {value = x} else {value =y}; ease(t, value1, value2)```