Repository navigation
Animation Descriptors
An AnimationDescriptor is an animation as plain data: where a value starts and ends, when, and by which curve. Nothing is stepped. The value and the velocity at any time are computed from the descriptor, so reading one never depends on a tick having run, and a frame that stalls skips ahead the way a CSS animation does.
use blinc::animation::{AnimationDescriptor, Easing};
use blinc::animation::descriptor::now_ms;
// Start now, run 300 ms, from 0 to 100, easing out.
let start = now_ms();
let d = AnimationDescriptor::timed(start, 300.0, 0.0, 100.0, Easing::EaseOut.to_curve());
let value = d.evaluate(start + 120.0);
let velocity = d.velocity(start + 120.0); // units per second
let done = d.is_finished(start + 400.0);Times are milliseconds on the frame clock's scale, which now_ms() reads. Before it starts a descriptor holds from, and once it has ended it holds to.
| Curve | Meaning |
|---|---|
Curve::Linear |
progress as time |
Curve::CubicBezier(x1, y1, x2, y2) |
a CSS cubic-bezier()
|
Curve::Steps(n, jump) |
a CSS steps(), with StepJump::{Start, End, None, Both}
|
Curve::Power(n, mode) |
t^n in, out or in-out: the quad, cubic and quart easings |
Curve::Spring { stiffness, damping, mass } |
a damped spring in closed form |
Easing::to_curve gives the curve an easing is, exactly.
use blinc::animation::{AnimationDescriptor, SpringConfig};
// From 0 towards 100, leaving at 30 units per second.
let d = AnimationDescriptor::spring(start, 0.0, 100.0, 30.0, SpringConfig::wobbly());A spring's duration is when it has settled: within a thousandth of the distance it moved, so it does not depend on the units the value is in. Spring::to_descriptor describes the motion a spring is in, and AnimatedValue::descriptor the motion of an animated value, or None when it is at rest.
retarget(now, new_to) aims the animation somewhere else from the current value. A spring keeps its velocity. A timed animation starts again from the current value over the full duration with no velocity, as a CSS transition does when its target changes.
let d = d.retarget(now_ms(), 40.0);The existing Spring, AnimatedValue and keyframe types work as before.
Getting Started
Migrating
Mobile Development
Example Gallery
- Example Gallery
- Canvas Element
- Canvas Kit Interactive
- Carousel Demo - Selector API Showcase
- Chrome-Style Tabs
- blinc_cn Components
- Run with
cargo run -p blinc_app_examples --features cn --example cn_pickers_demo. - Code Element
- Complex SVG
- CSS Debug
- CSS Visual Features
- Layer Effects
- Emoji and HTML Entities
- @flow Shader
- Fluid Surface
- Skeleton animation with glTF +
blinc_canvas_kit. - Gpu Pass Demo
- Image CSS Styling
- Image Layer Test
- Keyframe Animation Canvas
- Markdown Editor
- 3D Mesh Demo — renders the Khronos glTF
DamagedHelmetsample model - Motion Demo
- Music Player Glass Card
- Node-editor demo — pre-wired graph with three node types, typed
- Notch Menu Bar
- Overflow Fade
- Overlay System
- Pointer Query
- Rich Text Element
- Rich Text Editor
- Scroll Container
- Semantic @flow
- Sortable
- Stateful API + Signal-bound modifiers demo.
- End-to-end 3D demo wiring Blinc's SceneKit3D renderer up to
- Unified Styling API
- SVG Animation
- Table Builder
- Tabler Icons
- Minimal text positioning test
- Text Input Widgets
- KHR_texture_transform
- Theme System
- Timeline Animation
- Typography
- Wet Glass
- Windowed Application
Web Development
Core Concepts
- Elements & Layout
- Styling & Materials
- CSS Styling
- Theming
- Event Handling
- Accessibility
- State Management
- Lists & Conditional Content
- Element Refs
Animation
Components
Component Library (blinc_cn)
- Overview
- Button
- Card
- Icons
- Typography
- Dialog
- Form Components
- Date, Time and Colour Pickers
- Rich Text Editor
- Code Editor
- Navigation
- Feedback
- Layout
- Data Display
Widgets
- Buttons & Inputs
- Text & Rich Text
- Code Editor
- Scroll Containers
- Virtualized List
- Canvas Drawing
- Gestures
- Notched Surfaces
- Images & SVG
- Audio & Video
- Markdown Rendering
Canvas Kit
Advanced
- Routing & Navigation
- Multi-Window
- System Integration
- Element Query API
- Overlay System
- Custom State Machines
- Pointer Query
- Performance Tips
- Flow Shaders
- 3D Rendering
- Custom GPU Passes
- Hot reloading
Architecture
Contributing