Learn creative coding writing simple programs
144. Drawing animated loops
By using an array of PGraphics, in this episode we draw looping flipbooks. The idea is simple: we have a constantly playing animation of 20 frames, and we are able to draw on it. When the mouse is pressed, our ink ends up in the current frame, whichever that is. The resulting effect is quite interesting. Once you have the program running, you can learn different drawing tricks, but I leave that to your own imagination :)
Here two drawings I created using this technique: http://hamoid.tumblr.com/post/65383946931/a-small-loop-drawing-processing-program-inspired
Code editor
You can make changes to the code below. Then
Reference
background
createGraphics
draw
for
frameCount
height
if
image
int
line
mousePressed
mouseX
mouseY
new
PGraphics
pmouseX
pmouseY
setup
size
stroke
strokeWeight
void
width
background
createGraphics
draw
for
frameCount
height
if
image
int
line
mousePressed
mouseX
mouseY
new
PGraphics
pmouseX
pmouseY
setup
size
stroke
strokeWeight
void
width
Try to stay close to the topic of this episode. Use the Processing forums for help with unrelated Processing projects (or hire me for help ;-)
To indicate that a word in your comment is code, use the `backtick`. Example
Do `float` and `int` smell similar?
To highlight code blocks, surround it with ``` code-fences ``` like this:``` void setup() { size(600, 600); } ```