rive_rs/animation/
animation_state.rs

1// Copyright 2021 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5use crate::animation::LayerState;
6use crate::core::{Core, ObjectRef, OnAdded, Property};
7
8#[derive(Debug, Default)]
9pub struct AnimationState {
10    layer_state: LayerState,
11    animation_id: Property<u64>,
12}
13
14impl ObjectRef<'_, AnimationState> {
15    pub fn animation_id(&self) -> u64 {
16        self.animation_id.get()
17    }
18
19    pub fn set_animation_id(&self, animation_id: u64) {
20        self.animation_id.set(animation_id);
21    }
22}
23
24impl Core for AnimationState {
25    parent_types![(layer_state, LayerState)];
26
27    properties![(149, animation_id, set_animation_id), layer_state];
28}
29
30impl OnAdded for ObjectRef<'_, AnimationState> {
31    on_added!(LayerState);
32}