Shape Elements

Lottie considers everything related to vector data as a "shape" but I think it's worth distinguishing across a few categories:

  • Shapes These provide only the shape information, but no styling
  • Style These provide styling info (like fill and stroke)
  • Group This is a shape that contains other shape
  • Modifier These change other shapes
  • Transform Special shape that defines the transforms in a group shape

All shapes have the following properties:

Attribute Type Description
nm string

Name, as seen from editors and the like

mn string

Match name, used in expressions

ty string

Shape type (see values below)

hd boolean

Whether the shape is hidden

bm Blend Mode

Blend Mode

ix integer

Index used in expressions

cl string

CSS class used by the SVG renderer

ln string

id attribute used by the SVG renderer

Shape Types

ty Shape
rc Rectangle
el Ellipse
sr PolyStar
sh Path
fl Fill
st Stroke
gf Gradient Fill
gs Gradient Stroke
no No Style
gr Group
tr Transform
rp Repeater
tm Trim
rd Rounded Corners
pb Pucker / Bloat
mm Merge
tw Twist
op Offset Path
zz Zig Zag

Shape

These shapes only define path data, to actually show something, they must be followed by some style shape.

They have a d attribute which specifies the drawing direction, which can be seen when using Trim Path.

Attribute Type Description
d Shape Direction

Direction the shape is drawn as, mostly relevant when using trim path

Rectangle

A rectangle, defined by its center point and size.

Attribute Type Description
ty string = 'rc'

Shape Type

p Animated Position

Center of the rectangle

s Animated Vector

Size

r Animated number

Rounded corners radius

256
256
256
256
0

Ellipse

Attribute Type Description
ty string = 'el'

Shape Type

p Animated Position

Position

s Animated Vector

Size

256
256
256
256

PolyStar

Regular polygon or star.

Attribute Type Description
ty string = 'sr'

Shape Type

p Animated Position

Position

or Animated number

Outer Radius

os Animated number

Outer Roundness as a percentage

r Animated number

Rotation, clockwise in degrees

pt Animated number

Points

sy Star Type

Star type, 1 for Star, 2 for Polygon

If sy is 1 (star) you also have attributes defining the inner ends of the star:

Attribute Type Description
ir Animated number Inner Radius
is Animated number Inner Roundness as a percentage
5
0
200
100
0
0

Path

Bezier path, note that it's a continuous shape, to have multiple shapes like when you need holes or gaps you need to create multiple Path shapes and group them together.

Attribute Type Description
ty string = 'sh'

Shape Type

ks Animated Bezier

Bezier path

Style

These apply a style (such as fill stroke) to the paths defined by the shapes.

Each style is applied to all preceding shapes in the same group / layer.

In most formats the style is usually defined as a property of a shape, in lottie they are separate and allows for more flexibility.

Some examples of the added flexibility would be a shape with multiple strokes, or a gradient fading into a solid color.

Fill

Solid fill color.

Attribute Type Description
ty string = 'fl'

Shape Type

o Animated number

Opacity, 100 means fully opaque

c Animated Color

Color

r Fill Rule

Fill Rule

1
0.98
0.28
100

Stroke

Defines a stroke.

Attribute Type Description
ty string = 'st'

Shape Type

lc Line Cap

Line Cap

lj Line Join

Line Join

ml number

Miter Limit

ml2 Animated number

Animatable alternative to ml

o Animated number

Opacity, 100 means fully opaque

w Animated number

Stroke width

d array of Stroke Dash

Dashed line definition

c Animated Color

Stroke color

Stroke Dashes

Defined as a sequence of alternating dashes and gaps.

Attribute Type Description
n Stroke Dash Type

Dash Type

v Animated number

Length of the dash

1
0.98
0.28
32
100
3
0
100
0

Gradients

Gradient fill and gradient stroke have the same attributes as fill and stroke but remove color (c) and add the following:

Attribute Type Description
s Animated Vector

Starting point for the gradient

e Animated Vector

End point for the gradient

t Gradient Type

Type of the gradient

g Gradient Colors

Gradient colors

If it's a radial gradient, s refers to the center of the gradient, and the style object may have these additional properties:

Attribute Type Description
h Animated number Highlight Length, as a percentage between s and e
a Animated number Highlight Angle, relative to the direction from s to e

Basically the radial highlight position is defined in polar coordinates relative to s.

Gradient Colors

Attribute Type Description View Schema
k Animated Gradient Gradient Colors
p integer Number of Colors

Since gradient values might have different representation based on whether they have transparency or not, you need to check p to determine whether a keyframe value has transparency.

Gradient Example

256
496
256
16
0
0

No Style

Represents a style for shapes without fill or stroke.

Attribute Type Description
ty string = 'no'

Shape Type

Group

A group is a shape that can contain other shapes (including other groups).

The usual contents of a group are:

For example, if you want to have a red rectangle with a black outline, its group will contain

  1. A Rectangle defining the actual shape of the rectangle
  2. A Fill for the color red
  3. A Stroke for the black outline
  4. A Transform for the group transform

While the contents may vary, a group must always end with a Transform shape.

The attributes of a Group are:

Attribute Type Description View Schema
np number Number of properties
it Array of shapes Shapes

Transform Shape

Basically the same as Transform but with the ty attribute.

Modifiers

Modifiers process their siblings and alter the path defined by shapes.

Repeater

This is a bit different compared from other modifiers, since it will take into account style as well.

The effect of a Repeater is to duplicate the other shapes a number of times applying a transform for each copy.

Also has the attributes from Modifier.

Attribute Type Description
ty string = 'rp'

Shape Type

c Animated number

Number of copies

o Animated number

Offset

m Composite

Stacking order

tr Repeater Transform

Transform applied to each copy

The transform is multiplied by o + 1 (where o is the Offset property above).
So if o is 0, the first instance shown by the Repeater is at its starting location.
If it's 1, the first instance has the matrix applied to it. Other values multiply the initial transform accordingly.

Repeater Transform

Same as a regular Transform but instead of a single opacity value (o), it has two:

Attribute Type Description
so Animated number Start Opacity
eo Animated number End Opacity

The first copy will use so, the last eo, and copies between them will have an interpolated value.

4
100
50
130
0
137
0

Trim Path

This is mostly useful for shapes with a stroke and not a fill.

It takes the path defined by shapes and only shows a segment of the resulting bezier data.

Also has the attributes from Modifier.

Attribute Type Description
ty string = 'tm'

Shape Type

s Animated number

Segment start

e Animated number

Segment end

o Animated number

Offset

m Trim Multiple Shapes

How to treat multiple copies

s and e go from 0 to 100, 0 being at the beginning of the path and 100 at the end. The displayed segment is what lays between the two.

o is an offset from the start, to allow values to wrap around. Its value goes from 0 (start of the path) to 360 (end of the path). It looks like an angle but it isn't really, the difference between o and s is that with o you can go over 360 or below 0 to shift the whole segment along the path.

Here is an interactive example:

0
50
0

Rounded Corners

Self explanatory

Also has the attributes from Modifier.

Attribute Type Description
ty string = 'rd'

Shape Type

r Animated number

Radius

50

Pucker / Bloat

Interpolates bezier vertices towards the center of the shape, and tangent handles away from it (or vice-versa).

Attribute Type Description
ty string = 'pb'

Shape Type

a Animated number

Amount as a percentage

When a is 0, nothing changes.
When a is positive, the vertices are pulled towards the center, with 100 being at the center. And the tangents are pushed away.
When a is negative the vertices are pushed away from the center with 100 being twice far away from the center. And the tangents are pulled towards the center.

50

Twist

Attribute Type Description
ty string = 'tw'

Shape Type

a Animated number

Angle

c Animated Vector

Center

Merge

Boolean operator on shapes

Attribute Type Description
ty string = 'mm'

Shape Type

mm Merge Mode

Merge Mode

Offset Path

Interpolates the shape with its center point and bezier tangents with the opposite direction

Attribute Type Description
ty string = 'op'

Shape Type

a Animated number

Amount

lj Line Join

Line Join

ml Animated number

Miter Limit

Zig Zag

Changes the edges of affected shapes into a series of peaks and valleys of uniform size

Attribute Type Description
ty string = 'zz'

Shape Type

r Animated number

Number of ridges per segment

s Animated number

Distance between peaks and troughs

pt Animated number

Point type (1 = corner, 2 = smooth)