B/c it’s a global mode sketch, you can have at most 1 per page.
As a workaround, you can place other global mode instances of it inside their own <iframe>
tag:
Or simply convert it to instance mode, so you can have multiples of it on the same page context:
Here’s an example of 4 instances of the same sketch running on the same page:
-
Matter-js-Bouncing-Colorful-Balls.Glitch.me/all.html
- 1st 1 is a global mode sketch inside an
<iframe>
. - 2nd 1 is global mode sketch w/o
<iframe>
. - 3rd & 4th are instance mode versions w/o
<iframe>
as well.
- 1st 1 is a global mode sketch inside an
Go to the link below for its full source code:
Just click the button “View Source”.