Skip to content

dioxus-community/dioxus-use-gesture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dioxus use_gesture

Crates.io version docs.rs docs CI status

Gesture interaction library for Dioxus.

Pairs great with dioxus-spring!

let element_ref = use_mounted();

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

use_drag(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)),
});

rsx!(div {
    onmounted: move |event| element_ref.onmounted(event)
})

About

No description, website, or topics provided.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages