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

Function TextEffect

src/Functions.cpp:261–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259}
260
261uint32_t TextEffect(uint32_t color, uint32_t fade, uint32_t blink)
262{
263 if (fade > 0)
264 {
265 float phase = (sin(2 * PI * millis() / float(fade)) + 1) * 0.5;
266 uint8_t r = ((color >> 16) & 0xFF) * phase;
267 uint8_t g = ((color >> 8) & 0xFF) * phase;
268 uint8_t b = (color & 0xFF) * phase;
269 return (r << 16) | (g << 8) | b;
270 }
271 else if (blink > 0)
272 {
273 if (millis() % blink > blink / 2)
274 {
275 return color;
276 }
277 else
278 {
279 return 0;
280 }
281 }
282 else
283 {
284 return color;
285 }
286}

Callers 2

NotifyOverlayFunction · 0.85
ShowCustomAppFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected