Activity › Forums › Adobe After Effects Expressions › If Else Easy Ease
-
If Else Easy Ease
Posted by Barry Suydam on January 20, 2012 at 3:50 pmWas wondering if it was possable to add an ease in to this expression below?
if (transform.xRotation > 90) {
0
} else {
value };Adrien Girault replied 10 years, 9 months ago 4 Members · 11 Replies -
11 Replies
-
Dan Ebberts
January 20, 2012 at 5:44 pmWhat 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
-
Barry Suydam
January 20, 2012 at 6:21 pmthank 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
-
Dan Ebberts
January 20, 2012 at 7:12 pmIs 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
-
Barry Suydam
January 20, 2012 at 7:58 pmx 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.
-
Dan Ebberts
January 20, 2012 at 8:18 pmAssuming the x rotation reaches 90 degrees half way between the first two keyframes, this should work:
fadeFrames = 5;
rX = transform.xRotation;
t = (rX.key(1).time + rX.key(2).time)/2;
if (time >= t)
ease(time,t,t+framesToTime(fadeFrames),0,100)
else
0Dan
-
Barry Suydam
January 20, 2012 at 8:38 pmPerfection! Thank you…so much! Works perfect just changed the keyframes to 3. AWESOME!
-
Scott Green
May 9, 2012 at 3:40 pmHi, 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
-
Scott Green
May 9, 2012 at 6:11 pm -
Dan Ebberts
May 9, 2012 at 6:18 pmThe 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
Reply to this Discussion! Login or Sign Up