Is it possible to trigger animation from parent comp layer? I have been trying this expression with my basic coding skills but couldn't make it work.

n = comp("myparentComp").layer("myLayer").marker.key(time); 
if(time < marker.key(n).time){ n=n-1;
if(n==0){ n=1
  • Sounds definitely doable but I need some more data. What are you trying to "trigger"?
    – Spencer
    Commented Jan 28, 2019 at 23:38

1 Answer 1


Totally possible, but there are some problems with your expression.

n = comp("myparentComp").layer("myLayer").marker.key(time); 

In this line n is going to return a marker key object. However the last part of the line uses the current time in the method marker.key(time). This won't work. The marker.key() function expects an int referring to the number of the marker (1-indexed, so the first marker is marker.key(1), because WTF adobe). A marker key has a time property, which is probably where you're getting confused. Also then you're treating n as if it's an integer, and you use a variable marker without declaring it or giving it a value.

If you want the animation to trigger on the first marker, it should look like this:

var marker1time = comp("myparentComp").layer("myLayer").marker.key(1).time;
if(time < marker1time){ 
  t = 0; //hold the animation until the first marker
} else {
    t=time-marker1time; //will start at 0 at the point where time == marker1time

Some basic JS tutorials would probably help. I recommend the w3Schools ones, they're web-design focused, but almost all JS tutes are.

  • Nice thanks, it worked. I got another question, would that be possible to have this expression for the animation to react to every markers of comp("myparentComp").layer("myLayer") ? This one works for the markers on the layer but I can't make it work with the one you wrote. n = marker.nearestKey(time).index; if(time < marker.key(n).time){ n=n-1; } if(n==0){ n=1 } t=time-marker.key(n).time; thisProperty.valueAtTime(t) Commented Jan 29, 2019 at 10:16
  • I don't quite understand what you're trying to do. What do you mean "have the animation react"?
    – stib
    Commented Jan 29, 2019 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.