markerkey
MarkerKey
Section titled “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.
Attributes
Section titled “Attributes”MarkerKey.chapter
Section titled “MarkerKey.chapter”thisComp.marker.key(1).chapter
Description
Section titled “Description”Contents of Chapter field in marker dialog box.
String
MarkerKey.comment
Section titled “MarkerKey.comment”thisComp.marker.key(1).comment
Description
Section titled “Description”Contents of Comment field in marker dialog box.
String
MarkerKey.cuePointName
Section titled “MarkerKey.cuePointName”thisComp.marker.key(1).cuePointName
Description
Section titled “Description”Contents of cue point Name field in marker dialog box.
String
MarkerKey.duration
Section titled “MarkerKey.duration”thisComp.marker.key(1).duration
Description
Section titled “Description”Duration, in seconds, of marker.
Number
MarkerKey.eventCuePoint
Section titled “MarkerKey.eventCuePoint”thisComp.marker.key(1).eventCuePoint
Description
Section titled “Description”Setting for cue point type in marker dialog box.
true
for Event; false
for Navigation.
Boolean
MarkerKey.frameTarget
Section titled “MarkerKey.frameTarget”thisComp.marker.key(1).frameTarget
Description
Section titled “Description”Contents of Frame Target field in marker dialog box.
String
MarkerKey.parameters
Section titled “MarkerKey.parameters”thisComp.marker.key(1).parameters
Description
Section titled “Description”Contents of Parameter Name and Parameter Value fields in marker dialog box.
Associative array of String values
Example
Section titled “Example”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"];
MarkerKey.protectedRegion
Section titled “MarkerKey.protectedRegion”thisComp.marker.key(1).protectedRegion
Description
Section titled “Description”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
MarkerKey.url
Section titled “MarkerKey.url”thisComp.marker.key(1).url
Description
Section titled “Description”Contents of URL field in marker dialog box.
String
Example
Section titled “Example”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");