Assignment 1 – Drawing Machine

Pretty simply titled “Frog”, this sketch was originally intended to be something very different. After messing around with the random function for a bit, I kind of liked the idea of making a background that changes but also incorporating user input. There are sixteen lily pads that are generated with a for loop at random coordinates, eight of them the same size and eight with random sizes. The frog is an image that stays static and is placed in the corner unlike the fly image which also gets randomly placed in the canvas. The tongue is an ellipse that follows the mouse cursor and is only activated while the mouse is clicked. With both user input and random elements paired, you can really make a lot of different paths with the frog tongue which is what I like the most since it makes every sketch unique.

– Cristian Barrera

Code 

//frog

float size;
PImage frog;
PImage fly;

void circle() {

fill(#F57979);
stroke(157, 124, 146, 125);
strokeWeight(1);
translate(-5, -15);
ellipse(pmouseX, pmouseY, 20, 30);

}

void pads() {

size = random(50, 100);
fill(#0E9B4E);
stroke(#114027);
strokeWeight(4);
ellipse(random(500), random(500), 100, 100);

fill(#0E9B4E);
stroke(#114027);
strokeWeight(4);

ellipse(random(500), random(500), size, size);

}

void setup() {

frog = loadImage(“frog.png”);
fly = loadImage(“fly.png”);

size(500, 500);
background(#5A8B82);
smooth();
frameRate(120);

for (int i = 0; i < 8; i++) {
pads();
}

image(fly, random(height), random(width));

}

void draw() {

image(frog, 0, 0);

if (mousePressed == true) {
circle();
} else {
}

}