ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

x amount of position move on layer marker

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Naoko Hara
x amount of position move on layer marker
on Apr 25, 2018 at 4:23:49 pm

I have a null layer with an X position move and another master null with a some boxes attached.
Trying to have this master null move X positions (1734px to be exact) every time theres a layer marker on the master null.

I tried using below expression but even if I add more "if"s, I only got it to move twice.

Help?

position;
if (marker.numKeys > 0 && time >= marker.key(1).time){
thisComp.layer("Ctrl_Pos").transform.position.valueAtTime(time-(marker.key(1).time))+position;
}


Return to posts index

Dan Ebberts
Re: x amount of position move on layer marker
on Apr 25, 2018 at 5:04:00 pm

Try this:


m = marker;
n = 0;
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (time < m.key(n).time) n--;
}
value + [n*1734,0]



Dan



Return to posts index

Naoko Hara
Re: x amount of position move on layer marker
on Apr 25, 2018 at 8:32:56 pm

What if don't want it to jump but have it slide over?


Return to posts index


Dan Ebberts
Re: x amount of position move on layer marker
on Apr 25, 2018 at 10:08:26 pm

More like this, I guess:


m = marker;
moveTime = .5;
moveAmt = 1734;
n = 0;
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (time < m.key(n).time) n--;
}
if (n > 0){
t = time - m.key(n).time;
x = (n-1)*moveAmt + linear(t,0,moveTime,0,moveAmt);
value + [x,0]
}else
value



Dan



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]