Skip to content

key

thisProperty.key(1)

When you access a Key object, you can get time, index, and value properties from it.

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


thisProperty.key(1).index

Returns the index of the keyframe.

Number


thisProperty.key(1).time

Returns the time of the keyframe.

Number


thisProperty.key(1).value

Returns the value of the keyframe.

A value of the same property type as the property being refrenced.


The following expression, when written on an Opacity property with keyframes, ignores the keyframe values and uses only the placement of the keyframes in time to determine where a flash should occur:

const d = Math.abs(time - nearestKey(time).time);
easeOut(d, 0, .1, 100, 0)

The following expression gives you the value of the third Position keyframe:

position.key(3).value;