Skip to main content
Inspiring
November 29, 2010
Question

Auto Fade In/Out audio based on layer in/out points?

  • November 29, 2010
  • 3 replies
  • 4026 views

Is it possible to automatically fade a layer's audio in and out based on its in and out points?

This topic has been closed for replies.

3 replies

Community Expert
August 10, 2023

Andrew's preset should get you started. I have created about 200 animation presets that use time-inPoint and time-outPoint instead of keyframes. They do everything from flying a layer in, bouncing to a stop, then dropping the layer out, all based on the in and out-point of a layer. Once you grasp the concept and add a couple of expression control sliders to the mix, building what you need is pretty easy.

 

Here are the basics:

 

// set frame count to zero for the layer-in and layer-out points
tIn = time - inPoint;//
tOut = time - outPoint;//
// set the duration of the in and out transition - could be slider controls;
framesIn = 24*thisComp.frameDuration;
framesOut = 30*thisComp.frameDuration;
//set up conditions
if (time < inPoint + framesIn)
	//Create your starting animation
else
	//Create your ending animation

 

If you wanted the starting animation to move the layer from the left edge of the composition to the current position of the layer and then fall off the bottom of the comp at the end, you would replace the if/else statements with these lines:

 

//set up conditions
if (time < inPoint + framesIn)
	easeIn(tIn, 0, framesIn, [- width/2, value[1]], value)
else
	easeOut(tOut, - framesOut, 0, value, [value[0], thisComp.height + height/2])

 

 You can set up the if/else statements to change color, rotate the layer, or even animate the words in a text layer. You can also compensate for scale or use soureceRectAtTime to move text or shape layers around the comp panel efficiently. All you have to do is figure out what the hero pose for the layer looks like, add the appropriate expression, and trim the in and out points of the layer to create the animation. Building a library of your own animation presets can change the production time of an explainer video from days to hours or even speed up visual effects compositing. I have a half dozen of them that I use to animate everything from the glow on surrounding buildings from an explosion to the flashing lights on a police car.  

 

 

 

Participant
August 10, 2023

Andrew Yoole
Inspiring
November 29, 2010

I've attached an Animation Preset that does it.  It's just a simple adaptation of the built-in FadeIn+Out-Frames behaviour, but applied to the Stereo Mixer audio effect instead.

Set the number of frames required for fade in and fade out in the first slider effect, and the layer will then automatically fade from 0 to 100% and back again for the defined durations. To further adjust the overall volume, use Level or a second iteration of Stereo mixer. 

Inspiring
December 1, 2010

Thanks!

Takumi Kashima has a build of kd_AutoFade that has audio fade, but it's CS5 only.  Does your expression work in CS4, Andrew?