41#define SERPENTINE true
105uint8_t
getPaletteIndex(uint32_t millis32,
int width,
int max_width,
int height,
int max_height,
114 float xf = (float)width / (
float)max_width;
115 uint8_t
x = (uint8_t)(xf * 255);
118 uint32_t cosx =
cos8(
x);
119 uint32_t sinx =
sin8(
x);
131 uint16_t
z = millis32 /
invSpeedZ.as<uint16_t>();
136 uint16_t noise16 =
inoise16(cosx << 8, sinx << 8,
y << 8, 0);
139 uint8_t noise_val = noise16 >> 8;
144 int8_t subtraction_factor =
abs8(height - (max_height - 1)) * 255 /
149 return qsub8(noise_val, subtraction_factor);
157 return electricGreenFirePal;
159 return electricBlueFirePal;
175 uint32_t now = millis();
184 for (
int width = 0; width <
WIDTH; width++) {
185 for (
int height = 0; height <
HEIGHT; height++) {
188 uint8_t palette_index =
XYMap xyMap(WIDTH, HEIGHT, false)
UISlider scale("Scale", 1.0f, 0.0f, 1.0f, 0.01f)
CFastLED FastLED
Global LED strip management instance.
central include file for FastLED, defines the CFastLED class/object
CRGBPalette16 getPalette()
UINumberField palette("Palette", 0, 0, 2)
UIDescription description("This Fire demo wraps around the cylinder. It uses Perlin noise to create a fire effect.")
UISlider speedY("SpeedY", 1.3, 1, 6,.1)
TimeWarp timeScale(0, 1.0f)
XYMap xyMap(HEIGHT, WIDTH, SERPENTINE)
uint8_t getPaletteIndex(uint32_t millis32, int width, int max_width, int height, int max_height, uint32_t y_speed)
UISlider scaleXY("Scale", 8, 1, 100, 1)
UISlider invSpeedZ("Inverse SpeedZ", 20, 1, 100, 1)
UISlider scaleX("ScaleX",.3, 0.1, 3,.01)
UITitle title("FireCylinder Demo")
UISlider brightness("Brightness", 255, 0, 255, 1)
LED controller for WS2812 LEDs with GRB color order.
#define DEFINE_GRADIENT_PALETTE(X)
Defines a static RGB palette very compactly using a series of connected color gradients.
@ TypicalLEDStrip
Typical values for SMD5050 LEDs.
LIB8STATIC_ALWAYS_INLINE int8_t abs8(int8_t i)
Take the absolute value of a signed 8-bit uint8_t.
LIB8STATIC_ALWAYS_INLINE uint8_t qsub8(uint8_t i, uint8_t j)
Subtract one byte from another, saturating at 0x00.
uint16_t inoise16(uint32_t x, uint32_t y, uint32_t z, uint32_t t)
16-bit, fixed point implementation of Perlin's noise.
LIB8STATIC uint8_t cos8(uint8_t theta)
Fast 8-bit approximation of cos(x).
#define sin8
Platform-independent alias of the fast sin implementation.
CRGB ColorFromPalette(const CRGBPalette16 &pal, uint8_t index, uint8_t brightness, TBlendType blendType)
Implements a simple red square effect for 2D LED grids.
Representation of an RGB pixel (Red, Green, Blue)