blob: 2dda694ecc647a219be905f9a90700481e40ec17 [file] [log] [blame]
// 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.
protocol Player {
// Seek to position `t` where 0 <= t <= 1.
Seek(float32 t);
// Play and stop at `t` = 1 if `loop` = false.
Play();
// Pause player.
Pause();
};
[Discoverable]
// Skottie loader exported by `ViewProvider` to load skottie JSON animations
// into views created from it.
protocol 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.
Load(fuchsia.mem.Buffer payload, Options options) -> (Status status, Player? player);
};