FixedPointEffect
Source:
FixedPointEffect.h
FixedPointEffect¶
src/light/effects/FixedPointEffect.h:22Inherits:
EffectBase
Effect: sub-pixel shapes, drawn between pixels so small panels move smoothly.
Author: concept and the original fixed-point canvas demos by Sutaburosu, in FastLED, via MoonLight.
Public Attributes¶
uint8_t demo = kAll
: Which demonstration is showing.
uint8_t bpm = 20
: How fast the whole scene runs, in BPM like every other effect here.
uint8_t fade = 70
: How much of the previous frame survives, which is what leaves the trail.
uint8_t dwell = 12
: Seconds each demo holds before all moves to the next.
uint8_t drift = 2
: How far the scene drifts from the panel's center, in pixels; 0 pins it.
uint8_t zoom = 150
: The camera, which pushes in and settles back on a cycle; 0 holds it still.
Public Methods¶
virtual inline const char * tags() const override
: The catalog tags shown on this effect's card.
virtual inline Dim dimensions() const override
: This effect draws in two dimensions.
virtual inline void defineControls() override
: Bind the demo selector, the rate, the trail, the dwell, the drift and the camera.
virtual inline void prepare() override
: Clear the shared trail, so a demo change never joins two unrelated figures.
virtual inline void tick() override
: The hot tick, which by default ticks every enabled child and times each.
Public Static Attributes¶
constexpr const char * kDemoNames = {
"all", "clock", "orbits", "star web", "spirograph", "lissajous",
"cube thin", "cube thick", "walkers", "boids", "hypotrochoid", "tree"}
constexpr uint8_t kCycled = kDemoCount - 1
: How many demos all rotates through.
Public Types¶
enum
: Which demonstration, or all to cycle them.
| Value | Description |
|---|---|
kAll |
|
kClock |
|
kOrbits |
|
kStarWeb |
|
kSpirograph |
|
kLissajous |
|
kCubeThin |
|
kCubeThick |
|
kWalkers |
|
kBoids |
|
kHypotrochoid |
|
kTree |
|
kDemoCount |
More info¶
The point is the technique, not the picture¶
On a 16x16 panel a clock hand drawn on whole pixels jumps a full pixel at a time and reads as broken. The same hand placed at a fractional position and antialiased moves smoothly, because a pixel's brightness carries the fraction its position cannot. Everything here is built from that one idea, so a small matrix gets motion a whole-pixel renderer cannot express at any frame rate.
The shapes come from the sub-pixel family in draw.h, disc, ring, strokeLine and line, which work in the 24.8 pos_t the whole draw layer speaks. Nothing here computes coverage itself.