LingDong- / q5xjs

A small and fast alternative (experimental) implementation of p5.js
https://q5xjs.netlify.app/
The Unlicense
541 stars 25 forks source link

q5.pop() does not restore fill properties #14

Open awelles opened 3 years ago

awelles commented 3 years ago

The following code will draw two ellipses every loop. Expected: The first ellipse filled, the second no fill. Got: Using q5 both ellipses will have no fill.
( With p5.js the expected behavior is shown )

It appears that q5.pop() doesn't restore a bunch of variables such as ._noFill, and ._noStroke. The context's .fillStyle is restored properly, but is then unused;

code:

q5 = new Q5(); q5.setup = function () { q5.createCanvas(q5.windowWidth, q5.windowHeight); q5.fill('#000000'); };

q5.draw = function () { q5.clear(); q5.ellipse(100, 100, 30, 30); q5.push(); q5.noFill(); q5.ellipse(200, 100, 30, 30); q5.pop(); };

It appears that q5.pop() doesn't restore a bunch of variables such as ._noFill, and ._noStroke. The context's .fillStyle is restored properly, but is then unused;

quinton-ashley commented 1 year ago

I fixed this in my upgrade to q5js!

https://github.com/quinton-ashley/q5js