-
Movement started by multiple Marker
Hi !
I’m trying to set up an animation tool aimed to be used quite regularly.
I’ve done a lot by myself by trial and error, but being quite a novice about coding, I’m turning to you.What the expression is suppose to do is moving, a comp along the Y axis, by 500px, when it hit a marker “Move” and move it depending of the marker.duration.
The movement value will depend on the composition height ( which changes depending of the project i’m on. So it has to be manually specified.)Then, when it hit’s another “Move” marker, the movement continue from the position it reached and add again the + 500px
marker1 => 0 to 500,
marker2 => 500 to 1000
marker 3 => 1000 to 1500 and so on…I was thinking using the marker index to multiply the end position.
what I got from reading on the board is the expression move once, then go back to 0 and redo the movement.// move = 500*marker.nearestKey(time).index => what I though might works, but, it’s start from 0 and go to 1500 if it’s 3rd marker.
Thank you for any help and advice of related post I might have missed 🙂
***
// Set the position of the object
mainPos = comp("_CONTROL_PANNEL_CTRL").layer("Obj_Position_CTRL").effect("Obj_Position_Start")("Slider");// Set the Object Vertical Offset
offsetPos = comp("_CONTROL_PANNEL_CTRL").layer("Obj_Vertical_Offset_CTRL").effect("Obj1-Vertical-Position_CTLR")("Slider");// Object start position by combining mainPos and offestPos
yPOS = mainPos + offsetPos;m = 0;
t = time;
Move = 500;if (marker.numKeys > 0) {
m = marker.nearestKey(time).index;
tag = marker.key(m).comment;
if (tag == "Move") { t = time - marker.key(m).time }
linear(t, 0, marker.nearestKey(m).duration, yPOS, Move)
}