-
-
Notifications
You must be signed in to change notification settings - Fork 0
Pacifica Hue (Seg Line)
See the Documentation Guide for help understanding each page section.
Effect Sample (see here for sample info) (Shown cycling through hues) |
An effect based on the pacific code here. This is an alternate version of the original Pacifica, that I've adapted to work in 2D, while also allowing you to change the overall color of the waves. This produces uniform waves that shift across the whole segment set, which shift between a colors in a limited hue range.
Recommend brightness > 80 and rate > 20ms. For low brightness values I recommend turning off dithering using FastLED.setDither(0)
.
Like the original, the effect is a bit computationally heavy.
The main input for the effect is the hue
, which sets a base color using the HSV rainbow. The effect's palettes then form their colors around that base color. This produces a nice gentle wave effect like the original effect, but tinted in a specific color. However, it does mean that you cannot have colors from opposite ends of the spectrum together (like green and purple for example) (try the Lava or noise effects for instead).
Some hue
ranges are:
- Red/Orange: 240 to ~10.
- Orange/Yellow: 10 to ~40.
- Yellow/Green: 40 to ~90.
- Green/Blue: 90 to ~150.
- Blue/Purple: 150 to ~180.
- Purple/Red: 180 to 240.
By default the hue is set to 130, which closely matches the colors from the original effect.
You can also set the hue to cycle through colors over time at hueRate
(ms) (see constructors below). A hue rate of 0 will stop the hue cycle. The hue is updated as part of the effect, so the hueRate
should be slower than the effect's update rate. Note that the hueRate
is a pointer (like the overall effect rate
), so you can bind it to an external variable if wanted. By default hueRate
is bound the effect's local variable, hueRateOrig
. See common vars rate
entry for more.
Note, to get the effect to work with multiple colors, the original Pacifica palettes needed to be heavily modified. You can find the palettes in "PacificaHuePal.h" in the code, however I will not be going over them here because you don't need specific knowledge of them for the effect.
In the original code, waves are shifted towards white where they meet using the function addWhiteCaps()
. I've made this function optional (default off) for a few reasons:
-
In the code, pixel colors are added to one another. For a 1D line or a rectangular matrix this is fine, because each pixel is part of a single Segment Line, so the
addWhiteCaps()
is needed to form the wave peaks. However for an uneven segment set with different length segments, a single pixel may exist in multiple lines at once. In this case, the code is already forming the wave peaks by adding the colors of the overlapping pixels multiple times, makingaddWhiteCaps()
overkill. -
addWhiteCaps()
was specifically written for the original blue-green colors of the original Pacifica effect. I have been unable to adapt it to work well with all hues. So in some cases, it's best to leave it off.
In addition to the above, I've also allowed you to cap the white light level of the pixels using thresholdMax
as part of addWhiteCaps()
.
PacificaHueSL pacificaHue(mainSegments, 40);
/* That's it, updates at 40ms
(addWhiteCaps is default false, and the hue will default to 130 to match the original Pacifica colors) */
PacificaHueSL pacificaHue(mainSegments, true, 130, 40);
/* Sets addWhiteCaps to true and the hue to 130, updates at 40ms */
PacificaHueSL pacificaHue(mainSegments, true, 50, 500, 40);
/* Sets addWhiteCaps to true, with the hue starting at 50 and incrementing every 500ms
The effect updates at 40ms */
//Normal constructor (does default Pacifica)
PacificaHueSL(SegmentSetPS &SegSet, uint16_t Rate);
//Constructor with addWhiteCaps setting
PacificaHueSL(SegmentSetPS &SegSet, bool AddWhiteCaps, uint8_t Hue, uint16_t Rate);
//Constructor with addWhiteCaps and hue rate settings
//The hue will be the initial hue of the palette
PacificaHueSL(SegmentSetPS &SegSet, bool AddWhiteCaps, uint8_t Hue, uint16_t HueRate, uint16_t Rate);
-
SegmentSetPS* segSet -- The Segment Set the effect will draw on. See common vars
segSet
entry for more details. -
bool addWhiteCaps (optional, default false) -- If true, the
addWhiteCaps()
function will be called as part of the update cycle (see Inputs Guide Notes). -
bool addWhiteCaps (optional, default false) -- If true, the
addWhiteCaps()
function will be called as part of the update cycle (see Inputs Guide Notes). -
uint8_t hue (optional, default 130, max 255) -- The hue used in the effect (see Inputs Guide Notes). Use
setHue()
to change later. -
uint16_t* hueRate (optional, default 0) -- How quickly the hue shifts (ms). By default it's bound the effect's local variable,
hueRateOrig
. (see Inputs Guide Notes). -
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 thresholdMax (default 230) -- Caps the white cap light level to prevent pixels from getting too white as part of the
addWhiteCaps()
function. Lower -> lower light cap. -
PacificaHuePalPS PacificaPalette -- The Pacifica Hue Palette instance. You shouldn't need to access this.
-
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.
-
void setHue(newHue);
Changes the hue value to change the effect colors.
-
void update();
Updates the effect.
- 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