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
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 |
If h
is present and it's 1, you don't need i
and o
, as the property will keep the same value
until the next keyframe.
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.
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]}
}
Easing example
In the following example, the ball moves left and right, on the background you can see and edit a representation of its easing function.
Property types
Vector
Animatable Vector.
Vector Keyframe
Composition Diagram for Vector 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.
Position
Animatable 2D Vector with optional spatial tangents.
Position Keyframe
Composition Diagram for 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. |
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) |
Bezier Shape
Animatable Bezier.
Bezier Shape Keyframe
Composition Diagram for 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 |
s |
Bezier |
Value |
Value at this keyframe. |
Color
Animatable Color.
Color Keyframe
Composition Diagram for Color 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. |