You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
custom loading animations should automatically add a push()/pop() to match draw() behavior #9367
I've been trying out the custom loading animations in the new RC: https://openprocessing.org/@p5js/3047815 and I noticed that push(); and pop(); are always needed when there are any transforms.
For example:
functiondraw(){// This example is based on an example in// https://day.processing.org/activity-guide/a-coding-train-zine/// A Coding Train Zine by Dan Shiffman, Cy Xbackground(51);translate(200,height);stroke(255,0,255);branch(100,map(sin(millis()/1300),-1,1,0,PI));stroke(255,255,0);branch(100,map(sin(millis()/1100),-1,1,0,PI));}...
Would be valid p5.js, that would reset state between draws. But using an existing valid p5.js sketch in a custom loading animation requires realizing that the reason it looks broken is that there's a missing implicit push/pop. Even fi not a "bug" I could imagine this could be confusing behavior
@Jextic@limzykenneth I don't think this should be blocking/urgent (or should it?), and I think there's a deeper perhaps question here of what we expect people to do with custom animation.
I think we can consider doing similar to draw and have automatic push pop later. It won't affect loading animations that already does their own push pop and for animations, and it is probably unusual for any animations to expect transformation to accumulate over time since that is contrary to what p5.js itself does.
This don't need to be blocking 2.4 since loading animation itself is new and experimental (could be worth noting in release notes if not already), and putting in the default push pop is likely additive considering the above.
changed the title [-]2.4.0-rc.3: custom Loading Animation requires push/pop when draw() wouldn't[/-][+]custom loading animations should automatically add a push()/pop() to match draw() behavior[/+]on Nov 3, 2026
Hi! I'd be interested in working on this issue.
I understand that the goal is to make custom loading animations automatically reset drawing state between frames, similar to the behavior of draw().
Would it be okay if I investigated the current loading animation implementation and proposed a solution with appropriate tests?
I'd also appreciate any pointers to the relevant implementation files.
Thanks!
Sure @Deekshitha-089, welcome! the loading animation was introduced by Jextic in #9119 (this was building on previous work #8997) Those discussions may also be useful for thinking about how to both manually and automatically test this. If you spot any thing weird about the loading animation please do report bugs, it's a very new feature (for example, a recent edge case fix: #9365) so bug reporting is extra helpful.
Activity
ksen0 commentedon Nov 2, 2026
@Jextic @limzykenneth I don't think this should be blocking/urgent (or should it?), and I think there's a deeper perhaps question here of what we expect people to do with custom animation.
limzykenneth commentedon Nov 3, 2026
I think we can consider doing similar to draw and have automatic push pop later. It won't affect loading animations that already does their own push pop and for animations, and it is probably unusual for any animations to expect transformation to accumulate over time since that is contrary to what p5.js itself does.
This don't need to be blocking 2.4 since loading animation itself is new and experimental (could be worth noting in release notes if not already), and putting in the default push pop is likely additive considering the above.
[-]2.4.0-rc.3: custom Loading Animation requires push/pop when draw() wouldn't[/-][+]custom loading animations should automatically add a push()/pop() to match draw() behavior[/+]Deekshitha-089 commentedon Nov 4, 2026
Hi! I'd be interested in working on this issue.
I understand that the goal is to make custom loading animations automatically reset drawing state between frames, similar to the behavior of
draw().Would it be okay if I investigated the current loading animation implementation and proposed a solution with appropriate tests?
I'd also appreciate any pointers to the relevant implementation files.
Thanks!
ksen0 commentedon Nov 4, 2026
Sure @Deekshitha-089, welcome! the loading animation was introduced by Jextic in #9119 (this was building on previous work #8997) Those discussions may also be useful for thinking about how to both manually and automatically test this. If you spot any thing weird about the loading animation please do report bugs, it's a very new feature (for example, a recent edge case fix: #9365) so bug reporting is extra helpful.
Here is an example usage: https://openprocessing.org/@p5js/3047815 (the sketch shared above)
Please post your findings and ideas here so we can verify the approach, before making a PR.