| Crates.io | blinc_animation |
| lib.rs | blinc_animation |
| version | 0.1.12 |
| created_at | 2026-01-14 17:21:38.481499+00 |
| updated_at | 2026-01-19 01:05:15.136753+00 |
| description | Blinc animation system - spring physics, keyframes, and timeline orchestration |
| homepage | |
| repository | https://github.com/project-blinc/Blinc |
| max_upload_size | |
| id | 2043282 |
| size | 148,230 |
Part of the Blinc UI Framework
This crate is a component of Blinc, a GPU-accelerated UI framework for Rust. For full documentation and guides, visit the Blinc documentation.
Animation system for Blinc UI - spring physics, keyframes, and timeline orchestration.
blinc_animation provides a powerful animation system with spring physics, keyframe animations, and timeline orchestration. All animations are interruptible and preserve velocity when interrupted.
use blinc_animation::{Spring, SpringConfig};
// Create a spring
let spring = Spring::new(SpringConfig {
stiffness: 300.0,
damping: 20.0,
mass: 1.0,
});
// Animate to target
spring.animate_to(100.0);
// Update each frame
let value = spring.update(delta_time);
SpringConfig::gentle() // Slow, gentle movement
SpringConfig::default() // Balanced default
SpringConfig::bouncy() // Playful bounce
SpringConfig::stiff() // Quick, snappy
use blinc_animation::{KeyframeAnimation, Keyframe, Easing};
let animation = KeyframeAnimation::new()
.keyframe(Keyframe::new(0.0, 0.0))
.keyframe(Keyframe::new(0.5, 100.0).easing(Easing::EaseOut))
.keyframe(Keyframe::new(1.0, 80.0).easing(Easing::EaseInOut))
.duration(Duration::from_millis(500));
// Update each frame
let value = animation.update(delta_time);
Easing::Linear
Easing::EaseIn
Easing::EaseOut
Easing::EaseInOut
Easing::CubicBezier(0.4, 0.0, 0.2, 1.0)
use blinc_animation::{Timeline, TimelineEntry};
let timeline = Timeline::new()
.add(opacity_animation, Duration::ZERO)
.add(scale_animation, Duration::from_millis(100))
.add(position_animation, Duration::from_millis(200));
// Play/pause/seek
timeline.play();
timeline.pause();
timeline.seek(Duration::from_millis(150));
use blinc_animation::AnimationScheduler;
// Global scheduler manages all active animations
let scheduler = AnimationScheduler::global();
// Schedule an animation
scheduler.schedule(animation);
// Update all animations
scheduler.update(delta_time);
use blinc_animation::AnimatedValue;
struct AnimatedElement {
x: AnimatedValue<f32>,
y: AnimatedValue<f32>,
opacity: AnimatedValue<f32>,
scale: AnimatedValue<f32>,
}
impl AnimatedElement {
fn animate_to(&mut self, x: f32, y: f32) {
self.x.animate_to(x);
self.y.animate_to(y);
}
fn update(&mut self, dt: f32) {
self.x.update(dt);
self.y.update(dt);
self.opacity.update(dt);
self.scale.update(dt);
}
}
use blinc_animation::presets;
// Entry animations
presets::fade_in()
presets::slide_in_left()
presets::slide_in_right()
presets::scale_in()
presets::bounce_in()
// Exit animations
presets::fade_out()
presets::slide_out_left()
presets::slide_out_right()
presets::scale_out()
MIT OR Apache-2.0