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.
Attributes
Section titled “Attributes”Key.index
Section titled “Key.index”thisProperty.key(1).index
Description
Section titled “Description”Returns the index of the keyframe.
Number
Key.time
Section titled “Key.time”thisProperty.key(1).time
Description
Section titled “Description”Returns the time of the keyframe.
Number
Key.value
Section titled “Key.value”thisProperty.key(1).value
Description
Section titled “Description”Returns the value of the keyframe.
A value of the same property type as the property being refrenced.
Example
Section titled “Example”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;