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
I copied an old project that used to work. It is a 600 by 600 canvas. However, I saw that the pixel colors were only being set for only some of the canvas.
I logged the length of the pixels array to the console, but it is four times as long as expected. Since I haven't touched the code in a while, I am not sure if its a bug or if the pixels array works differently now.
The text was updated successfully, but these errors were encountered:
Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, please make sure to fill out the inputs in the issue forms. Thank you!
The size of the pixel array depends on the size of your canvas and the pixel density of your screen/sketch. It is likely that when you created the sketch you were working on a screen with pixel density of 1 and when you view it now it is on a screen with pixel density 2. With an increase in pixel density of 2 (ie. doubling of pixels in x and y dimensions) the pixel number will increase by 4 (2 x 2).
If you want it to be fixed to a 600 by 600 canvas, you can manually set pixelDensity(1) in function setup() and it will create a sketch of pixel density 1 regardless of what screen it is viewed on.
Most appropriate sub-area of p5.js?
p5.js version
1.11.2
Web browser and version
131.0.6778.140 (Official Build) (64-bit) (cohort: Stable)
Operating system
Windows
Steps to reproduce this
https://editor.p5js.org/emeraldblackbird/sketches/irR-EG-mG
I copied an old project that used to work. It is a 600 by 600 canvas. However, I saw that the pixel colors were only being set for only some of the canvas.
I logged the length of the
pixels
array to the console, but it is four times as long as expected. Since I haven't touched the code in a while, I am not sure if its a bug or if thepixels
array works differently now.The text was updated successfully, but these errors were encountered: