docs.rs failed to build hikari-animation-0.1.2
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
hikari-animation
High-performance, declarative animation system for Dioxus with dynamic values, complex timelines, and smooth transitions.
Installation
[]
= "0.1.0"
Note: This crate is designed for WASM targets only (target_arch = "wasm32").
Quick Start
use ;
use CssProperty;
// Static animation
new
.add_style
.apply_with_transition;
// Dynamic animation (mouse following)
new
.add_style_dynamic
.apply_with_transition;
Glow Component
The Glow component provides a mouse-following glow effect with component-isolated design:
Component-Isolated Features
- ✅ No Global Side Effects: Does not use
MutationObserverto monitor global DOM - ✅ Reactive State: Uses Dioxus hooks (
use_node_ref,use_effect) - ✅ Automatic Cleanup: Dioxus automatically handles cleanup on unmount
- ✅ High Performance: Direct CSS variable updates without re-render
Usage
use *;
use Glow;
rsx!
Props
color: String- Glow color (default:"rgba(255, 255, 255, 0.3)")intensity: f64- Glow intensity (default:0.3)children: Element- Child elements
Performance Characteristics
- Each component independently manages state, no interference between components
- Zero Re-render on Mouse Move: CSS variables are updated directly via DOM API
- Percentage-based Positioning: Mouse position is calculated as percentage relative to element
- CSS Hover for Visibility: Glow shows/hides via CSS
:hoverpseudo-class, no JavaScript needed
Internal Implementation
The Glow component uses:
use_node_reffor direct DOM accessuse_effectto initialize CSS variables on mountonmousemovehandler for mouse tracking withgetBoundingClientRect()- Direct CSS variable updates via
element.set_attribute("style", ...) - CSS variables (
--glow-x,--glow-y,--glow-color,--glow-intensity) for dynamic updates
Documentation
For complete API documentation, easing functions, and performance tips, see docs.rs
Features
- Type-Safe CSS - Compile-time checked CSS properties
- Dynamic Value Computation - Calculate animation values at runtime from context
- Multi-Element Control - Animate multiple DOM elements simultaneously
- Debounced Updates - Throttle animation updates for performance
- 30+ Easing Functions - Natural motion with ease-in-out, bounce, elastic, and more
- Timeline Control - Sequence and coordinate complex animations
- Mouse Spotlight Effects - Create interactive mouse-following animations
- Component-Isolated Glow - Glow component with no global side effects
License
MIT OR Apache-2.0