| // Copyright 2018 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| library fuchsia.skia.skottie; |
| |
| using fuchsia.mem; |
| |
| // Provides load status and animation duration on successful load. |
| struct Status { |
| bool error; |
| string? message; |
| uint32 duration; |
| }; |
| |
| // Defines additional options used during |Load|. |
| struct Options { |
| uint32 background_color; |
| bool loop; |
| bool autoplay; |
| }; |
| |
| // Defines the player interface to control the animation. It is returned upon |
| // successful load of the animation. |
| interface Player { |
| // Seek to position |t| where 0 <= t <= 1. |
| 1: Seek(float32 t); |
| // Play and stop at |t| = 1 if |loop| = false. |
| 2: Play(); |
| // Pause player. |
| 3: Pause(); |
| }; |
| |
| [Discoverable] |
| // Skottie loader exported by |ViewProvider| to load skottie JSON animations |
| // into views created from it. |
| interface Loader { |
| // Load the snapshot from the Vmo buffer payload. Returns a callback with |
| // |Player| controller and load status |Status|. |player| is null if loading |
| // failed. |
| 1: Load(fuchsia.mem.Buffer payload, Options options) -> (Status status, Player? player); |
| }; |