Function freya::hooks::use_animation_transition
source · pub fn use_animation_transition<D>(
cx: &ScopeState,
transition: TransitionAnimation,
dependencies: D,
init: impl Fn(<D as UseFutureDep>::Out) -> Vec<Transition>
) -> TransitionsManager<'_>where
D: UseFutureDep,
Expand description
Run a group of animated transitions.
Usage
fn app(cx: Scope) -> Element {
let animation = use_animation_transition(cx, TransitionAnimation::new_linear(50), (), |_| vec![
Transition::new_size(0.0, 100.0)
]);
let progress = animation.get(0).unwrap().as_size();
use_memo(cx, (), move |_| {
animation.start();
});
render!(
rect {
width: "{progress}",
}
)
}