rive_rs/animation/
state_machine_double.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::StateMachineInput;
6use crate::core::{Core, ObjectRef, OnAdded, Property};
7
8#[derive(Debug, Default)]
9pub struct StateMachineDouble {
10    state_machine_input: StateMachineInput,
11    value: Property<f32>,
12}
13
14impl ObjectRef<'_, StateMachineDouble> {
15    pub fn value(&self) -> f32 {
16        self.value.get()
17    }
18
19    pub fn set_value(&self, value: f32) {
20        self.value.set(value);
21    }
22}
23
24impl Core for StateMachineDouble {
25    parent_types![(state_machine_input, StateMachineInput)];
26
27    properties![(140, value, set_value), state_machine_input];
28}
29
30impl OnAdded for ObjectRef<'_, StateMachineDouble> {
31    on_added!(StateMachineInput);
32}