Repository navigation
Expand file tree
/
Copy pathanimated_sprite2d.rs
More file actions
81 lines (78 loc) · 2.35 KB
/
Copy pathanimated_sprite2d.rs
File metadata and controls
81 lines (78 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// SPDX-License-Identifier: MIT OR Apache-2.0
//! AnimatedSprite2D: plays 2D flipbook animations from a spritesheet atlas.
use crate::schema::{DefaultPropVal, NodeTypeSchema, PropHint, PropSchema};
pub static SCHEMA: NodeTypeSchema = NodeTypeSchema {
type_name: "AnimatedSprite2D",
description: "Plays 2D flipbook animations from a spritesheet atlas.",
inherits: Some("Node2D"),
abstract_class: false,
props: PROPS,
};
pub static PROPS: &[PropSchema] = &[
PropSchema {
key: "atlas",
label: "Atlas",
doc: "Path to a spritesheet sidecar (`.ptatlas`).",
default_value: DefaultPropVal::Str(""),
hint: PropHint::Asset {
filter: &["ptatlas"],
},
read_only: false,
},
PropSchema {
key: "animation",
label: "Animation",
doc: "Named animation sequence inside the atlas.",
default_value: DefaultPropVal::Str(""),
hint: PropHint::Text,
read_only: false,
},
PropSchema {
key: "frame",
label: "Frame",
doc: "Current frame index of the playing animation.",
default_value: DefaultPropVal::Int(0),
hint: PropHint::Int {
speed: 1.0,
min: 0,
max: 9999,
},
read_only: false,
},
PropSchema {
key: "speed_scale",
label: "Speed Scale",
doc: "Playback speed multiplier for the animation.",
default_value: DefaultPropVal::Num(1.0),
hint: PropHint::Num {
speed: 0.1,
min: -100.0,
max: 100.0,
},
read_only: false,
},
PropSchema {
key: "playing",
label: "Playing",
doc: "Whether the animation is currently playing.",
default_value: DefaultPropVal::Bool(false),
hint: PropHint::Bool,
read_only: false,
},
PropSchema {
key: "autoplay",
label: "Autoplay",
doc: "Animation name to begin playing automatically on ready.",
default_value: DefaultPropVal::Str(""),
hint: PropHint::Text,
read_only: false,
},
PropSchema {
key: "modulate",
label: "Modulate",
doc: "RGBA color multiplier applied to the sprite.",
default_value: DefaultPropVal::Color([255, 255, 255, 255]),
hint: PropHint::Color,
read_only: false,
},
];