-
Notifications
You must be signed in to change notification settings - Fork 45
Rainbowsparkle fix #23
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…o move the cycle done callback out to animate()
kattni
approved these changes
May 21, 2020
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.
Thanks for the fixes!
adafruit-adabot
added a commit
to adafruit/Adafruit_CircuitPython_Bundle
that referenced
this pull request
May 26, 2020
Updating https://github.com/adafruit/Adafruit_CircuitPython_LED_Animation to 2.1.0 from 2.0.1: > Merge pull request adafruit/Adafruit_CircuitPython_LED_Animation#26 from kattni/more-example-updates > Merge pull request adafruit/Adafruit_CircuitPython_LED_Animation#25 from kattni/example-updates > Merge pull request adafruit/Adafruit_CircuitPython_LED_Animation#23 from rhooper/rainbowsparkle-fix
Neradoc
added a commit
to Neradoc/Adafruit_CircuitPython_LED_Animation
that referenced
this pull request
Jul 18, 2022
The Sparkle animation uses `after_draw` to setup the pixels currently being sparkled for the next frame, assuming `show()` will not be called until then. It also calls `show()` itself first to show the changes made in `draw()`. The problem is that `animate()` already calls `show()` after calling draw and after_draw. So the frame where the sparkle should show is actually skipped and only briefly appears instead of staying for a frame according to the speed parameter. The refactor from PR adafruit#23 changed the protocol where animations should no longer call `show()` themselves. We can't change `after_draw` to be called after the call to show() in animate(), because it will break on animation groups using the same strip. If another animation triggers a show() sooner, it will show the next frame of the sparkle prematurely. It also makes the protocol less predictable. I have used `animate(False)`, followed by setting a pixel an calling `show()` for example to force the color of a single or a few pixels without going through the hassle of creating pixelmaps or groups (and also to simply make it look like it's superimposed over the animation). So the solution would be to drop `after_draw` and instead memorize the previous list of pixels and set them back in the next draw.
Neradoc
added a commit
to Neradoc/Adafruit_CircuitPython_LED_Animation
that referenced
this pull request
Jul 18, 2022
The Sparkle animation uses `after_draw` to setup the pixels currently being sparkled for the next frame, assuming `show()` will not be called until then. It also calls `show()` itself first to show the changes made in `draw()`. The problem is that `animate()` already calls `show()` after calling draw and after_draw. So the frame where the sparkle should show is actually skipped and only briefly appears instead of staying for a frame according to the speed parameter. The refactor from PR adafruit#23 changed the protocol where animations should no longer call `show()` themselves. We can't change `after_draw` to be called after the call to show() in animate(), because it will break on animation groups using the same strip. If another animation triggers a show() sooner, it will show the next frame of the sparkle prematurely. It also makes the protocol less predictable. I have used `animate(False)`, followed by setting a pixel an calling `show()` for example to force the color of a single or a few pixels without going through the hassle of creating pixelmaps or groups (and also to simply make it look like it's superimposed over the animation). So the solution would be to drop `after_draw` and instead memorize the previous list of pixels and set them back in the next draw.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refactors the cycle done protocol, refactors SparklePulse to re-use Sparkle and the pulse generator. Fixes dotstar compatibility in a number of spots. Fix RainbowSparkle leaving dots behind. Adds after_draw() to the protocol. Moves primary show() calls to .animate(). Adds Dotstar PWM support to pulse.