Skip to content

Instantly share code, notes, and snippets.

@sophieKaelin
Created May 6, 2020 09:42
Show Gist options
  • Save sophieKaelin/5b3af024821b7260456acf1ce9250b9a to your computer and use it in GitHub Desktop.
Save sophieKaelin/5b3af024821b7260456acf1ce9250b9a to your computer and use it in GitHub Desktop.
//https://www.youtube.com/watch?v=YKMB2HtJZEo
void setup() {
size(800, 800);
stroke(255);
strokeWeight(3);
drawDanceFloorPlease();
}
void draw() {
}
void keyPressed() {
drawDanceFloorPlease();
}
void drawDanceFloorPlease(){
for (int x = 0; x < width; x += width/10) {
for (int y = 0; y < height; y += height/10) {
drawCell(x, y);
}
}
}
void drawCell(int xpos, int ypos){
fill(giveMeAColourPlease());
rect(xpos, ypos, width/10, height/10);
//drawPenguin(xpos+width/20, ypos+width/20);
}
color giveMeAColourPlease(){
return color(random(255), random(255), random(255));
}
void mousePressed(){
int x = roundDown(mouseX);
int y = roundDown(mouseY);
drawCell(x, y);
drawPenguin(x+width/20, y+height/20);
}
int roundDown(int pos){
return pos - pos%80;
}
void drawPenguin(int x, int y){
noStroke();
fill(#FFAC05);
ellipse(x-10, y+30, 30, 10);//leftfeet
ellipse(x+10, y+30, 30, 10);//rightfeet
ellipse(x-14, y+5, 10, 30);//leftarm
ellipse(x+14, y+5, 10, 30);//leftarm
stroke(0);
strokeWeight(1);
fill(giveMeAColourPlease());
ellipse(x, y, 30, 60); //body
noStroke();
fill(255);
ellipse(x,y+10, 25, 40); //white body
ellipse(x-4, y-10, 10, 15); //left eyes
ellipse(x+4, y-10, 10, 15); //right eyes
fill(0);
ellipse(x-4, y-10, 5, 5); //left eyes
ellipse(x+4, y-10, 5, 5); //right eyes
fill(#FFAC05);
triangle(x-4, y-7, x+4, y-7, x, y); //mouth
stroke(255);
strokeWeight(3);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment