Skip to content

markerkey

thisComp.marker.key(1)

You can access values for composition markers and layer markers using the same methods. Access layer markers through the thisLayer.marker object; access composition markers through the Marker Property object.

For the purpose of expressions, markers are a special type of Key object, so you can use methods such as nearestKey(time) to access markers, and markers also have time and index attributes. The index attribute is not the number (name) of the marker; it is the keyframe index number, representing the order of the marker in the time ruler.

Expressions have access to all the values for a marker that you can set in the Composition Marker or Layer Marker dialog box.

Because the XMP metadata in a footage item can be converted into layer markers for a layer based on that item, expressions can interact with XMP metadata. For information, see XMP metadata in After Effects.

Dan Ebberts provides a tutorial on the After Effects Developer Center that includes an example of using XMP metadata with expressions.

On this page, we’re going to use thisComp.marker.key(1) as a sample on how to call these items, however note that any method that returns a MarkerKey will work.


thisComp.marker.key(1).chapter

Contents of Chapter field in marker dialog box.

String


thisComp.marker.key(1).comment

Contents of Comment field in marker dialog box.

String


thisComp.marker.key(1).cuePointName

Contents of cue point Name field in marker dialog box.

String


thisComp.marker.key(1).duration

Duration, in seconds, of marker.

Number


thisComp.marker.key(1).eventCuePoint

Setting for cue point type in marker dialog box.

true for Event; false for Navigation.

Boolean


thisComp.marker.key(1).frameTarget

Contents of Frame Target field in marker dialog box.

String


thisComp.marker.key(1).parameters

Contents of Parameter Name and Parameter Value fields in marker dialog box.

Associative array of String values

If you have a parameter named “background color”, then you can use the following expression to access its value at the nearest marker:

thisComp.marker.nearestKey(time).parameters["background color"];

thisComp.marker.key(1).protectedRegion

State of the Protected Region option in the Composition Marker dialog box.

When true, the composition marker behaves as a protected region.

Will also return true for protected region markers on nested composition layers, but is otherwise not applicable to layer markers.

Boolean


thisComp.marker.key(1).url

Contents of URL field in marker dialog box.

String


This expression on the Source Text property of a text layer displays the time, duration, index, comment (name), chapter, URL, frame target, and cue point name for the layer marker nearest the current time, and whether the marker is for an event cue point:

const m = thisLayer.marker.nearestKey(time);
const s = [
"time:" + timeToCurrentFormat(m.time),
"duration: " + m.duration,
"key index: " + m.index,
"comment:" + m.comment,
"chapter:" + m.chapter,
"URL:" + m.url,
"frame target: " + m.frameTarget,
"cue point name: " + m.cuePointName,
"Event cue point? " + m.eventCuePoint,
""
];
for (let param in m.parameters){
s.push("parameter: " + param + " value: " + m.parameters[param]);
}
s.join("\n");