How To Create Trails In After Effects Using Expressions

After Effects Expressions gives you the power of creating animations that are impossible or hard to create manually. One such expression helps in creating trails of a moving object.

There are couple of basic approaches to creating trails in After Effects. In this example, we’ll use “valueAtTime” method to retrieve the position value of the leader layer at a previous time.

Lets take a look at the expression:

trail-gif

delay = 5; //number of frames to delay

d = delay*thisComp.frameDuration*(index - 1);
thisComp.layer(1).position.valueAtTime(time - d)

In the above code or expression, the first line just sets the number of frames that we want each layer to be delayed from the previous layer. The second line calculates the time delay of each layer based on its position in the layer stack. In this example, the delay for Layer 1 will be zero as it the “leader”, the delay for Layer 2 will be 5 frames, for Layer 3 it will be 10 frames and so on. The last line retrieves the position value of the lead layer at the current time minus the layer’s delay.

Adding a Fade

We can add interest to the animation by adding another expression to the opacity that will exponentially fade the layer’s opacity depending on how far down it is in the layer stack.

Here’s the opacity expression:

trail-fade-gif

opacityFactor = .75;

Math.pow(opacityFactor,index - 1)*100

LEAVE A REPLY

Please enter your comment!
Please enter your name here

21,161FansLike
2,813SubscribersSubscribe
 500+ LIGHTROOM PRESETS 
 WORTH $467 FOR JUST $29  

Discount
Upto 94%

LIMITED TIME OFFER
GET THE BUNDLE FOR JUST $29
close-link
Download 546 Lightroom Presets Worth $467 For Just $29.