Activity › Forums › Adobe After Effects Expressions › move to layer position
-
move to layer position
Posted by Madli Man on March 27, 2013 at 1:38 pmHi all,
I dont know if this question been posted. but i did search for an expression that can move 3d layer to another 3d layer position (without keyframe) by index.
let say: layer1 move to layer2. and next layer1 move to layer3. and next to layer4…
what i tried to do is similar with sure target from videocopilot.it that possible?
Thanks!
Ben Robinson replied 12 years, 2 months ago 3 Members · 5 Replies -
5 Replies
-
Dan Ebberts
March 27, 2013 at 2:25 pmYes, you could do that, but what controls the timing (how does the expression know when it’s time to move to the next layer)?
Dan
-
Madli Man
March 27, 2013 at 5:42 pmOh hi again Mr Dan. im glad hear that you said that posible to do. timing can be control via slider or variable. let say, 5 sec and move on. if you could write some, i most appreciate it.
Thanks Dan for replying.
Mad
-
Dan Ebberts
March 28, 2013 at 4:10 amPlay around with this. It should move layer 1 around the comp in 5-second increments. First to layer 2, then to layer 3, etc.
holdDur = 4;
moveDur = 1;
startIdx = 2; // start with layer 2segDur = holdDur + moveDur;
curSeg = Math.floor((time-inPoint)/segDur);
t = (time-inPoint) % segDur;
if (curSeg == 0){
L1 = null;
L2 = thisComp.layer(Math.min(thisComp.numLayers,curSeg+startIdx));
}else{
L1 = thisComp.layer(Math.min(thisComp.numLayers,curSeg+startIdx-1));
L2 = thisComp.layer(Math.min(thisComp.numLayers,L1.index+1));
}
if (t > moveDur){
L2.transform.position;
}else{
t1 = curSeg*segDur;
t2 = t1 + moveDur;
if (L1 == null)
p1 = value
else
p1 = L1.transform.position.valueAtTime(t1);
p2 = L2.transform.position,valueAtTime(t2);
ease(time,t1,t2,p1,p2)
}
Dan
-
Madli Man
March 28, 2013 at 2:51 pmOmg. Im speechless. this code work just like what im imagine. thank you Mr Dan. i will work around with this code.
again, THANK YOU MR DAN!!!!
-
Ben Robinson
February 28, 2014 at 1:17 amHi Dan,
I realise this thread is nearly a year old now–but I think it relates to what I’m looking for. I’m looking to do the same thing as the OP: move one layer’s position to another layer’s (possibly in another comp) position, according to its index; but I’d like to able to control / trigger it with keyframes (a slider on a null, perhaps) rather than have it automated. Additionally, I’d like to be able to apply this to several layers, but–let’s say they’re all controlled by a slider on a null layer (i.e., one controller for several layers)–offset the timing they each start animating.
Hope that makes sense.
Thank you in advance.
Ben
Reply to this Discussion! Login or Sign Up