Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Modified p5.Image.js to include a fallback incase
pInst._lastRealFrameTime; does not exist. Fixes
gif animation on graphic issue.
  • Loading branch information
kaiserarg committed Mar 27, 2024
commit d0434f4d4f679b58efb565aaadb618b4395948f9
2 changes: 1 addition & 1 deletion src/image/p5.Image.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ p5.Image = class {
*/
_animateGif(pInst) {
const props = this.gifProperties;
const curTime = pInst._lastRealFrameTime;
const curTime = pInst._lastRealFrameTime || window.performance.now();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes sense. At first I was worried that this wouldn't be as robust as grabbing the time from the main canvas, but there's also the chance that the graphic is being used for fully offscreen rendering and the main canvas never updates, so this is probably the best compromise for now. We can always revisit this later, I'll merge this PR!

if (props.lastChangeTime === 0) {
props.lastChangeTime = curTime;
}
Expand Down