dioxus-use-gesture

Crates.iodioxus-use-gesture
lib.rsdioxus-use-gesture
version0.2.0-alpha.1
sourcesrc
created_at2023-10-16 00:06:52.871985
updated_at2024-10-27 21:47:54.382445
descriptionGesture interaction library for Dioxus
homepage
repository
max_upload_size
id1004189
size77,653
Marc Espin (marc2332)

documentation

README

Dioxus use_gesture

Crates.io version docs.rs docs CI status
Examples

Gesture interaction library for Dioxus.

Pairs great with dioxus-spring!

let element_ref = use_signal(cx, || None);

let (spring_ref, value_ref) = use_spring_signal(cx, [0f32, 0f32]);
use_animated(cx, element_ref, value_ref, |[x, y]| {
    format!("width: 200px; height: 200px; background: red; transform: translate({x}px, {y}px);")
});

use_drag(cx, element_ref, move |state, x, y| match state {
    DragState::Move => spring_ref.set([x, y]),
    DragState::End => spring_ref.animate([0., 0.], Duration::from_millis(500)),
});

render!(div {
    onmounted: move |event| element_ref.set(Some(event.data.clone()))
})
Commit count: 0

cargo fmt