2#include "../../Utils/Math/Mathematics.h"
7 if (
ratio <= 0.001f)
return;
16 float sineR = sinf(coordY + mpiR * 8.0f);
24 uint16_t indexR = 0, indexG = 0, indexB = 0;
31 colorBuffer[i].
R = pixelColors[indexR].
R;
36 colorBuffer[i].
G = pixelColors[indexG].
G;
41 colorBuffer[i].
B = pixelColors[indexB].
B;
47 pixelColors[i].
R = colorBuffer[i].
R;
48 pixelColors[i].
G = colorBuffer[i].
G;
49 pixelColors[i].
B = colorBuffer[i].
B;
Defines the PhaseOffsetX effect class for applying horizontal phase offsets to pixel groups.
float ratio
A scaling ratio used for dynamic effect adjustments.
float Update()
Updates and calculates the next value of the waveform.
Interface for managing and interacting with a collection of pixels.
virtual RGBColor * GetColors()=0
Retrieves the array of colors for the pixel group.
virtual RGBColor * GetColorBuffer()=0
Retrieves the color buffer for the pixel group.
virtual Vector2D GetCoordinate(uint16_t count)=0
Retrieves the coordinate of a specific pixel.
virtual uint16_t GetPixelCount()=0
Retrieves the total number of pixels in the group.
virtual bool GetOffsetXIndex(uint16_t count, uint16_t *index, int x1)=0
Retrieves an offset X-axis index for a given pixel.
static const float MPI
Mathematical constant (3.14159265358979323846...).
static T Map(T value, T inLow, T inMax, T outMin, T outMax)
Maps a value from one range to another.
static T Constrain(T value, T minimum, T maximum)
Constrains a value between minimum and maximum.
PhaseOffsetX(uint8_t pixels)
Constructs a PhaseOffsetX effect instance.
void ApplyEffect(IPixelGroup *pixelGroup) override
Applies the horizontal phase offset effect to the given pixel group.
FunctionGenerator fGenPhase
Function generator for horizontal phase offsets.
const uint8_t pixels
Number of pixels to apply the effect to.
Represents an RGB color and provides methods for manipulation.
uint8_t B
Blue component of the color (0-255).
uint8_t G
Green component of the color (0-255).
uint8_t R
Red component of the color (0-255).
float Y
The Y-component of the 2D vector.