wip commit
This commit is contained in:
@@ -47,22 +47,20 @@ void SolidAnimation::loop() {
|
||||
});
|
||||
m_blobs.update();
|
||||
}
|
||||
m_noiseOffset += 1;
|
||||
}
|
||||
|
||||
void SolidAnimation::render(Display* dpy) const {
|
||||
CRGB color(m_red.value(), m_green.value(), m_blue.value());
|
||||
CRGB scaledPrev = m_prevColor;
|
||||
scaledPrev = color.nscale8(30);
|
||||
uint8_t frame = ease8InOutApprox(m_changePct);
|
||||
if (F_LIKELY(frame == 255)) {
|
||||
Surface(dpy, {0, 0}, {255, 255}) = color.nscale8(10);
|
||||
} else {
|
||||
uint8_t cutoff = (frame / 2);
|
||||
uint8_t rotation = m_horizontal ? 0 : 128;
|
||||
Surface(dpy, {0, 0}, {128 - cutoff, 255}, rotation) = scaledPrev;
|
||||
Surface(dpy, {128 - cutoff, 0}, {128 + cutoff, 255}, rotation) = scaledPrev;
|
||||
Surface(dpy, {128 + cutoff, 0}, {255, 255}, rotation) = scaledPrev;
|
||||
}
|
||||
Surface sfc = Surface(dpy, {0, 0}, {255, 255});
|
||||
uint8_t noiseY = sin8(m_noiseOffset % 255);
|
||||
uint8_t noiseX = cos8(m_noiseOffset % 255);
|
||||
CHSV color(rgb2hsv_approximate(CRGB(m_red, m_green, m_blue)));
|
||||
|
||||
sfc.paintShader([=](CRGB& pixel, const VirtualCoordinates& coords, const PhysicalCoordinates, const VirtualCoordinates& surfaceCoords) {
|
||||
uint8_t brightness = inoise8(noiseX + surfaceCoords.x, noiseY + surfaceCoords.y);
|
||||
uint8_t saturation = inoise8(noiseY + surfaceCoords.y, noiseX + surfaceCoords.x);
|
||||
nblend(pixel, CHSV(color.h, std::max((uint8_t)128, saturation), scale8(color.v, brightness)), 128);
|
||||
});
|
||||
m_blobs.render(dpy);
|
||||
}
|
||||
STATIC_ALLOC(SolidAnimation);
|
||||
|
||||
Reference in New Issue
Block a user