Learn creative coding writing simple programs

53. Create a pattern by drawing 150000 pixels

Instead of drawing some shapes in the screen, this time we are going to draw every single pixel in our display. We draw first all the pixels in the first column, then the second column and so on until we cover the whole screen. If we always use the same color the result is the same as using background(). But if we change the color of each pixel we can create interesting patterns. We quickly try using random(), noise() and sin(). Finally we add a line that saves the picture to the hard drive. But it's not nice to save it always with the same name, because the previous image gets replaced. To solve this we generate a random name for our picture. Each time the program runs, it saves an image with a random file name.

Tags: pattern, texture, while, loop, sin, noise, random

Code editor

You can make changes to the code below. Then
Below you can ask and answer questions related to this video. If your question is unrelated to the video, please post it at the Processing Forum as I'm unable to help with all of your programs and still have enough free time to eat and sleep :)
comments powered by Disqus