Function freya_hooks::use_animation_transition
source · pub fn use_animation_transition<D>(
transition: TransitionAnimation,
dependencies: D,
init: impl Fn(D::Out) -> Vec<Transition> + 'static
) -> TransitionsManagerwhere
D: Dependency + 'static,
Expand description
Run a group of animated transitions.
Usage
fn app() -> Element {
let mut animation = use_animation_transition(TransitionAnimation::new_linear(50), (), |_| vec![
Transition::new_size(0.0, 100.0)
]);
let progress = animation.get(0).unwrap().as_size();
use_hook(move || {
animation.start();
});
rsx!(
rect {
width: "{progress}",
}
)
}