gioser

tawasuyu/llimphi

Sovereign retained-mode GPU UI framework in Rust (wgpu+vello+taffy+parley), Elm loop, 40+ widgets.

Rust 229TOML 101Markdown 82Shell 24052 Definiciones

⎇ main shared/foreign-lottie/src/schema/layers/visual.rs Rust · 85 líneas · 3.2 KB Historia Quién tocó qué crudo

chore: refresco desde el monorepo — 27 crates nuevos (anim, lottie, svg, mesh, image, layer, test, wire-view, widgets rag-sidebar/router/lazy-list/rive-button) y sync de los 95 existentes 93253cc22 · Sergio ·

1// Copyright 2024 the Velato Authors
2// SPDX-License-Identifier: Apache-2.0 OR MIT
3
4use crate::schema::constants::matte_mode::MatteMode;
5use crate::schema::helpers::int_boolean::BoolInt;
6use crate::schema::helpers::mask::Mask;
7use crate::schema::helpers::transform::Transform;
8use crate::schema::{constants::blend_mode::BlendMode, layers::layer::Layer};
9use serde::{Deserialize, Serialize};
10
11/// Common properties between layers
12#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
13pub struct VisualLayer {
14    /// layer data
15    #[serde(flatten)]
16    pub layer: Layer,
17
18    /// Matte mode
19    #[serde(rename = "tt")]
20    #[serde(skip_serializing_if = "Option::is_none")]
21    pub matte_mode: Option<MatteMode>,
22    /// Matte target
23    #[serde(rename = "td", default)]
24    #[serde(skip_serializing_if = "Option::is_none")]
25    pub matte_target: Option<BoolInt>,
26    /// Masks for the layer
27    #[serde(rename = "masksProperties")]
28    #[serde(skip_serializing_if = "Option::is_none")]
29    pub masks_properties: Option<Vec<Mask>>,
30
31    // TODO:
32    /// Effects for the layer
33    //#[serde(rename = "ef")]
34    //#[serde(skip_serializing_if = "Option::is_none")]
35    //pub effects: Option<Vec<()>>,
36    /// Layer styles
37    //#[serde(rename = "sy")]
38    //#[serde(skip_serializing_if = "Option::is_none")]
39    //pub styles: Option<Vec<()>>,
40    /// Layer transform
41    #[serde(rename = "ks")]
42    pub transform: Transform,
43    /// If 1, The layer will rotate itself to match its animated position path
44    #[serde(rename = "ao", default)]
45    #[serde(skip_serializing_if = "Option::is_none")]
46    pub rotate_to_match_anim_pos_path: Option<BoolInt>,
47    /// Index of the layer used as matte, if omitted assume the layer above the
48    /// current one
49    #[serde(rename = "tp")]
50    #[serde(skip_serializing_if = "Option::is_none")]
51    pub matte_layer_index: Option<f64>,
52    /// Whether the layer has masks applied
53    #[serde(rename = "hasMask", default)]
54    #[serde(skip_serializing_if = "Option::is_none")]
55    pub has_mask: Option<bool>,
56    /// Whether motion blur is enabled for the layer
57    #[serde(rename = "mb", default)]
58    #[serde(skip_serializing_if = "Option::is_none")]
59    pub motion_blur: Option<bool>,
60    /// Blend Mode
61    #[serde(rename = "bm")]
62    #[serde(skip_serializing_if = "Option::is_none")]
63    pub blend_mode: Option<BlendMode>,
64    /// CSS class used by the SVG renderer
65    #[serde(rename = "cl")]
66    #[serde(skip_serializing_if = "Option::is_none")]
67    pub css_class: Option<String>,
68    /// id attribute used by the SVG renderer
69    #[serde(rename = "ln")]
70    #[serde(skip_serializing_if = "Option::is_none")]
71    pub id: Option<String>,
72    /// Tag name used by the SVG renderer
73    #[serde(rename = "tg")]
74    #[serde(skip_serializing_if = "Option::is_none")]
75    pub tag_name: Option<String>,
76    /// This is deprecated in favour of `transform_before_mask`
77    #[deprecated(note = "please use `transform_before_mask` instead")]
78    #[serde(rename = "cp")]
79    #[serde(skip_serializing_if = "Option::is_none")]
80    pub tranform_before_mask_deprecated: Option<String>,
81    /// Marks that transforms should be applied before masks
82    #[serde(rename = "ct", default)]
83    #[serde(skip_serializing_if = "Option::is_none")]
84    pub transform_before_mask: Option<BoolInt>,
85}