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
}
thisProperty.valueAtTime(t);
Some basic JS tutorials would probably help. I recommend the w3Schools ones, they're web-design focused, but almost all JS tutes are.