Struct dioxus_spring::UseSpringStyle
source · pub struct UseSpringStyle<V> { /* private fields */ }Implementations§
source§impl<V> UseSpringStyle<V>
impl<V> UseSpringStyle<V>
sourcepub fn mount(&self, data: Rc<MountedData>)
pub fn mount(&self, data: Rc<MountedData>)
Examples found in repository?
examples/app.rs (line 13)
6 7 8 9 10 11 12 13 14 15 16 17 18 19
fn app(cx: Scope) -> Element {
let spring_ref = use_spring_style(cx, 1f32, |scale| {
format!("transform-origin: top left; transform: scale({scale});")
});
render!(
h1 {
onmounted: move |event| spring_ref.mount(event.data),
onmouseenter: move |_| spring_ref.animate(2., Duration::from_secs(1)),
onmouseleave: move |_| spring_ref.animate(1., Duration::from_secs(1)),
"Hover me!"
}
)
}pub fn set(&self, to: V)
sourcepub fn animate(&self, to: V, duration: Duration)
pub fn animate(&self, to: V, duration: Duration)
Examples found in repository?
examples/app.rs (line 14)
6 7 8 9 10 11 12 13 14 15 16 17 18 19
fn app(cx: Scope) -> Element {
let spring_ref = use_spring_style(cx, 1f32, |scale| {
format!("transform-origin: top left; transform: scale({scale});")
});
render!(
h1 {
onmounted: move |event| spring_ref.mount(event.data),
onmouseenter: move |_| spring_ref.animate(2., Duration::from_secs(1)),
onmouseleave: move |_| spring_ref.animate(1., Duration::from_secs(1)),
"Hover me!"
}
)
}Trait Implementations§
Auto Trait Implementations§
impl<V> !RefUnwindSafe for UseSpringStyle<V>
impl<V> !Send for UseSpringStyle<V>
impl<V> !Sync for UseSpringStyle<V>
impl<V> Unpin for UseSpringStyle<V>
impl<V> !UnwindSafe for UseSpringStyle<V>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more