Giter Site home page Giter Site logo

rlottie's Introduction

rlottie

Build Status 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 are small samples of the power of Lottie.

Example1 Example2 Example2

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 ..

# install in a different path. eg ~/test/usr/lib

cmake -DCMAKE_INSTALL_PREFIX=~/test ..

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

rlottie's People

Contributors

bryceharrington avatar hermet avatar jaeunchoi avatar jkcailteux avatar john-preston avatar jsuya avatar kimcinoo avatar laktyushin avatar mihais avatar mymedia2 avatar smohantty avatar somang-park avatar vtorri avatar yuangu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

classicvalues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.