-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Fixes/black frame bug #8124
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
base: main
Are you sure you want to change the base?
Fixes/black frame bug #8124
Conversation
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.
Minimal change - only 2 lines modified
The diff shows more than a thousand line changes. Are these documentation removal was intentional? Can you please fix this?
src/image/loading_displaying.js
Outdated
// initialize variables for the frames processing | ||
let frameIterator = nFramesDelay; | ||
this.frameCount = frameIterator; | ||
// BUGFIX: Removed line that was resetting frameCount |
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.
We actually intentionally set the frame count here so that sketches relying on the frame count are effectively reset when recording the gif. (An extension we haven't got to yet is to also override millis() when recording too.) Fully removing it would break the use case where you want to get a recording from the start of the animation.
Maybe there's a way the user can pass an option into saveGif to tell it to pick up recording from whatever the current state of the sketch is, and we don't touch frameCount (and in the future, other timing state) when that's set?
@perminder-17 Hi maintainer !! |
@perminder-17 Hi maintainer !! |
Resolves #8123
Changes:
This PR fixes the black frames bug in
saveGif()
by removing an incorrectframeCount
reset.Problem:
saveGif()
was generating GIFs with black or incorrectly rendered frames at the start because it reset the globalframeCount
variable on line 512, breaking animations that depend onframeCount
for timing.Changes made:
Line 512 in
src/image/loading_displaying.js
: Removedthis.frameCount = frameIterator;
frameIterator
variable is sufficient for tracking capture progressframeCount
that user sketches depend onAfter line 542: Added initial frame rendering with
this.redraw()
and 16ms delayImpact:
PR Checklist
npm run lint
passes