Expressions/Scripts/Presets

Moderator: byronnash

 
mparayno
Topic Author
Posts: 1
Joined: Fri Jun 25, 2004 3:51 pm

Following a layer's position regardless of time

Fri Sep 02, 2011 12:13 pm

Hey Everyone,
I was wondering if you can help me out with this.

I want to build a comp with a null that has the position values that I want to use in with different layers that happen on different times on the timeline. Is there any way to use the position values of the null and mimic its motion even though the layers mimicking the the motion happens on different times on the timeline?

Thanks in advance everyone!
 
tschomp
Posts: 3
Joined: Mon Feb 10, 2014 1:14 pm

Re: Following a layer's position regardless of time

Mon Feb 10, 2014 1:45 pm

You could use something like this as an expression. The way that this is written, you'd need whatever layer has the animation to be called "Control Layer", and to have 2 slider effects -- 1 called offset (used to determine the time delay) and 1 called "start time" (most likely should stay set to 0). Then, each layer will be incrementally offset based on its relation to the Control Layer in the layer order. Obviously adjust however might suit you better. Hope this helps!

var controlLayer = thisComp.layer("Control Layer")
var offset = controlLayer.effect("offset")("Slider") * (index - controlLayer.index)
t = time + offset
startTime = controlLayer.effect("start time")("Slider")

if (t>0) {
   delta = controlLayer.transform.position.valueAtTime(t) - controlLayer.transform.position.valueAtTime(startTime);
   value + delta;
}else {
   value
}




I also just noticed that you posted this 3 years ago -- whoops! Sorry this took so long :) hahaha.

Who is online

Users browsing this forum: No registered users and 2 guests