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

Method NoisePalette

src/fl/fx/2d/noisepalette.cpp.hpp:19–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17namespace fl {
18
19NoisePalette::NoisePalette(XYMap xyMap, float fps)
20 : Fx2d(xyMap), speed(0), scale(0), colorLoop(1), mFps(fps) {
21 // currentPalette = PartyColors_p;
22 FL_STATIC_ASSERT(sizeof(currentPalette) == sizeof(CRGBPalette16),
23 "Palette size mismatch");
24 currentPalette = PartyColors_p;
25 width = xyMap.getWidth();
26 height = xyMap.getHeight();
27
28 // Initialize our coordinates to some random values
29 mX = random16();
30 mY = random16();
31 mZ = random16();
32
33 setPalettePreset(0);
34
35 // Allocate memory for the noise array using vector
36 noise.resize(width * height);
37}
38
39void NoisePalette::setPalettePreset(int paletteIndex) {
40 currentPaletteIndex = paletteIndex % 12; // Ensure the index wraps around

Callers

nothing calls this directly

Calls 3

getWidthMethod · 0.45
getHeightMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected