Tutorial – Using expressions to control a second composition in After Effects

24 10 2009

The purpose behind being able to link properties from 1 composition to another is to open a whole new world of possibilities where; for example, you could have one slider that moved cameras in multiple child compositions for true 3D matching in nested compositions – or for applying batch effect tweaks to many layers at once – the possibilities are endless. This tutorial isn’t to achieve anything particularly cool or create an exciting composition – it’s to understand how, by using expressions, we can link properties in After Effects. Let’s get started!

First things first – create 2 compositions called “Parent” and “Child”. The child composition will be where things happen – this will be nested in the parent composition which will have a control to effect a layers opacity in the child composition.

New Comp New Comp 2

I have used basic PAL resolution / frame rate and a 1 minute duration – this doesn’t make any difference to what we are doing so feel free to use settings that work for your project.

Right – next we’re going to import an image to use as the background layer in the child composition – i’m using a pumpkin patch – again this could be anything.

Import background
Your child composition should now look a bit like this.

Child Comp
The next step is to add a solid layer – this will be the layer that we will be creating an expression for. It will lie on top of the background so we can fade in and out of black.Black

Right – now go to your parent composition, drop the child comp in and create a new solid layer on top – call this “Tweak”

05c

Turn off visibility for this layer and with the solid layer selected goto effects > Expression Controls > Slider Control. Press enter to rename the effect “Opacity” and press enter on the layer to call it “Tweak” (This is important as the expression needs these to be the same).

05d

Your parent comp should now look a bit like this. We have everything in place now to get our expression working – our compositions are named, as are our layers and effect. Go back to the child composition…

06Alt/Option click on the stopwatch next to the Opacity parameter on the black solid layer in the child composition – this will enable expressions for this parameter. By default this will be “transform.opacity” – we’re going to change that.

Change the expression to: comp(“Parent”).layer(“Tweak”).effect(“Opacity”)(“Slider”)

Once you have taken a few moments to look at this expression, let’s break it down: comp(“parent”) is telling AE which comp we want to find our control, as our parent comp is called “Parent” that is what goes between the brackets and speech marks. Next we have .layer(Tweak”) this is choosing the layer within the parent composition that we are taking out control from. Incase you’ve not already worked it out, the next part .effect(“Opacity”)(“Slider”) is telling AE to take the value of our slider to control the opacity of the black solid in the child comp.

07

Now back to the parent comp – you will notice that when you move the slider, the image fades in and out of black – congratulations – you’ve completed your very first multi-composition nested expression. Make yourself a cup of tea to celebrate!


Actions

Information

Leave a comment