Properties

Introduction

Properties in Lottie can be animated.

Their structure depends on whether it's animated or not:

Attribute Type Title Description
a 0-1 integer Animated Whether the property is animated
k Value or Keyframes When it's not animated, k will contain the value directly. When animated, k will be an array of keyframes.

Keyframes

Composition Diagram for Base Keyframe Base Keyframe Vector Keyframe Position Keyframe Gradient Keyframe Color Keyframe Shape Keyframe
Attribute Type Title Description
t number

Time

Frame number

h 0-1 integer

Hold

Hold

i Keyframe Easing

In Tangent

Easing tangent going into the next keyframe

o Keyframe Easing

Out Tangent

Easing tangent leaving the current keyframe

Keyframe arrays MUST be stored in order of ascending t frame number.

Two consecutive keyframes MAY have the same t value but a property MUST NOT have more than two keyframes with the same t. If two keyframes share the t value, the implementation MUST render one of the two values at the given frame.

All keyframes MUST have an i and o value, unless-

If the first keyframe occurs after the start of the animation, the initial property value will be from the first keyframe. Similarly, if the last keyframe is before the end of the animation, the last keyframe value will be held until the end.

Keyframe Easing

Keyframe easing handles are objects with x and y attributes, which are numbers within 0 and 1.

Attribute Type Title Description
x Vector or number

X

Time component: 0 means start time of the keyframe, 1 means time of the next keyframe.

y Vector or number

Y

Value interpolation component: 0 means start value of the keyframe, 1 means value at the next keyframe.

For vector properties, these are arrays, with one element per dimension so you can have different easing curves per dimension.

They represent a cubic bezier, starting at [0,0] and ending at [1,1] where the value determines the easing function.

The x axis represents time, a value of 0 is the time of the current keyframe, a value of 1 is the time of the next keyframe.

The y axis represents the value interpolation factor, a value of 0 represents the value at the current keyframe, a value of 1 represents the value at the next keyframe.

Unlike x values, y values are not clamped to [0 .. 1]. Supernormal y values allow the interpolated value to overshoot (extrapolate) beyond the specified keyframe values range.

When you use easing you have two easing handles for the keyframe:

o is the "out" handle, and is the first one in the bezier, determines the curve as it exits the current keyframe.

i is the "in" handle, and it's the second one in the bezier, determines the curve as it enters the next keyframe.

For linear interpolation you'd have

{
    "o": {"x": [0, 0], "y": [0, 0]},
    "i": {"x": [1, 1], "y": [1, 1]}
}

For easing in and out, you move the x towards the center, this makes the animation more fluid:

{
    "o": {"x": [0.333, 0.333], "y": [0, 0]},
    "i": {"x": [0.667, 0.667], "y": [1, 1]}
}

Property types

Vector

Animatable Vector.

Composition Diagram for Vector Property Vector Property Slottable Property Slottable Object
Attribute Type Title Description
sid string

Slot Id

Identifier to look up the slot

a 0-1 integer Animated Whether the property is animated
k Vector or array Value or Keyframes When it's not animated, k will contain the value directly. When animated, k will be an array of keyframes.

Vector Keyframe

Composition Diagram for Vector Keyframe Vector Keyframe Base Keyframe Position Keyframe
Attribute Type Title Description
t number

Time

Frame number

h 0-1 integer

Hold

Hold

i Keyframe Easing

In Tangent

Easing tangent going into the next keyframe

o Keyframe Easing

Out Tangent

Easing tangent leaving the current keyframe

s Vector

Value

Value at this keyframe.

Scalar

Animatable scalar (single number value).

Note that when animated it uses Vector Keyframes, so instead of scalars keyframes have arrays with a single values.

Composition Diagram for Scalar Property Scalar Property Slottable Property Slottable Object
Attribute Type Title Description
sid string

Slot Id

Identifier to look up the slot

a 0-1 integer Animated Whether the property is animated
k number or array Value or Keyframes When it's not animated, k will contain the value directly. When animated, k will be an array of keyframes.

Position

Animatable 2D Vector with optional spatial tangents.

Composition Diagram for Position Property Position Property Slottable Property Slottable Object
Attribute Type Title Description
sid string

Slot Id

Identifier to look up the slot

a 0-1 integer Animated Whether the property is animated
k Vector or array Value or Keyframes When it's not animated, k will contain the value directly. When animated, k will be an array of keyframes.

Position Keyframe

Composition Diagram for Position Keyframe Position Keyframe Vector Keyframe Base Keyframe
Attribute Type Title Description
t number

Time

Frame number

h 0-1 integer

Hold

Hold

i Keyframe Easing

In Tangent

Easing tangent going into the next keyframe

o Keyframe Easing

Out Tangent

Easing tangent leaving the current keyframe

s Vector

Value

Value at this keyframe.

ti Vector

Value In Tangent

Tangent for values (eg: moving position around a curved path)

to Vector

Value Out Tangent

Tangent for values (eg: moving position around a curved path)

Split Position

An animatable position where position values may be defined and animated separately.

Attribute Type Title Description
s boolean = True

Split

Whether the position has split values

x Scalar

X Position

X Position

y Scalar

Y Position

Y Position

Bezier Shape

Animatable Bezier.

Attribute Type Title Description
a 0-1 integer Animated Whether the property is animated
k Bezier or array Value or Keyframes When it's not animated, k will contain the value directly. When animated, k will be an array of keyframes.

Bezier Shape Keyframe

Composition Diagram for Shape Keyframe Shape Keyframe Base Keyframe
Attribute Type Title Description
t number

Time

Frame number

h 0-1 integer

Hold

Hold

i Keyframe Easing

In Tangent

Easing tangent going into the next keyframe

o Keyframe Easing

Out Tangent

Easing tangent leaving the current keyframe

s array of Bezier

Value

Value at this keyframe.

Color

Animatable Color.

Composition Diagram for Color Property Color Property Slottable Property Slottable Object
Attribute Type Title Description
sid string

Slot Id

Identifier to look up the slot

a 0-1 integer Animated Whether the property is animated
k Color or array Value or Keyframes When it's not animated, k will contain the value directly. When animated, k will be an array of keyframes.

Color Keyframe

Composition Diagram for Color Keyframe Color Keyframe Base Keyframe
Attribute Type Title Description
t number

Time

Frame number

h 0-1 integer

Hold

Hold

i Keyframe Easing

In Tangent

Easing tangent going into the next keyframe

o Keyframe Easing

Out Tangent

Easing tangent leaving the current keyframe

s Color

Value

Value at this keyframe.

Gradient

Animatable Gradient.

Attribute Type Title Description
p number

Color stop count

Color stop count

k object

Gradient stops

Animatable vector representing the gradient stops

k.a 0-1 integer Animated Whether the property is animated
k.k Gradient or array Value or Keyframes When it's not animated, k will contain the value directly. When animated, k will be an array of keyframes.

Color count is not animatable.

Gradient Keyframe

Composition Diagram for Gradient Keyframe Gradient Keyframe Base Keyframe
Attribute Type Title Description
t number

Time

Frame number

h 0-1 integer

Hold

Hold

i Keyframe Easing

In Tangent

Easing tangent going into the next keyframe

o Keyframe Easing

Out Tangent

Easing tangent leaving the current keyframe

s Gradient

Value

Value at this keyframe.