-
Notifications
You must be signed in to change notification settings - Fork 343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using segment runtime in custom mode #349
Comments
Hmmmm...I don't see where you're blending colors to create the fading effect in your code. Like this line in the uint32_t color = color_blend(_seg->colors[1], _seg->colors[0], lum); I would take a different tack. Instead of creating a custom effect, I think I'd use the isCycle() function to detect the end of the breath animation cycle and change color at that point in time. Like this: void loop() {
ws2812fx.service();
if(ws2812fx.getMode() == FX_MODE_BREATH) {
if(ws2812fx.isCycle()) { // if end of breath cycle, change color
uint32_t newColor = ws2812fx.color_wheel(ws2812fx.random8()); // some random color
ws2812fx.setColor(newColor);
}
}
} |
I was wondering why that was there... I thought its a one-color effect so I just set the one color and dimmed using
I don't think that will quite work the way I want because it'll instantly swap between the two colors at the end of the cycle, right? Because there's the pause in |
One thing you can do if you want to fade to black is to turn on Gamma Correction. when you setup the segment. Gamma correction will skew dim colors dimmer and bright colors brighter. Very dIm colors will be black. It's a bit of a hack, but might give you want you want. ws2812fx.setSegment(0, 0, LED_COUNT - 1, FX_MODE_BREATH, RED, 1000, GAMMA); Otherwise, I think you're right, you'll have to develop a custom effect. |
So the gamma didn't work, but turns out my issue was that I didn't know you have to do both |
I'm trying to create a custom mode that is the same as breath, except it does it once as one color, then switches to another color, repeat. So my first attempt is to essentially copy
mode_breath
but grab segment info from the public segment/runtime getters. Unfortunately, I get a static dim color, and no animation. It seems likecounter_mode_step
is getting reset by something, but I couldn't figure out what.What am I doing wrong here? Or maybe there's an entirely better way entirely to do this? TIA.
The text was updated successfully, but these errors were encountered: