Learn creative coding writing simple programs

88. Change pixels using the pixels array

Short review of arrays. We create an array, count how many items it has, print one of the items and also modify one of them.
Then we move onto the pixels array, which allows us to manipulate the graphics by using an array. It probably sounds more complicated than using point(), get() and set(), but it's also much faster. In some cases we will want to use this method. To show an example of using the pixels array we fill the whole screen with random pixels, and we do this inside the draw() function, so we get an animated effect which runs very fast, much faster than updating pixels using point().

Tags: pixels, loadPixels, updatePixels

Code editor

You can make changes to the code below. Then
Questions and comments are welcome! :) But please try to stay close to the topic of this episode. Use the Processing forums for help with your Processing projects (or hire me for help ;-)