FORUMS: list search recent posts

Animate position according to layer marker name

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Eva Lepik
Animate position according to layer marker name
on May 1, 2017 at 12:38:33 pm

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!
Eva

I 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]
}
else

try{
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]
}
else

value


Return to posts index

Steve Sierra
Re: Animate position according to layer marker name
on May 1, 2017 at 2:31:17 pm

Hi,

I think you just forgot the curly parenthesis for your else statements :

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]
}
else{ //----------HERE-----------------------
try{
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]
}
else
value
}//-----------AND HERE-------------------


Cheers !
;)


Return to posts index

Eva Lepik
Re: Animate position according to layer marker name
on May 1, 2017 at 2:40:24 pm

Thank you, Steve!

That's awesome :))
I wouldn't have found the error myself, as I 'm just starting out with conditional expressions.

Regards,
Eva


Return to posts index

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