Skip to content
A platform independent standalone library that plays Lottie Animation.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmake packaging: rename lottie-player to rlottie. Jan 23, 2019
example
inc rlottie: added support of lambda expression in setValue. May 13, 2019
licenses lottie/vector: create a wraper library of stb_image loader Jan 15, 2019
packaging fix typo. Feb 8, 2019
src rlottie/model: refactor repeater object model to optimize size. May 23, 2019
test lottie: final changes to rename from lottie-player to rlottie Jan 24, 2019
.clang-format
.gitignore updated gitignore. Dec 13, 2018
.travis.yml
AUTHORS add AUTHORS Sep 7, 2018
CMakeLists.txt rlottie: updated compiler flags to treat warning as error May 14, 2019
COPYING packaging: rename lottie-player to rlottie. Jan 23, 2019
README.md rlottie: updated demo section of the README May 9, 2019
meson.build rlottie: updated compiler flags to treat warning as error May 14, 2019
meson_options.txt Fixes a spelling and some minor formatting. Sep 27, 2018
rlottie.pc.in rlottie: remove dependancy of -stdc++14 flag to link against rlottie … Mar 5, 2019

README.md

rlottie

Build Status

rlottie is a platform independent standalone c++ library for rendering vector based animations and art in realtime.

Lottie loads and renders animations and vectors exported in the bodymovin JSON format. Bodymovin JSON can be created and exported from After Effects with bodymovin, Sketch with Lottie Sketch Export, and from Haiku.

For the first time, designers can create and ship beautiful animations without an engineer painstakingly recreating it by hand. Since the animation is backed by JSON they are extremely small in size but can be large in complexity!

Here is just a small sampling of the power of Lottie

Example1

Contents

Building Lottie

rottie supports meson and cmake build system. rottie is written in C++14. and has a public header dependancy of C++11

Meson Build

install meson and ninja if not already installed.

Run meson to configure rlottie

meson build

Run ninja to build rlottie

ninja -C build

Cmake Build

Install cmake if not already installed

Create a build directory for out of source build

mkdir build

Run cmake command inside build directory to configure rlottie.

cd build
cmake -DLIB_INSTALL_DIR=/usr/lib ..

# install to a different prefix. eg ~/test/lib

cmake -DCMAKE_INSTALL_PREFIX=~/test -DLIB_INSTALL_DIR=lib ..

Run make to build rlottie

make -j 2

To install rlottie library

make install

Test

Configure to build test

meson configure -Dtest=true

Build test suit

ninja

Run test suit

ninja test

Back to contents

Demo

If you want to see rlottie librray in action without building it please visit rlottie online viewer

While building rlottie library it generates a simple lottie to GIF converter which can be used to convert lottie json file to GIF file.

Run Demo

lottie2gif [lottie file name]

Previewing Lottie JSON Files

Please visit rlottie online viewer

rlottie online viewer uses rlottie wasm library to render the resource locally in your browser. To test your JSON resource drag and drop it to the browser window.

Quick Start

Lottie loads and renders animations and vectors exported in the bodymovin JSON format. Bodymovin JSON can be created and exported from After Effects with bodymovin, Sketch with Lottie Sketch Export, and from Haiku.

You can quickly load a Lottie animation with:

std::unique_ptr<rlottie::Animation> animation = 
					rlottie::loadFromFile(std::string("absolute_path/test.json"));

You can load a lottie animation from raw data with:

std::unique_ptr<rlottie::Animation> animation = rlottie::loadFromData(std::string(rawData),
                                                                      std::string(cacheKey));

Properties like frameRate , totalFrame , duration can be queried with:

# get the frame rate of the resource. 
double frameRate = animation->frameRate();

#get total frame that exists in the resource
size_t totalFrame = animation->totalFrame();

#get total animation duration in sec for the resource 
double duration = animation->duration();

Render a particular frame in a surface buffer immediately with:

rlottie::Surface surface(buffer, width , height , stride);
animation->renderSync(frameNo, surface); 

Render a particular frame in a surface buffer asyncronousely with:

rlottie::Surface surface(buffer, width , height , stride);
# give a render request
std::future<rlottie::Surface> handle = animation->render(frameNo, surface);
...
#when the render data is needed
rlottie::Surface surface = handle.get();

Back to contents

Dynamic Property

Update me.

Supported After Effects Features

Shapes Supported
Shape 👍
Ellipse 👍
Rectangle 👍
Rounded Rectangle 👍
Polystar 👍
Group 👍
Trim Path (individually) 👍
Trim Path (simultaneously) 👍
Renderable Supported
Fill 👍
Stroke 👍
Radial Gradient 👍
Linear Gradient 👍
Gradient Stroke 👍
Transforms Supported
Position 👍
Position (separated X/Y) 👍
Scale 👍
Skew ⛔️
Rotation 👍
Anchor Point 👍
Opacity 👍
Parenting 👍
Auto Orient 👍
Interpolation Supported
Linear Interpolation 👍
Bezier Interpolation 👍
Hold Interpolation 👍
Spatial Bezier Interpolation 👍
Rove Across Time 👍
Masks Supported
Mask Path 👍
Mask Opacity 👍
Add 👍
Subtract 👍
Intersect 👍
Lighten ⛔️
Darken ⛔️
Difference ⛔️
Expansion ⛔️
Feather ⛔️
Mattes Supported
Alpha Matte 👍
Alpha Inverted Matte 👍
Luma Matte 👍
Luma Inverted Matte 👍
Merge Paths Supported
Merge ⛔️
Add ⛔️
Subtract ⛔️
Intersect ⛔️
Exclude Intersection ⛔️
Layer Effects Supported
Fill ⛔️
Stroke ⛔️
Tint ⛔️
Tritone ⛔️
Levels Individual Controls ⛔️
Text Supported
Glyphs ⛔️
Fonts ⛔️
Transform ⛔️
Fill ⛔️
Stroke ⛔️
Tracking ⛔️
Anchor point grouping ⛔️
Text Path ⛔️
Per-character 3D ⛔️
Range selector (Units) ⛔️
Range selector (Based on) ⛔️
Range selector (Amount) ⛔️
Range selector (Shape) ⛔️
Range selector (Ease High) ⛔️
Range selector (Ease Low) ⛔️
Range selector (Randomize order) ⛔️
expression selector ⛔️
Other Supported
Expressions ⛔️
Images 👍
Precomps 👍
Time Stretch 👍
Time remap 👍
Markers ⛔️

Back to contents

Issues or Feature Requests?

File github issues for anything that is broken. Be sure to check the list of supported features before submitting. If an animation is not working, please attach the After Effects file to your issue. Debugging without the original can be very difficult. For immidiate assistant or support please reach us in Gitter

You can’t perform that action at this time.