MCPcopy Create free account
hub / github.com/Blueforcer/awtrix3 / fadeColor

Method fadeColor

src/MatrixDisplayUi.cpp:341–348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

339}
340
341uint32_t MatrixDisplayUi::fadeColor(uint32_t color, uint32_t interval)
342{
343 float phase = (sin(2 * PI * millis() / float(interval)) + 1) * 0.5;
344 uint8_t r = ((color >> 16) & 0xFF) * phase;
345 uint8_t g = ((color >> 8) & 0xFF) * phase;
346 uint8_t b = (color & 0xFF) * phase;
347 return (r << 16) | (g << 8) | b;
348}
349
350uint8_t currentTransition;
351bool gotNewTransition = true;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected