-
-
Notifications
You must be signed in to change notification settings - Fork 0
Noise Gradient (Seg Line)
See the Documentation Guide for help understanding each page section.
Effect Sample (see here for sample info) |
An effect where palette colors are drawn as a gradient across segment lines that shifts based on the output of the FastLED Perlin noise function. The brightness is randomly set in blobs across the segment lines. The length of the color gradient can be set to shift in quick bursts over time, which lets the effect stay calm for a while, and then quickly shift to a new look.
You can change the variables freely, although this may result in jumps in the effect.
The noise colors will be blended towards a background color. Changing the background color will "tint" the overall output, because all the colors are blended towards the background color as part of the effect. Supports color modes for the background color.
Overall the effect has two components:
- A gradient of palette colors that shifts along the segment set in random jumps.
- Spots of brightness that grow and change with time.
Both these factors have their own independent settings, so you can tune the effect to your liking.
-
blendStepsBase
-- The minimum number of gradient steps between palette colors. To make the effect more interesting, the number of gradient steps (blendSteps
) can be set to shift over time, which changes how fast palette colors blend. The total number ofblendSteps
is calculated asblendSteps = blendStepBase + random(blendStepsRange)
, soblendStepBase
sets the smallest number of steps the gradients can have. I recommend keeping the total possible steps to be less than 20. At higher values the shifting becomes quite slow. This may depend on your segments though. -
blendStepsRange
-- The maximum amount added toblendStepBase
. Sets the upper limit for the number of gradient steps. If you setblendStepsRange
to 0 then there will be no shifting. -
blendRate
-- How often (in ms) theblendSteps
are shifted. Constantly shifting theblendSteps
looks choppy, so instead we only shift it everyblendRate
time. The overall result is that the effect has moments of calm before jumping to a new look. Note thatblendRate
is a pointer, so you can bind it externally (just likerate
). TheblendRate
you pass in is stored inblendRateOrig
. See common varsrate
en -
phaseScale
-- The gradient is constantly offset by a noise value.phaseScale
sets the speed of the noise changes, ie, how "wobbly" the gradient is. Lower values => faster changing, min value of 1. Recommend between 5 and 20. -
freqScale
-- How quickly the gradient moves across the segments. Lower value => faster. Min value of 1. Recommend between 5 and 20.
Warning, do NOT set the blendSteps
directly if your blendStepsRange
is greater than 0. Doing so may cause the blendSteps
to increase/decrease infinitely.
The brightness patches are generated with noise, similar to the Lava effect, so they shift and grow/shrink over time. They are controlled with the following settings:
-
briScale
-- Sets how "zoomed-in" the noise is, ie, how large the brightness patches are. Higher value => smaller patches. Recommend between 10 and 50. -
briFreq
-- Defaulted to 5. Sets how quickly the brightness changes. Smaller value => faster change. Min value of 1. -
doBrightness
-- Default true. Turns the brightness spots on/off.
/* For this example, I'm showing you how to set the blendStepsRange so that one complete palette gradient
fits into the segment set. This tends to look good because you always have all the colors showing, and they'll
either spread out into one full wave, or make multiple smaller waves as the blendSteps shifts.
For this, you want your "max blend steps" * "number of palette colors" to equal the number of segment lines.
uint8_t numColors = 3;
uint8_t minSteps = 3;
uint8_t stepsRange = ( mainSegments.numLines / numColors ) - minSteps;
In my instance the mainSegments have a maximum length of 24, so stepsRange is 5. */
NoiseGradSL noiseGrad(mainSegments, numColors, 0, minSteps, stepsRange, 10, 20, 30, 5000, 80);
/* Will produce an effect using a palette of 3 random colors
The background is blank.
There are a minimum of 3 blendSteps and range of 5 for a maximum blendSteps of 8 (as calculated above)
The phaseScale is 10, the freqScale is 20, and the briScale is 30.
The blendSteps will be shifted every 5000ms (5 sec).
The effect updates at 80ms. */
NoiseGradSL noiseGrad(mainSegments, cybPnkPal_PS, 0, 8, 16, 5, 20, 10, 3000, 80);
NoiseGradSL.bgColorMode = 6; //put in Arduino Setup()
/* Will produce an effect using colors from cybPnkPal_PS
The background is blank (but using bgColorMode of 6, ie a shifting rainbow)
There are a minimum of 8 blendSteps and range of 16 for a maximum blendSteps of 24
The phaseScale is 5, the freqScale is 20, and the briScale is 10.
The blendSteps will be shifted every 3000ms (3 sec).
The effect updates at 80ms. */
//Constructor with palette
NoiseGradSL(SegmentSetPS &SegSet, palettePS &Palette, CRGB BgColor, uint16_t BlendStepsBase, uint16_t BlendStepsRange,
uint8_t PhaseScale, uint8_t FreqScale, uint8_t BriScale, uint16_t BlendRate, uint16_t Rate);
//Constructor with randomly generated palette
NoiseGradSL(SegmentSetPS &SegSet, uint8_t numColors, CRGB BgColor, uint16_t BlendStepsBase, uint16_t BlendStepsRange,
uint8_t PhaseScale, uint8_t FreqScale, uint8_t BriScale, uint16_t BlendRate, uint16_t Rate);
-
SegmentSetPS* segSet -- The Segment Set the effect will draw on. See common vars
segSet
entry for more details. -
palettePS* palette (optional, see constructors) -- The set of colors the effect will use. See palettes. It is a pointer. See common vars
palette
entry for more details. -
uint8_t numColors (optional, see constructors) -- The number of randomly chosen colors for the effect. The colors will be placed into the effect's local palette,
paletteTemp
for use. -
CRGB* bgColor -- The color used for background pixels. Is a pointer, allowing you to bind it to an external color. By default it's bound the effect's local,
bgColorOrig
color. See common varsbgColor
entry for more details. -
uint16_t blendStepsBase -- The minimum number of gradient steps between palette colors. (See Inputs Guide above)
-
uint16_t blendStepsRange -- The maximum amount added to
blendStepBase
for shifting. (See Inputs Guide above) -
uint8_t phaseScale -- Sets how must the gradient "wobbles". Must be greater than 0. (See Inputs Guide above)
-
uint8_t freqScale -- Sets how long the waves are. Must be greater than 0. (See Inputs Guide above)
-
uint8_t briScale -- Sets how "zoomed-in" the brightness noise is. (See Inputs Guide above)
-
uint16_t blendRate -- How often we shift to new
blendSteps
values (ms). (See Inputs Guide above) -
uint16_t* rate -- Update rate (ms). Is a pointer, allowing you to bind it to an external variable. By default it's bound the effect's local variable,
rateOrig
. See common varsrate
entry for more.
-
uint8_t bgColorMode (default 0) -- The colorMode used for the background pixels, also see common vars
colorMode
entry for more details. -
uint8_t briFreq (default 5) -- Sets how quickly the brightness changes. Smaller value => faster change. Min value of 1. (See Inputs Guide above)
-
uint8_t blendSteps -- How many steps are taken to blend between palette colors. Set to
blendStepBase
during effect creation. Changes over time ifblendStepsRange
is greater than 0. -
type doBrightness (default true) -- Turns the brightness spots on/off.
-
bool showNow (default true) -- Controls if the effect "draws" during each update cycle by calling
FastLED.show()
. Common to all effects. See common varsshowNow
entry for more details.
-
Updates the effect.
void update();
- Overview
- Wiring LEDs and Prerequisites
- Code Examples:
- Commonly Used Variables and More
- Class Documentation Guide
- Segment Basics
- Advanced Segment Usage
- Segment Class Specs:
- Segment Drawing Functions
- Effect Basics
- Effects Advanced
- Color Modes
- Commonly Used Variables and More
- Pointers
- Temporary Effects
- Effect Utility Classes
- Effect Samples
- Documentation Notes
Show/Hide Effects
- Breath
- Breath Eye Seg Line
- Color Melt Seg Line
- Color Mode Fill Seg Line or Seg
- Color Wipe Seg
- Color Wipe Seg Line or Seg
- Cross-Fade Cycle
- Dissolve Seg Line
- Draw Pattern Seg Line or Seg
- Edge Burst Seg Line
- Fairy Lights Seg Line or Seg
- Fire2012 Seg
- Fire2012 Seg Line
- Fireflies Seg Line
- Fireworks
- Glimmer Seg Line
- Gradient Cycle Seg Line
- Gradient Cycle Fast Seg Line
- Larson Scanner Seg Line
- Lava
- Noise16
- Noise Seg Line
- Noise Gradient Seg Line
- Noise Waves Seg Line
- Pacifica
- Pacifica Hue Seg Line
- Particles Seg Line
- Pattern Shifter Seg Line
- Pattern Shifter Seg
- Plasma Seg Line
- Police Strobe Seg Line or Seg
- Pride With Pal Seg Line
- Pride With Pal 2 Seg Line
- Rainbow Cycle
- Rainbow Cycle Seg Line or Seg
- Rainbow Fonts Seg Line
- Rain Seg
- Rain Seg Line
- Rolling Waves Seg Line
- Rolling Waves Fast Seg Line
- Scanner Seg Line
- Segment Waves Seg
- Segment Waves Fast Seg
- Shifting Sea Seg Line
- Shimmer Seg Line
- Soft Twinkle Seg Line
- Streamer Seg Line
- Streamer Fast Seg Line
- Strobe Seg Line or Seg
- Theater Chase Seg Line
- Twinkle Seg Line
- Twinkle Fast Seg Line
- Twinkle 2 Seg Line or Seg
- Xmas Lights Seg Line or Seg