Copy link to clipboard
Copied
So I want to create an animation inside of a composition and control that animation via markers on the composition itself.
I know how to set up the animation itself and control it with markers inside of the same composition. My problem is that I cannot seem to figure out how to get the markers of the composition itself.
For example, using the command
thisComp.marker.numKeys
on the sourcetext of a text layer, I get 0, so it measures something. But when I adding markers to this composition does not seem to change anything (i.e. the number stays at 0)
So is there a way to grab the markers (or keyframes) of a composition from within the composition?
Many thanks in advance 🙂
Copy link to clipboard
Copied
Make sure, you add the markers to the comp, and not to a layer (markers should appear on top of render bar).
If you add the markers outside in a parent comp, where your working comp lays as a layer, you need to call the comp explicite:
comp("Master").layer("CompWithMarkers").marker.numKeys;
Unfortunatly there is no concept like "parentComp" in expressions, therefore you cannot know read out how your comp is called or what layer index is has on "the outside". So you cannot make this with variables, or just by brute-force cycling thru everything.
*Martin
Copy link to clipboard
Copied
Thank you so much, that was super helpful.
Also, I found a workaround to make it more flexible:
var comp_name = thisComp.name;
comp("Master").layer(comp_name).marker.numKeys;
in this way layers can access the markers on the parent composition and once numKeys are replaced with nearestKey it can be used to control animations.
Copy link to clipboard
Copied
Great solution. Just be aware that this will break when the precomps are renamed.