Slide 1

Slide 1 text

ThorVG’s Lottie Model in Action Jinny You (jinny@lottiefiles.com) 20 Feb, 2024

Slide 2

Slide 2 text

- Vector Graphics Engine - Light-weight (under 300kb) - Drawing APIs - Path, Rect, Circle - Native & Web(wasm) API - Supports Lottie - Platform independent capability

Slide 3

Slide 3 text

Vector Graphics - Mathematical formula - Scalable - Smaller file size *.svg, .ai, .lottie - A set of pixels - Realistic - Low quality when scaled *.jpg, .png, .gif

Slide 4

Slide 4 text

ThorVG

Slide 5

Slide 5 text

Native Lottie Support

Slide 6

Slide 6 text

- Written in C++ (C-friendly) - Portable - Efficient - Tiny size - Low-level language - High portability - Intrinsic threading / memory pools / Caching mechanism - Light-weight (Small binary size)

Slide 7

Slide 7 text

Lottie android Lottie ios Lottie web - All different language - Individual implementation - High-cost maintenance - Unoptimized performance & size

Slide 8

Slide 8 text

Lottie android Lottie ios Lottie web - Rendered by different libraries - Different rendering result - Can’t predict animation result - Highly depends on the platform

Slide 9

Slide 9 text

Lottie android Lottie ios Lottie web - Well-predictable animation - Same rendering result - Optimized performance & size - Low-cost maintenance ThorVG

Slide 10

Slide 10 text

- Developers do not need to rework for each platform and programming languages. - Designers will not struggle to accommodate different device outputs. - End-users will have consistent experiences provided by service. ThorVG

Slide 11

Slide 11 text

Feature coverage ✅ - Transform - Masks - Matte - Shape - Precomp - Image - Text (Glyph, Fonts) 🚧 - Expressions - Shape Modifier (MergePath, … ) - Layer Effect (Blending, Filter …) - Advanced Text (Font Origin, Path, Range Selector)

Slide 12

Slide 12 text

ThorVG Is Powered By Open Source https://github.com/thorvg

Slide 13

Slide 13 text

Advanced Part

Slide 14

Slide 14 text

- JSON file format - Vector Graphics Animation - Supports AE features: - Solids - Shape layers - Masks - Alpha mattes - Trim paths - Dash patterns Lottie File format

Slide 15

Slide 15 text

<> Load Module <> RenderMethod API C++ TVG PNG JPG SVG Lottie Native Apps API JS/WASM Web Apps (frontend) sample.lottie (json) JSON Parser Lottie Scene Composer Lottie Interpreter I/O Picture Shape Scene Canvas Call APIs to compose TVG Scene TVG SceneTree Request Frame SwCanvas GlCanvas Task Scheduler <> Path / Stroke / Fill Scene Shape Scene Shape Shape Compositor CompLayer ShapeLayer SolidLayer CompLayer ShapeLayer … Scene Shape Scene Shape Shape TVG SceneTree (Retainable) Call Call Text Lottie Loader ThorVG Single Binary [so/dll/wasm] Canvas Engine Extra Format Loaders Paint SW GL (beta) WG (beta) TTF Out WGCanvas

Slide 16

Slide 16 text

ThorVG Lottie Parser ThorVG Lottie Builder ThorVG Lottie Model ThorVG Lottie Property ThorVG Core Engine (tvg::Renderer) ThorVG Lottie Loader Drawing Vector Graphics: - Rect, Circle, Path… Load lottie asset into memory Parse each attributes Build lottie animation Object, Group, Layer, Shape … Point, Color, Opacity, Fill, Path …

Slide 17

Slide 17 text

ThorVG Lottie Parser ThorVG Lottie Builder ThorVG Lottie Model ThorVG Lottie Property ThorVG Core Engine (tvg::Renderer) ThorVG Lottie Loader Drawing Vector Graphics: - Rect, Circle, Path… Load lottie asset into memory Parse each attributes Build lottie animation Object, Group, Layer, Shape … Point, Color, Opacity, Fill, Path …

Slide 18

Slide 18 text

ThorVG Core Engine (tvg::Renderer) ThorVG Renderer

Slide 19

Slide 19 text

ThorVG Renderer https://www.thorvg.org/tutorial It’s SIMPLE!

Slide 20

Slide 20 text

ThorVG Lottie Parser ThorVG Lottie Builder ThorVG Lottie Model ThorVG Lottie Property ThorVG Core Engine (tvg::Renderer) ThorVG Lottie Loader Drawing Vector Graphics: - Rect, Circle, Path… Load lottie asset into memory Parse each attributes Build lottie animation Object, Group, Layer, Shape … Point, Color, Opacity, Fill, Path … “ Data ” Model

Slide 21

Slide 21 text

Data Model: Lottie Object - Lottie element’s base structure. - Extends to specific layers and shapes - Has explicit type LottieObject + name + type LottieGroup LottieShape LottieLayer LottiePath LottieRect LottiePolyStar LottieEllipse LottieTransform LottieImage LottieStroke LottieRepeater LottieTrimPath LottieRoundedCorner // ShapeModifier

Slide 22

Slide 22 text

Lottie Group Lottie Path Data Model: Lottie Object

Slide 23

Slide 23 text

Data Model: Lottie Property - Lottie literal value - Keyframe implementation - Generic type

Slide 24

Slide 24 text

“o” (opacity) “w” (width) Data Model: Lottie Property

Slide 25

Slide 25 text

Lottie Object Lottie Group Lottie Shape Lottie Property Lottie Stroke Lottie Image Lottie Fill Lottie Layer ThorVG Data Model Lottie Point Lottie Float Lottie Opacity Lottie Color Lottie TextDoc Lottie Position Lottie ColorStop Lottie Font

Slide 26

Slide 26 text

Lottie Path Lottie Rect Lottie PolyStar Lottie Ellipse … ThorVG’s own lottie data model in C++ ThorVG Data Model

Slide 27

Slide 27 text

ThorVG Lottie Parser ThorVG Lottie Loader ThorVG Lottie Model ThorVG Lottie Property Lottie Render Process ThorVG Core Engine (tvg::Renderer) ThorVG Lottie Builder tvg:: Software Raster Engine tvg:: WebGPU Raster Engine or

Slide 28

Slide 28 text

Lottie Composition : Connecting interface among the renderer, loader, builder and data model Lottie Object Lottie Image Lottie Font Lottie Composition Lottie Object

Slide 29

Slide 29 text

ThorVG Lottie Parser ThorVG Lottie Builder ThorVG Lottie Model ThorVG Lottie Property ThorVG Core Engine (tvg::Renderer) ThorVG Lottie Loader Drawing Vector Graphics: - Rect, Circle, Path… Load lottie asset into memory Parse each attributes Build lottie animation Object, Group, Layer, Shape … Point, Color, Opacity, Fill, Path …

Slide 30

Slide 30 text

Lottie Loader Lottie Loader - The Lottie JSON loading interface - Load and manage file data in memory - Handle file size, frame info - Provide frame controls - Integrate lottie animation with the renderer

Slide 31

Slide 31 text

Lottie Loader Lottie Parser parsing(“lottie.json”) return lottie model Lottie Parser Compositor CompLayer ShapeLayer SolidLayer CompLayer ShapeLayer … Rapid Json

Slide 32

Slide 32 text

Lottie Parser Lottie Parser : Iterate JSON and obtain lottie model Rapid Json

Slide 33

Slide 33 text

Lottie Parser Lottie Parser Rapid Json

Slide 34

Slide 34 text

Lottie Parser Lottie Parser Rapid Json ThorVG Lottie Model Compositor CompLayer ShapeLayer SolidLayer CompLayer ShapeLayer …

Slide 35

Slide 35 text

ThorVG Lottie Parser ThorVG Lottie Builder ThorVG Lottie Model ThorVG Lottie Property ThorVG Core Engine (tvg::Renderer) ThorVG Lottie Loader Drawing Vector Graphics: - Rect, Circle, Path… Load lottie asset into memory Parse each attributes Build lottie animation Object, Group, Layer, Shape … Point, Color, Opacity, Fill, Path …

Slide 36

Slide 36 text

Compositor ShapeLayer SolidLayer CompLayer ShapeLayer … TVG Lottie Model RootLayer NullLayer Group Transform Shape Stroke Fill +Path +Fill +Stroke +Transform +Path +Fill +Stroke +Transform +Path +Fill +Stroke +Transform TVG SceneTree +transform +composition +Transform +Bitmap +Scene +transform +composition Transform Lottie Builder

Slide 37

Slide 37 text

Lottie Builder Lottie Model Updating TVG scene data Root Scene Picture Shape Scene Rect …

Slide 38

Slide 38 text

Lottie Builder Compositor TVG Lottie Model RootLayer

Slide 39

Slide 39 text

Lottie Builder Compositor ShapeLayer TVG Lottie Model RootLayer Group Path Shape Stroke + Head

Slide 40

Slide 40 text

Lottie Builder Compositor ShapeLayer TVG Lottie Model RootLayer ShapeLayer Group Shape Stroke Fill + Body

Slide 41

Slide 41 text

Lottie Builder Compositor ShapeLayer ShapeLayer TVG Lottie Model RootLayer ShapeLayer Group Path Shape Stroke Fill + Leg

Slide 42

Slide 42 text

Compositor ShapeLayer SolidLayer CompLayer ShapeLayer … TVG Lottie Model RootLayer NullLayer Group Transform Shape Stroke Fill +Path +Fill +Stroke +Transform +Path +Fill +Stroke +Transform +Path +Fill +Stroke +Transform TVG SceneTree +transform +composition +Transform +Bitmap +Scene +transform +composition Transform Lottie Builder

Slide 43

Slide 43 text

Compositor ShapeLayer SolidLayer CompLayer ShapeLayer … TVG Lottie Model RootLayer NullLayer Group Transform Shape Stroke Fill Transform Lottie Builder

Slide 44

Slide 44 text

1. Lottie Data Model 2. Loader, Parser and Compositor 3. Builder : How ThorVG renders Wrap Up

Slide 45

Slide 45 text

<> Load Module <> RenderMethod API C++ TVG PNG JPG SVG Lottie Native Apps API JS/WASM Web Apps (frontend) sample.lottie (json) JSON Parser Lottie Scene Composer Lottie Interpreter I/O Picture Shape Scene Canvas Call APIs to compose TVG Scene TVG SceneTree Request Frame SwCanvas GlCanvas Task Scheduler <> Path / Stroke / Fill Scene Shape Scene Shape Shape Compositor CompLayer ShapeLayer SolidLayer CompLayer ShapeLayer … Scene Shape Scene Shape Shape TVG SceneTree (Retainable) Call Call Text Lottie Loader ThorVG Single Binary [so/dll/wasm] Canvas Engine Extra Format Loaders Paint SW GL (beta) WG (beta) TTF Out WGCanvas

Slide 46

Slide 46 text

Q&A