Learn creative coding writing simple programs

20. The smallest drawing program ever

In this episode we learn how to read the current mouse position which is stored in the variables mouseX and mouseY. We also learn how to find out if the mouse button is clicked using the mousePressed variable. With this information we make a very simple drawing program.

Then we create a keyPressed() function to detect when the user presses a key on the keyboard. When the user presses a key, we call the save() function to save our drawing to an image file in our hard drive. You later can send the image by e-mail if you want.

Tags: beginners

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