Expand description
RGB LED ring effects and animations.
This crate provides reusable animation effects for circular LED rings.
It is no_std compatible for embedded use.
All effects implement the Effect trait, which provides a uniform
interface for rendering animations into an RGB8 buffer.
§Available Effects
RainbowEffect— smooth rainbow gradient rotationPulseEffect— heartbeat animation: sine-wave brightness with a pause at the floorBreatheEffect— breathing animation: symmetric full-sine brightness with no pauseSpinnerEffect— rotating dot with fading tail (linear decay, brightness floor)MeteorEffect— meteor / comet: bright head with exponentially-decaying tailTwinkleEffect— ambient sparkle: random LEDs flash to peak brightness then decayFireEffect— fire simulation: heat diffuses upward from a sparking baseCylonEffect— Cylon / bouncing scanner: bright head sweeps back and forth with fading tailKnightRiderEffect— Knight Rider / dual-headed scanner: two heads sweep in opposite directionsChaseEffect— moving a solid segment around the ringFlashEffect— rapid on/off toggle with configurable duty cycleProgressEffect— proportional ring fillSectionEffect— weighted color sections on a ringRainbowCometEffect— Rainbow comet: orbiting head with a hue-cycling fading tail
§Utilities
ColorPalette— three-color theme for effectsfill_solid— fill a buffer with a single colorsine_wave— half-wave rectified sine lookup (0→255→0 then plateau at 0)sine_full— full symmetric sine lookup (0→255→0, no plateau)scale_brightness— scale an RGB color’s brightnesslerp_color— linearly interpolate between two colors
§Color type
All effects operate on RGB8, re-exported here from the rgb crate.
Downstream crates do not need a direct rgb dependency — use ferriswheel::RGB8
is sufficient.
§Example
use ferriswheel::{Effect, RainbowEffect, Direction, RGB8};
let mut rainbow = RainbowEffect::new(12).unwrap();
let mut buffer = [RGB8::default(); 12];
// Fill the buffer with rainbow colors and advance animation
rainbow.update(&mut buffer).unwrap();
// Use as a trait object
let effect: &dyn Effect = &rainbow;
effect.current(&mut buffer).unwrap();Structs§
- Breathe
Effect - A smooth breathing animation effect.
- Chase
Effect - A chase effect where a solid segment moves around the ring.
- Color
Palette - A three-color theme palette.
- Cylon
Effect - A Cylon / bouncing scanner effect.
- Fire
Effect - A fire / flame animation effect.
- Flash
Effect - A flash effect that toggles all LEDs between two colors.
- Knight
Rider Effect - A Knight Rider / dual-headed scanner effect.
- Meteor
Effect - A meteor / comet effect with an exponentially-decaying tail.
- Progress
Effect - A progress indicator effect that fills the ring proportionally.
- Pulse
Effect - A breathing/pulsing animation effect.
- Rainbow
Comet Effect - A rainbow comet effect with a hue-cycling fading tail.
- Rainbow
Effect - A rainbow animation effect for LED rings.
- Section
Effect - An effect that divides the ring into weighted color sections.
- Spinner
Effect - A rotating spinner effect with a fading tail.
- Twinkle
Effect - An ambient twinkle / sparkle effect.
Enums§
- Direction
- Direction of animation rotation.
- Effect
Error - Error type for effect configuration and operations.
Constants§
- MAX_
LEDS - Maximum supported number of LEDs in a ring.
- MAX_
SECTIONS - Maximum number of sections supported by
SectionEffect.
Traits§
- Effect
- A reusable LED ring effect.
Functions§
- fill_
solid - Fills all elements of
bufferwith the given color. - hsv_
to_ rgb - Converts HSV color values to RGB.
- lerp_
color - Linearly interpolates between two colors.
- scale_
brightness - Scales a single color channel by a brightness factor (0–255).
- sine_
full - Returns a full symmetric sine-wave value for the given phase.
- sine_
wave - Returns a sine-wave value for the given phase.
Type Aliases§
- RGB8
- 8-bit RGB