cosmic_time/keyframes/helpers.rs
1use crate::keyframes::{Button, Column, Container, Row, Space, StyleButton, StyleContainer};
2use crate::MovementType;
3
4/// Create a button keyframe.
5/// Needs to be added into a chain. See [`crate::chain!`] macro.
6pub fn button(at: impl Into<MovementType>) -> Button {
7 Button::new(at)
8}
9
10/// Create a column keyframe.
11/// Needs to be added into a chain. See [`crate::chain!`] macro.
12pub fn column(at: impl Into<MovementType>) -> Column {
13 Column::new(at)
14}
15
16/// Create a container keyframe.
17/// Needs to be added into a chain. See [`crate::chain!`] macro.
18pub fn container(at: impl Into<MovementType>) -> Container {
19 Container::new(at)
20}
21
22/// Create a row keyframe.
23/// Needs to be added into a chain. See [`crate::chain!`] macro.
24pub fn row(at: impl Into<MovementType>) -> Row {
25 Row::new(at)
26}
27
28/// Create a space keyframe.
29/// Needs to be added into a chain. See [`crate::chain!`] macro.
30pub fn space(at: impl Into<MovementType>) -> Space {
31 Space::new(at)
32}
33
34/// Create a style_button keyframe.
35/// Needs to be added into a chain. See [`crate::chain!`] macro.
36pub fn style_button(at: impl Into<MovementType>) -> StyleButton {
37 StyleButton::new(at)
38}
39
40/// Create a style_container keyframe.
41/// Needs to be added into a chain. See [`crate::chain!`] macro.
42pub fn style_container(at: impl Into<MovementType>) -> StyleContainer {
43 StyleContainer::new(at)
44}
45
46/// A slightly different import to clean up makeing lazy keyframes.
47pub mod lazy {
48 use crate::keyframes::{Button, Column, Container, Row, Space, StyleButton, StyleContainer};
49 use crate::MovementType;
50
51 /// Create a lazy button keyframe.
52 /// Needs to be added into a chain. See [`crate::chain!`] macro.
53 pub fn button(at: impl Into<MovementType>) -> Button {
54 Button::lazy(at)
55 }
56
57 /// Create a lazy column keyframe.
58 /// Needs to be added into a chain. See [`crate::chain!`] macro.
59 pub fn column(at: impl Into<MovementType>) -> Column {
60 Column::lazy(at)
61 }
62
63 /// Create a lazy container keyframe.
64 /// Needs to be added into a chain. See [`crate::chain!`] macro.
65 pub fn container(at: impl Into<MovementType>) -> Container {
66 Container::lazy(at)
67 }
68
69 /// Create a lazy row keyframe.
70 /// Needs to be added into a chain. See [`crate::chain!`] macro.
71 pub fn row(at: impl Into<MovementType>) -> Row {
72 Row::lazy(at)
73 }
74
75 /// Create a lazy space keyframe.
76 /// Needs to be added into a chain. See [`crate::chain!`] macro.
77 pub fn space(at: impl Into<MovementType>) -> Space {
78 Space::lazy(at)
79 }
80
81 /// Create a lazy style_button keyframe.
82 /// Needs to be added into a chain. See [`crate::chain!`] macro.
83 pub fn style_button(at: impl Into<MovementType>) -> StyleButton {
84 StyleButton::lazy(at)
85 }
86
87 /// Create a lazy style_container keyframe.
88 /// Needs to be added into a chain. See [`crate::chain!`] macro.
89 pub fn style_container(at: impl Into<MovementType>) -> StyleContainer {
90 StyleContainer::lazy(at)
91 }
92}
93
94/// A slightly different import to clean up makeing animation Ids.
95pub mod id {
96 pub use crate::keyframes::{
97 button::Id as Button, column::Id as Column, container::Id as Container, row::Id as Row,
98 space::Id as Space, style_button::Id as StyleButton, style_container::Id as StyleContainer,
99 };
100}