Activity › Forums › Adobe After Effects Expressions › Expression for in out opacity change
-
Expression for in out opacity change
Posted by Aharon Rabinowitz on December 10, 2006 at 11:38 pmI looked around but couldn’t find a post about this – has anyone written an expression that makes layers fade up and down based on thier in/out points? This would be a great tool for quick edits with little or no work.
I usually do 15 frame fade ups and downs, and if the trimming changes I have to remember to account for that. I’ve got to get better at expressions…
Thanks.
—————————————-
Aharon Rabinowitz
aharon(AT)yahoo(DOT)com
http://www.allbetsareoff.com
—————————————-
Creative Cow Master Series DVD
particleIllusion Fusion Volume 1
available @ http://www.pIllusionFusion.comAharon Rabinowitz replied 19 years, 5 months ago 5 Members · 10 Replies -
10 Replies
-
Andrew Kramer
December 11, 2006 at 12:33 amHarry Frank made this nice script that works well:
transition = 40
tSecs = transition / ( 1 / thisComp.frameDuration);
iStart = thisLayer.inPoint
oStart = iStart + tSecs;
oEnd = thisLayer.outPoint
iEnd= oEnd- tSecs;
halfPoint = (iEnd – iStart) / 2;
if (time < halfPoint){ linear(time, iStart, oStart, 0, 100) }else{ linear(time, iEnd, oEnd, 100, 0) } Just paste it into the opacity expression and change the transition amount as needed. Thanks Harry! Best, Andrew Kramer -
Mike Clasby
December 11, 2006 at 12:42 amHere’s a post, with a Dan expression (second post), that does what you want I think.
https://forums.creativecow.net/cgi-bin/new_read_post.cgi?forumid=2&postid=877561
Just change the expression to:
fadeInTime = .5; // fade in time (seconds)
fadeOutTime = .5;Math.min(linear(time,inPoint,inPoint + fadeInTime,0,100),linear(time,outPoint – fadeOutTime,outPoint,100,0))
-
Aharon Rabinowitz
December 11, 2006 at 4:58 amThank! Both of these work great. What if you wanted to only fade in or only fade out. I tried futzing around with this stuff, but couldn’t figure what parts had to go.
Man, I love this forum.
—————————————-
Aharon Rabinowitz
aharon(AT)yahoo(DOT)com
http://www.allbetsareoff.com
—————————————-
Creative Cow Master Series DVD
particleIllusion Fusion Volume 1
available @ http://www.pIllusionFusion.com -
Andrew Kramer
December 11, 2006 at 5:21 amWith Dan’s script I would just set the fadeout time to 0 or whichever. Nice script btw.
-
Andrew Kramer
December 11, 2006 at 5:26 amOh and then if you want to only fade out, change the first 0 in the 3rd line of code to 100 so that no matter what the fadeInTime is, it will remap the value to 100-100 so no change, just opaque.
Math.min(linear(time,inPoint,inPoint + fadeInTime,100,100),linear(time,outPoint – fadeOutTime,outPoint,100,0))
-
Colin Braley
December 11, 2006 at 5:28 amFade in only…
fadeTime = 10;//frames
linear( time, inPoint, inPoint + framesToTime( fadeTime ), 0 , 100);Fade out only…
fadeTime = 10;//frames
linear( time, outPoint – framesToTime( fadeTime ), outPoint, 100 , 0);or if you want to be able to do fade in, fade out, or both within one expression just change the values of fadeIn and fadeOut in the following expression…
//–
fadeTime = 10; //frames
fadeIn = true;
fadeOut = false;
//–
if ( ! fadeIn && ! fadeOut )
{
100
}else if ( fadeIn && ! fadeOut) {
linear( time, inPoint, inPoint + framesToTime( fadeTime ), 0 , 100);
}else if ( fadeOut && ! fadeIn ) {
linear( time, outPoint – framesToTime( fadeTime ), outPoint, 100 , 0);
}
else{
if( time > this.inPoint + framesToTime( fadeTime ) )
linear( time, outPoint – framesToTime( fadeTime ), outPoint, 100 , 0);
else
linear( time, inPoint, inPoint + framesToTime( fadeTime ), 0 , 100);}
Enjoy
~Colin
-
Mike Clasby
December 11, 2006 at 5:28 amYeah, with Dan’s, 0 for FadeOutTime seems to work, but 0 for FadeInTime leaves the layer at 0% opacity the whole clip, but 0.01 gives 0% at the inpoint, then to 100% at the second frame into the clip, so it’s off by one frame. Maybe Dan has a fix.
-
Tony Kloiber
December 11, 2006 at 3:53 pmDan gave me that expression a couple years ago when I need to animate several hundred still files. Man did it save me some time on that project.
Thank you again Dan.
TonyTony
-
Aharon Rabinowitz
December 11, 2006 at 10:08 pmThat’s what I love about After Effects – also known as the program that asks: how many ways can you skin a cat?*
Thanks folks!
Aharon
*Please note that the writer of this post does not support the skinning of actual cats.
—————————————-
Aharon Rabinowitz
aharon(AT)yahoo(DOT)com
http://www.allbetsareoff.com
—————————————-
Creative Cow Master Series DVD
particleIllusion Fusion Volume 1
available @ http://www.pIllusionFusion.com
Reply to this Discussion! Login or Sign Up