pub struct Motion { /* private fields */ }Expand description
How a node animates. Attach it with BuildCx::motion.
use ravenrs_animation::Transition;
use ravenrs_core::Effect;
use ravenrs_widgets::Motion;
// Colors ease on hover; the node pops in and fades out.
let motion = Motion::new()
.paint(Transition::fast())
.enter(Effect::hidden().with_scale(0.96), Transition::snappy())
.exit(Effect::hidden(), Transition::fast());Implementations§
Source§impl Motion
impl Motion
Sourcepub const fn paint(self, transition: Transition) -> Motion
pub const fn paint(self, transition: Transition) -> Motion
Eases this node’s own fill, border, shadow, corner radius and text color
whenever a build changes them, like CSS transition. Colors travel
through OKLab. Gradients and Paint::Custom change at once.
Sourcepub const fn layout(self, transition: Transition) -> Motion
pub const fn layout(self, transition: Transition) -> Motion
Glides the node from its old frame to its new one when layout moves it. Its children travel with it. Input keeps using the final frame.
Makes this node the same visual object as the node of a previous build
with the same scope and tag, wherever it is now: a selection marker
that slides from the old tab to the new one. scope is usually the
widget id of the common parent.
Sourcepub const fn surface_exit(self) -> Motion
pub const fn surface_exit(self) -> Motion
The exit fades this node as one surface: its content goes first, over the still solid panel, and then the panel. Opacity applies to each shape on its own, so fading all at once would show the panel through its fields, in a gray like metal. The panel must be the first thing the node paints.
Sourcepub const fn shape_only(self) -> Motion
pub const fn shape_only(self) -> Motion
With Self::layout, moves only the node’s own shape. Its children stay
where layout put them.
Sourcepub const fn underlay(self) -> Motion
pub const fn underlay(self) -> Motion
Paints the node’s own shape behind all its siblings, so a moving marker slides under the labels it crosses. The node must be a direct child of the container holding those siblings.
Sourcepub const fn effect(self, effect: Effect, transition: Transition) -> Motion
pub const fn effect(self, effect: Effect, transition: Transition) -> Motion
Eases the node and its subtree to this effect, such as a slight shrink while pressed. Layout and hit testing are unaffected.
Sourcepub const fn enter(self, from: Effect, transition: Transition) -> Motion
pub const fn enter(self, from: Effect, transition: Transition) -> Motion
When the node first appears, it starts from this effect.
Sourcepub const fn exit(self, to: Effect, transition: Transition) -> Motion
pub const fn exit(self, to: Effect, transition: Transition) -> Motion
When the node stops being built, its last picture stays on screen and plays this effect. The picture takes no input and is hidden from assistive technology: for the app, the node is already gone. Reopening during the exit reverses it from where it is.