Skip to main content

Crate ferriswheel

Crate ferriswheel 

Source
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 rotation
  • PulseEffect — heartbeat animation: sine-wave brightness with a pause at the floor
  • BreatheEffect — breathing animation: symmetric full-sine brightness with no pause
  • SpinnerEffect — rotating dot with fading tail (linear decay, brightness floor)
  • MeteorEffect — meteor / comet: bright head with exponentially-decaying tail
  • TwinkleEffect — ambient sparkle: random LEDs flash to peak brightness then decay
  • FireEffect — fire simulation: heat diffuses upward from a sparking base
  • CylonEffect — Cylon / bouncing scanner: bright head sweeps back and forth with fading tail
  • KnightRiderEffect — Knight Rider / dual-headed scanner: two heads sweep in opposite directions
  • ChaseEffect — moving a solid segment around the ring
  • FlashEffect — rapid on/off toggle with configurable duty cycle
  • ProgressEffect — proportional ring fill
  • SectionEffect — weighted color sections on a ring
  • RainbowCometEffect — Rainbow comet: orbiting head with a hue-cycling fading tail

§Utilities

  • ColorPalette — three-color theme for effects
  • fill_solid — fill a buffer with a single color
  • sine_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 brightness
  • lerp_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§

BreatheEffect
A smooth breathing animation effect.
ChaseEffect
A chase effect where a solid segment moves around the ring.
ColorPalette
A three-color theme palette.
CylonEffect
A Cylon / bouncing scanner effect.
FireEffect
A fire / flame animation effect.
FlashEffect
A flash effect that toggles all LEDs between two colors.
KnightRiderEffect
A Knight Rider / dual-headed scanner effect.
MeteorEffect
A meteor / comet effect with an exponentially-decaying tail.
ProgressEffect
A progress indicator effect that fills the ring proportionally.
PulseEffect
A breathing/pulsing animation effect.
RainbowCometEffect
A rainbow comet effect with a hue-cycling fading tail.
RainbowEffect
A rainbow animation effect for LED rings.
SectionEffect
An effect that divides the ring into weighted color sections.
SpinnerEffect
A rotating spinner effect with a fading tail.
TwinkleEffect
An ambient twinkle / sparkle effect.

Enums§

Direction
Direction of animation rotation.
EffectError
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 buffer with 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