18 static constexpr uint8_t
speed = 128;
31 static void on_enter_mode(
auto& ctx)
37 ctx.template set_config_bool<ConfigKeys::rampSaturates>(
true);
40 static void loop(
auto& ctx)
42 const uint16_t colorIndex = ctx.lamp.tick / 4;
43 const float rampIndex = ctx.get_active_custom_ramp() / 255.0;
44 const float freq = 128 / 4.0 + rampIndex * 16 / 4.0;
46 ctx.state.step +=
speed / 16;
47 const float colorIndexNormalised = colorIndex / 255.0;
49 for (
size_t i = 0; i < ctx.lamp.ledCount; i++)
53 const uint8_t pixBri = cubicwave8((i * freq) + ctx.state.step);
56 const auto pixColor =
colors::from_palette((uint8_t)(i * colorIndexNormalised), ctx.state.palette);
58 ctx.lamp.setPixelColor(i, modes::colors::fade<false>(pixColor, pixBri));
Manipulate color representations.
static constexpr uint32_t from_palette(UIntTy index, const PaletteTy &palette, uint8_t brightness=255)
Return a color from a palette.
Definition: palettes.hpp:504
std::array< uint32_t, 16 > PaletteTy
Palette types.
Definition: palettes.hpp:18
static constexpr PaletteTy PaletteRainbowColors
HSV Rainbow.
Definition: palettes.hpp:360
Basic "default" modes included with the hardware.
Definition: aurora.hpp:12
Define some useful color palettes, and tools to use them.
Parent object for all custom user modes.
Definition: mode_type.hpp:53
Definition: sine_mode.hpp:24
colors::PaletteTy palette
color palette to use
Definition: sine_mode.hpp:28
uint16_t step
step of the animation
Definition: sine_mode.hpp:26
Barber shop sign looking animation, with nice swirl effect.
Definition: sine_mode.hpp:16
static constexpr bool hasCustomRamp
User ramp change the frequency of the mode.
Definition: sine_mode.hpp:21
static constexpr uint8_t speed
speed of the animation
Definition: sine_mode.hpp:18