Fade in/Fade Out - Scale

Moderators: Disciple, zlovatt

Post Reply
malex
Posts: 20
Joined: May 21st, 2004, 3:03 pm

Problem : Is anyone able to give me an expression that I can add to the Transform effect's "scale" and "opacity" parameters (so that it can be saved as a favorite effect). The expression needs to fade in the layer (Transform effect's opacity parameter) from 0 to 100 percent in one second, starting at the beginning of the layer, then fade to 0 percent in one second at the end of the layer; Also the layer's scale (Transform
effect's scale parameter) would change from 20 percent to 100 over the
life of the layer.

So what I want to end up with is an effect that I can paste onto a
layer that fades it up at the start and fades it out at the end and
scales it the whole time, but it reacts to the layers length (short
layers move faster, if I trim the layer all the parameters move to the
new in or out point)

I have a lot of layers and a lot of comps that are all going to do this
same move and I don't want to get in to changing key frames for each
layer.


Solution 1 (posted by Dan Ebberts)

Try this for opacity:

rampTime = 1;

if (time < in_point + rampTime){
linear(time,in_point,in_point + rampTime,0,100)
}else if (time < out_point - rampTime){
100
}else{
linear(time,out_point - rampTime,out_point,100,0)
}


And this for scale:


startScale = [20,20];
endScale = [100,100];

linear(time,in_point,out_point,startScale,endScale)


Solution 2 (posted by Stu Maschwitz)

Adobe After Effects 6.5 Keyframe Data

Opacity
Expression Data
fadeFrames = 24;
fadeTime = fadeFrames*thisComp.frameDuration;
Math.min(
linear(time, inPoint, inPoint + fadeTime, 0, 100),
linear(time, outPoint - fadeTime, outPoint, 100, 0)
)

End of Expression Data

End of Keyframe Data
sameervalva
Posts: 4
Joined: May 21st, 2010, 2:39 am

Hi Malex

I tried the scale property over the rotation after changing the names and values and it worked

Add to rotation :

startRotation = 0;
endRotation = 360;

linear(time,in_point,out_point,startRotation,endRotation)

__________________


and The same you can do for another property


Thanks for your posts
pecijackson
Posts: 8
Joined: January 31st, 2012, 12:23 am

i don't really understand how it works with my adobe AE CS 4 but. though i dont really understand bout scripting. but i know how to make the same effect :) thanks
digspat
Posts: 1
Joined: September 21st, 2009, 1:36 pm

Can someone help make an expression that slides a layer in horizontally over 15 frames at the start of the layer and then out over 15 frames at the end, with the expression adjusting automatically to the layer length? This could be for a full HD comp so the movement would need to be 1080 pixels horizontally. Let me know which parameters to change to make it vertical or in Z space as well.
x2c
Posts: 1
Joined: January 6th, 2015, 9:48 am

Now what if I wanted to make the front fade a different frame duration from the back? This confounded me until I understood what the formula was saying. Basically, the formula is saying, take however many frames you want (fadeFrames), and multiply it by the frame duration of the comp (thisComp.frameDuration) which I gather is 1/23.976th of a second. This understanding will hopefully help me write a modified script with two different values for the front and the back... Here goes...

Code: Select all

//This is my modified version for separate front and back durations

//copy from here...
fadeFramesFRONT = 20;
fadeFramesBACK = 30;
//
fadeTimeFRONT = fadeFramesFRONT*thisComp.frameDuration;
fadeTimeBACK = fadeFramesBACK*thisComp.frameDuration;
// instead of linear, I'm using ease, but you could also use easeIn or easeOut
Math.min( 
ease(time, inPoint, inPoint + fadeTimeFRONT, 0, 100), 
ease(time, outPoint - fadeTimeBACK, outPoint, 100, 0)
);
//...to here

Post Reply