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
Users should be able to set canvas context attributes.
p5.js currently doesn't expose the ability to change 2d canvas context attributes. They can only be changed when the canvas is created and getContext is used for the first time.
I'm especially interested in being able to set new defaults for q5.js:
This could be done via a createCanvas input parameter. For example:
createCanvas(800,600,'2d',{alpha: false});
Users could also change the defaults held in Q5.canvasOptions which would have an effect on all instances of q5. I will need to do this on p5play.org because I actually do take advantage of the canvas's alpha via the clear function which makes light and dark mode possible on the site without needing to change the example code.
The text was updated successfully, but these errors were encountered:
Motivation:
Users should be able to set canvas context attributes.
p5.js currently doesn't expose the ability to change 2d canvas context attributes. They can only be changed when the canvas is created and
getContext
is used for the first time.I'm especially interested in being able to set new defaults for q5.js:
alpha
: most sketches do not take advantage of the canvas element's transparency and disabling it would improve performancedesynchronized
: most sketches would benefit from desynchronization with the DOM, unless the sketch used DOM elements above the canvas.https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext
https://developer.chrome.com/blog/desynchronized
colorSpace
: If the display supports "display-p3" I want q5 to use it. #21Related issue:
processing/p5.js#5902
Implementation:
This could be done via a
createCanvas
input parameter. For example:Users could also change the defaults held in
Q5.canvasOptions
which would have an effect on all instances of q5. I will need to do this on p5play.org because I actually do take advantage of the canvas's alpha via theclear
function which makes light and dark mode possible on the site without needing to change the example code.The text was updated successfully, but these errors were encountered: