# dioxus-spring
[](https://github.com/dioxus-community/dioxus-spring#license)
[](https://crates.io/crates/dioxus-spring)
[](https://docs.rs/dioxus-spring/latest/dioxus_spring/)
[](https://github.com/dioxus-community/dioxus-spring/actions)
Animation library for [Dioxus](https://dioxuslabs.com).
Pairs great with [dioxus-use-gesture](https://github.com/dioxus-community/dioxus-use-gesture)!
```rust
let container_ref = use_mounted();
let rect = use_size(container_ref);
if is_big() { rect.width() as f32 } else { 0f32 },
Duration::from_millis(500),
);
let animated_ref = use_mounted();
r"
width: {width}px;
height: 100%;
position: absolute;
top: 0;
left: 0;
background: #27ae60;
"
)
});
rsx!(
div {
position: "relative",
width: "200px",
height: "50px",
border: "2px solid #eee",
onmounted: move |event| container_ref.onmounted(event),
onclick: move |_| is_big.set(!is_big()),
div { onmounted: move |event| animated_ref.onmounted(event) }
span {
position: "absolute",
top: "50%",
left: "50%",
transform: " translate(-50%, -50%)",
z_index: 9,
"Click me!"
}
}
)
```