HitLib 1.5.0
VEX V5 LED animation library for PROS
Loading...
Searching...
No Matches
hitlib::LedStrand::Speed Struct Reference

How fast a moving animation travels: so many pixels, so often. More...

#include <led_strand.hpp>

Public Member Functions

constexpr Speed (int pixelsPerStep=1, uint16_t ms=0)
 pixelsPerStep pixels every ms milliseconds; with no ms, that many pixels on every refresh tick.

Static Public Member Functions

static constexpr Speed everyMs (uint16_t ms, uint8_t pixelsPerStep=1)
 pixelsPerStep pixels (default one) every ms milliseconds.

Public Attributes

uint8_t pixels
 Pixels moved per step.
uint16_t stepMs
 Milliseconds between steps. 0 steps on every refresh tick.

Detailed Description

How fast a moving animation travels: so many pixels, so often.

A bare number is pixels per refresh tick, which is what speed has always meant, so strand.rainbow(2) is unchanged. A pixel a tick is the fastest-but-one a bare number can say and the slowest it can say, so for anything slower give the time between steps instead:

strand.pulse(0xFF0000, 5, Speed::everyMs(80)); // a pixel every 80 ms
strand.flow(0xFF0000, 0x0000FF, Speed::everyMs(40, 2)); // two pixels every 40 ms
How fast a moving animation travels: so many pixels, so often.
Definition led_strand.hpp:101
constexpr Speed(int pixelsPerStep=1, uint16_t ms=0)
pixelsPerStep pixels every ms milliseconds; with no ms, that many pixels on every refresh tick.
Definition led_strand.hpp:107
static constexpr Speed everyMs(uint16_t ms, uint8_t pixelsPerStep=1)
pixelsPerStep pixels (default one) every ms milliseconds.
Definition led_strand.hpp:111

Like flash()'s durations, stepMs is rounded to whole refresh ticks, so the pace is even: a 100 ms step on a 20 ms strand moves on every fifth tick, never on a mix of fourth and sixth ones.

Constructor & Destructor Documentation

◆ Speed()

hitlib::LedStrand::Speed::Speed ( int pixelsPerStep = 1,
uint16_t ms = 0 )
inlineconstexpr

pixelsPerStep pixels every ms milliseconds; with no ms, that many pixels on every refresh tick.

Member Function Documentation

◆ everyMs()

constexpr Speed hitlib::LedStrand::Speed::everyMs ( uint16_t ms,
uint8_t pixelsPerStep = 1 )
inlinestaticconstexpr

pixelsPerStep pixels (default one) every ms milliseconds.

Member Data Documentation

◆ pixels

uint8_t hitlib::LedStrand::Speed::pixels

Pixels moved per step.

◆ stepMs

uint16_t hitlib::LedStrand::Speed::stepMs

Milliseconds between steps. 0 steps on every refresh tick.