tawasuyu/llimphi
Sovereign retained-mode GPU UI framework in Rust (wgpu+vello+taffy+parley), Elm loop, 40+ widgets.
⎇ main
shared/foreign-lottie/src/schema/animated_properties/position.rs
Historia
Quién tocó qué
crudo
1// Copyright 2024 the Velato Authors
2// SPDX-License-Identifier: Apache-2.0 OR MIT
3
4use super::position_keyframe::PositionKeyframe;
5use crate::schema::helpers::int_boolean::BoolInt;
6use serde::{Deserialize, Serialize};
7
8/// An animatable property to represent a position in space
9#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
10pub struct Position {
11 /// The index of the property.
12 #[serde(rename = "ix")]
13 #[serde(skip_serializing_if = "Option::is_none")]
14 pub property_index: Option<f64>,
15 /// Whether the property is animated
16 #[serde(rename = "a")]
17 pub animated: Option<BoolInt>,
18 /// The expression for the property.
19 #[serde(rename = "x")]
20 #[serde(skip_serializing_if = "Option::is_none")]
21 pub expression: Option<String>,
22 /// Number of components in the value arrays.
23 /// If present, values will be truncated or expanded to match this length
24 /// when accessed from expressions.
25 #[serde(rename = "l")]
26 #[serde(skip_serializing_if = "Option::is_none")]
27 pub length: Option<f64>,
28 /// The value variant (Animated or Static).
29 #[serde(rename = "k")]
30 pub value: PositionValueK,
31}
32
33/// The possible values of "k" in a [`Position`].
34#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
35#[serde(untagged)]
36pub enum PositionValueK {
37 Animated(Vec<PositionKeyframe>),
38 Static(Vec<f64>),
39}