-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
A spookier version of Halloween Eyes #3501
Conversation
Thank you. Can you provide a video of the modified effect in action? |
spookyEyes.webmThe old effect did the following: Display two eyes in a random location, fade them out. The video isn't great, but mine does this:
I also increased the maximum configurable time between eyes showing up and the maximum configurable duration that eyes show up for. For the video, I chose a low time between eyes. In a real setup I'd have a rather large time so that eyes pop up when you don't expect them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you like to type a lot. 😁
IMO too many static_cast
s that do not add to code readability, but that is my personal preference.
I would also condense the code wherever possible and add a few more comments.
constexpr uint32_t minimumOnTimeBegin = 1024u; | ||
constexpr uint32_t minimumOnTimeEnd = 1024u; | ||
const uint32_t fadeInAnimationState = elapsedTime * static_cast<uint32_t>(256*8) / duration; | ||
const uint32_t backgroundColor = SEGCOLOR(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not gonna work good with overlay. You will need to improve that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few questions about that:
- what are overlays?
- did it work with the original halloween eyes?
- why doesn't it work?
- what is the correct approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Overlays: segments overlapping.
- in fact it did not as the principle was the same as in your code, use
getPixelColor()
instead if overlay is enabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. I don't think I get it. I tried looking at some usages of getPixelColor
, but it's not really wide spread among other effects.
I tried to experiment with an effect that is simple and uses getPixelColor
: Dissolve. But it doesn't even seem to work correctly when using it as a simple effect (without overlays), when the background color is anything other than black. Not even dark gray works.
Long story short: I'm willing to put some more work into this, but I'd need more input. Can you maybe point me to some documentation or to an effect I can study that demonstrates how things are done correctly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately there's no such documentation.
Basically getPixelColor()
retrieves the color pixel is set with. When segments overlap it will retrieve pixel color set in underlying effect or if it was set by some other part of current effect. If the pixel was not yet modified it will get a color from previous frame. It works similarly as getting leds[i]
when using FastLED.
You need to enable double buffering in LED settings to retrieve unmodified color otherwise the color may be slightly modified. This is due to brightness being applied prior to outputting color to LEDs.
In case of Halloween Eyes, if they are used as overlay over underlying segment you need to fade eyes into underlying color instead of SEGCOLOR(1)
otherwise the underlying segment will have "incorrect" pixel when eyes fade out.
Yeah you are right, but they are also safer :) |
Being old-ish, I prefer simplicity of C and first iterations of C++. But I like to learn new tricks nevertheless. |
I wanted to use Halloween Eyes for Halloween this year, but when I tried it, it was less spooky than I remembered. ^^
So I tried to write a spookier version. Maybe you like it, too.
Bonus:
if (seg.mode != FX_MODE_HALLOWEEN_EYES)
in FX_fcn.cpp isn't required anymore.