xref: /aosp_15_r20/external/skia/site/docs/user/modules/skottie.md (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1*c8dee2aaSAndroid Build Coastguard Worker---
2*c8dee2aaSAndroid Build Coastguard Workertitle: 'Skottie - Lottie Animation Player'
3*c8dee2aaSAndroid Build Coastguard WorkerlinkTitle: 'Skottie - Lottie Animation Player'
4*c8dee2aaSAndroid Build Coastguard Worker
5*c8dee2aaSAndroid Build Coastguard Workerweight: 10
6*c8dee2aaSAndroid Build Coastguard Worker---
7*c8dee2aaSAndroid Build Coastguard Worker
8*c8dee2aaSAndroid Build Coastguard WorkerSkia now offers a performant, secure native player for JSON animations derived
9*c8dee2aaSAndroid Build Coastguard Workerfrom the Bodymovin plugin for After Effects. It can be used on any platform
10*c8dee2aaSAndroid Build Coastguard Workerwhere you are using Skia, including Android & iOS.
11*c8dee2aaSAndroid Build Coastguard Worker
12*c8dee2aaSAndroid Build Coastguard WorkerThe player aims to build upon the Lottie player widely used for animations
13*c8dee2aaSAndroid Build Coastguard Workertoday, improving on the performance, feature set, and platform cohesiveness for
14*c8dee2aaSAndroid Build Coastguard Workerour clients. We are big fans of the Bodymovin format and where possible,
15*c8dee2aaSAndroid Build Coastguard Workercontributing advancements back to Bodymovin/Lottie.
16*c8dee2aaSAndroid Build Coastguard Worker
17*c8dee2aaSAndroid Build Coastguard Worker<br>
18*c8dee2aaSAndroid Build Coastguard Worker
19*c8dee2aaSAndroid Build Coastguard Worker## Sample JSON animations
20*c8dee2aaSAndroid Build Coastguard Worker
21*c8dee2aaSAndroid Build Coastguard WorkerHere are some test samples rendering with Skia's animation player:
22*c8dee2aaSAndroid Build Coastguard Worker
23*c8dee2aaSAndroid Build Coastguard Worker<script src="https://skottie.skia.org/static/canvaskit.js"></script>
24*c8dee2aaSAndroid Build Coastguard Worker<script src="https://skottie.skia.org/static/inline-bundle.js"></script>
25*c8dee2aaSAndroid Build Coastguard Worker<style>
26*c8dee2aaSAndroid Build Coastguard Worker    skottie-inline-sk {
27*c8dee2aaSAndroid Build Coastguard Worker        display: inline-block;
28*c8dee2aaSAndroid Build Coastguard Worker    }
29*c8dee2aaSAndroid Build Coastguard Worker</style>
30*c8dee2aaSAndroid Build Coastguard Worker
31*c8dee2aaSAndroid Build Coastguard Worker<a href="https://skottie.skia.org/e6741dda67629da1f80c254dad3df865">
32*c8dee2aaSAndroid Build Coastguard Worker  <skottie-inline-sk src="https://skottie.skia.org/_/j/e6741dda67629da1f80c254dad3df865" width=200 height=200></skottie-inline-sk>
33*c8dee2aaSAndroid Build Coastguard Worker</a>
34*c8dee2aaSAndroid Build Coastguard Worker<a href="https://skottie.skia.org/ffea72cf6be48fa061671c124ed7789c">
35*c8dee2aaSAndroid Build Coastguard Worker  <skottie-inline-sk src="https://skottie.skia.org/_/j/ffea72cf6be48fa061671c124ed7789c" width=200 height=200></skottie-inline-sk>
36*c8dee2aaSAndroid Build Coastguard Worker</a>
37*c8dee2aaSAndroid Build Coastguard Worker<a href="https://skottie.skia.org/00e850cdbed7304985eaefe98a4e8a9c">
38*c8dee2aaSAndroid Build Coastguard Worker  <skottie-inline-sk src="https://skottie.skia.org/_/j/00e850cdbed7304985eaefe98a4e8a9c" width=200 height=200></skottie-inline-sk>
39*c8dee2aaSAndroid Build Coastguard Worker</a>
40*c8dee2aaSAndroid Build Coastguard Worker<a href="https://skottie.skia.org/e1aca009d5ebec9bd122b87b018bb673">
41*c8dee2aaSAndroid Build Coastguard Worker  <skottie-inline-sk src="https://skottie.skia.org/_/j/e1aca009d5ebec9bd122b87b018bb673" width=200 height=200></skottie-inline-sk>
42*c8dee2aaSAndroid Build Coastguard Worker</a>
43*c8dee2aaSAndroid Build Coastguard Worker<a href="https://skottie.skia.org/821fd79dd7437b97ba891e7a00970a06">
44*c8dee2aaSAndroid Build Coastguard Worker  <skottie-inline-sk src="https://skottie.skia.org/_/j/821fd79dd7437b97ba891e7a00970a06" width=200 height=200></skottie-inline-sk>
45*c8dee2aaSAndroid Build Coastguard Worker</a>
46*c8dee2aaSAndroid Build Coastguard Worker<a href="https://skottie.skia.org/ad63f250084685c96edd9b52ae2f436b">
47*c8dee2aaSAndroid Build Coastguard Worker  <skottie-inline-sk src="https://skottie.skia.org/_/j/ad63f250084685c96edd9b52ae2f436b" width=200 height=200></skottie-inline-sk>
48*c8dee2aaSAndroid Build Coastguard Worker</a>
49*c8dee2aaSAndroid Build Coastguard Worker<a href="https://skottie.skia.org/40f78ddc751c16348a08e1d61d3e78b1">
50*c8dee2aaSAndroid Build Coastguard Worker  <skottie-inline-sk src="https://skottie.skia.org/_/j/40f78ddc751c16348a08e1d61d3e78b1" width=200 height=200></skottie-inline-sk>
51*c8dee2aaSAndroid Build Coastguard Worker</a>
52*c8dee2aaSAndroid Build Coastguard Worker<a href="https://skottie.skia.org/fc42db7c75741437b5cb0e90b3febc65">
53*c8dee2aaSAndroid Build Coastguard Worker  <skottie-inline-sk src="https://skottie.skia.org/_/j/fc42db7c75741437b5cb0e90b3febc65" width=200 height=200></skottie-inline-sk>
54*c8dee2aaSAndroid Build Coastguard Worker</a>
55*c8dee2aaSAndroid Build Coastguard Worker<a href="https://skottie.skia.org/c16eee287f2cea44102b6670c66e60ab">
56*c8dee2aaSAndroid Build Coastguard Worker  <skottie-inline-sk src="https://skottie.skia.org/_/j/c16eee287f2cea44102b6670c66e60ab" width=200 height=200></skottie-inline-sk>
57*c8dee2aaSAndroid Build Coastguard Worker</a>
58*c8dee2aaSAndroid Build Coastguard Worker
59*c8dee2aaSAndroid Build Coastguard Worker\*Sample animations courtesy of the lottiefiles.com community
60*c8dee2aaSAndroid Build Coastguard Worker
61*c8dee2aaSAndroid Build Coastguard Worker<br>
62*c8dee2aaSAndroid Build Coastguard Worker
63*c8dee2aaSAndroid Build Coastguard Worker## Test server
64*c8dee2aaSAndroid Build Coastguard Worker
65*c8dee2aaSAndroid Build Coastguard WorkerTest your Lottie files in our player at https://skottie.skia.org
66*c8dee2aaSAndroid Build Coastguard Worker
67*c8dee2aaSAndroid Build Coastguard Worker<br>
68*c8dee2aaSAndroid Build Coastguard Worker
69*c8dee2aaSAndroid Build Coastguard Worker## The code
70*c8dee2aaSAndroid Build Coastguard Worker
71*c8dee2aaSAndroid Build Coastguard WorkerSkia's animation code entry point can be found here on
72*c8dee2aaSAndroid Build Coastguard Worker[Googlesource](https://skia.googlesource.com/skia/+/main/modules/skottie/include/Skottie.h)
73*c8dee2aaSAndroid Build Coastguard Workerand
74*c8dee2aaSAndroid Build Coastguard Worker[GitHub](https://github.com/google/skia/blob/main/modules/skottie/include/Skottie.h).
75*c8dee2aaSAndroid Build Coastguard WorkerThe code is part of Skia's library but can also be made available as a separate
76*c8dee2aaSAndroid Build Coastguard Workerpackage.
77*c8dee2aaSAndroid Build Coastguard Worker
78*c8dee2aaSAndroid Build Coastguard Worker<br>
79*c8dee2aaSAndroid Build Coastguard Worker
80*c8dee2aaSAndroid Build Coastguard Worker## Embedding examples
81*c8dee2aaSAndroid Build Coastguard Worker
82*c8dee2aaSAndroid Build Coastguard WorkerSample C code for using the Skottie native player can be found
83*c8dee2aaSAndroid Build Coastguard Worker[here](https://github.com/google/skia/blob/main/modules/skottie/src/SkottieTool.cpp).
84*c8dee2aaSAndroid Build Coastguard Worker
85*c8dee2aaSAndroid Build Coastguard WorkerAndroid app code for inspiration can be found
86*c8dee2aaSAndroid Build Coastguard Worker[here](https://github.com/google/skia/tree/main/platform_tools/android/apps/skottie).
87*c8dee2aaSAndroid Build Coastguard Worker
88*c8dee2aaSAndroid Build Coastguard WorkerExample code embedding Skottie into our Viewer app is
89*c8dee2aaSAndroid Build Coastguard Worker[here](https://github.com/google/skia/blob/main/tools/viewer/SkottieSlide.cpp).
90*c8dee2aaSAndroid Build Coastguard Worker
91*c8dee2aaSAndroid Build Coastguard WorkerThe Viewer or Skottie Android apps can be built following
92*c8dee2aaSAndroid Build Coastguard Worker[these](/docs/user/sample/viewer) instructions.
93