p5.js icon indicating copy to clipboard operation
p5.js copied to clipboard

Animated GIF masking

Open yifanmai opened this issue 3 years ago • 5 comments
trafficstars

Resolves #5174

Changes:

  • When the mask method is called on an Image that contains an animated GIF, the mask is applied to all of its frames.
  • Added unit tests for the mask method on static and animated images.

PR Checklist

  • [x] npm run lint passes
  • [x] [Inline documentation] is included / updated
  • [x] [Unit tests] are included / updated

yifanmai avatar Dec 20 '21 05:12 yifanmai

🎉 Thanks for opening this pull request! Please check out our contributing guidelines if you haven't already. And be sure to add yourself to the list of contributors on the readme page!

welcome[bot] avatar Dec 20 '21 05:12 welcome[bot]

@yifanmai thank you for this well-written pull request! Sorry for the delay in reading it but luckily there are no merge conflicts yet.

The functionality looks good and I appreciate your thoughtful unit tests. I was worried that the performance would be terrible but it wasn't as bad as I feared.

The one minor issue that I see is that the first frame painted into the GIF will not be masked due to the way that p5.Image works with frames behind the scenes. I don't think that this PR necessarily needs to account for that as there are workarounds and this fix could come down the road.

I would be happy to merge this as-is but I am not as active in the repo right now so I think it would be good to get an opinion from @jesi-rgb who is working on GIF saving functionality this summer.

For anyone to reference, here is an example hosted on the editor with a build from this PR.

stalgiag avatar Jul 19 '22 16:07 stalgiag

Thanks for the review! @stalgiag could you assist with adding @jesi-rgb as a reviewer to this PR? I do not have permissions to do so.

Also, I could take a look at the first frame issue later, if you could provide some pointers about that.

yifanmai avatar Jul 20 '22 18:07 yifanmai

hey @yifanmai and @stalgiag!! thanks so much for counting on me for this review. while I can definitely review the code and check if something is wrong or at least clashes with what I'm working on, I don't feel quite prepared for this task just yet.

All in all, I'm a beginner in this whole javascript and open source thing, but i'll try my best!

That said, if you guys think there's someone better suited for this task do not hesitate in including them!

jesi-rgb avatar Jul 20 '22 18:07 jesi-rgb

Hi @jesi-rgb, it is OK that you are new; I am also a new contributor to this project! Any feedback from you is appreciated. :)

yifanmai avatar Jul 31 '22 00:07 yifanmai