Following a layer's position regardless of time

What type of scripts do you need?

Moderator: byronnash

Post Reply
mparayno
Posts: 1
Joined: June 25th, 2004, 3:51 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: February 10th, 2014, 1:14 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!

Code: Select all

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.
Post Reply