-
Animate position according to layer marker name
Hey,
I would need a bit of help with an expression.
What I’m trying to do:When a layer marker’s name is “UP”, the layer’s y position should animate up by comp height
and when a layer marker’s name is “DOWN”, the layer’s y position should animate down by comp height.
If there is no layer marker, the layer should stay on it’s current value.
I’m assuming there will be only 1 layer marker.After a lot of searching in forums I think it could be possible to accomplish?
I have tried with modifying an expression written by Dan Ebberts in the forum here, but I can’t make it work as it should.
Testing with marker named UP or DOWN it only moves the layer down, not up.Could anybody check where the mistake could be? Thanks in advance!
EvaI came up with this:
moveFrames = 20;
try{
m = thisLayer.marker.key("UP");
}catch(err){
m = null;
}
if (m != null && time > m.time){
t = time - m.time;
dur = framesToTime(moveFrames);
y = ease(t,0,dur,value[1],value[1]-height);
[value[0],y]
}
elsetry{
m = thisLayer.marker.key("DOWN");
}catch(err){
m = null;
}
if (m != null && time > m.time){
t = time - m.time;
dur = framesToTime(moveFrames);
y = ease(t,0,dur,value[1],value[1]+height);
[value[0],y]
}
elsevalue