MCPcopy Create free account
hub / github.com/FastLED/FastLED / fillFrameBufferFire

Function fillFrameBufferFire

examples/FestivalStick/curr.h:608–637  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

606}
607
608void fillFrameBufferFire(uint32_t now) {
609 fl::CRGBPalette16 myPal = getFirePalette();
610
611 // Calculate the current y-offset for animation (makes the fire move)
612 uint32_t y_speed = now * fireSpeedY.value();
613
614 int width = frameBufferPtr->width();
615 int height = frameBufferPtr->height();
616
617 // Loop through every pixel in our cylindrical matrix
618 for (int w = 0; w < width; w++) {
619 for (int h = 0; h < height; h++) {
620 // Calculate which color to use from our palette for this pixel
621 uint8_t palette_index =
622 getFirePaletteIndex(now, w, width, h, height, y_speed);
623
624 // Get the actual RGB color from the palette
625 fl::CRGB color = ColorFromPalette(myPal, palette_index, 255);
626
627 // Apply color boost using ease functions
628 fl::EaseType sat_ease = getEaseType(saturationFunction.value());
629 fl::EaseType lum_ease = getEaseType(luminanceFunction.value());
630 color = color.colorBoost(sat_ease, lum_ease);
631
632 // Set the pixel in the frame buffer
633 // Flip coordinates to make fire rise from bottom
634 frameBufferPtr->at((width - 1) - w, (height - 1) - h) = color;
635 }
636 }
637}
638
639void drawFire(uint32_t now) {
640 fillFrameBufferFire(now);

Callers 1

drawFireFunction · 0.85

Calls 9

getFirePaletteFunction · 0.85
getFirePaletteIndexFunction · 0.85
ColorFromPaletteFunction · 0.85
getEaseTypeFunction · 0.70
valueMethod · 0.45
widthMethod · 0.45
heightMethod · 0.45
colorBoostMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected