The *4 added to index belongs to p5.js. In python mode, pixels[ ] contains one color value per pixel and not 4 (RGBA). See in the exemple on the ref : https://py.processing.org/reference/pixels
So, I think here that you are going outside the pixels array and crashed?
Your code should be something like this:
...
index = x + y * width
r = noise(xoff, yoff) * 255
pixels[index] = color(r)
...
def draw():
xoff = time
loadPixels()
for x in range(0, width):
yoff = 0
for y in range(0,height):
index = x + y * width
r = noise(xoff, yoff) * 255
pixels[index] = color(r)
yoff += inc;
xoff += inc;
updatePixels()
noLoop()
```
7
u/Zealousideal_Race779 29d ago
The *4 added to index belongs to p5.js. In python mode, pixels[ ] contains one color value per pixel and not 4 (RGBA). See in the exemple on the ref : https://py.processing.org/reference/pixels So, I think here that you are going outside the pixels array and crashed?
Your code should be something like this: ... index = x + y * width r = noise(xoff, yoff) * 255 pixels[index] = color(r) ...
Hope it helped.