Notes
![]() ![]() Notes - notes.io |
//Purpose: To create a color changing snowman with variables
//Date: 7/07/2016
//Version: 3.0
// 3.0 Update -- Click mouse (left or right) and move around to change colors, release to return back to white snowman.
//Author: Nelson Brozich
//---------------
//Variable Declarations -- Global
int snowmanX = 100;
int snowmanY = 300;
int lineX = 100;
int lineY = 100;
color red = 255;
color green = 255;
color blue = 255;
boolean mouseClick;
void setup() {
// Set size and background default color
size(400, 400);
background(100, 90, 50);
// Set shape modes
ellipseMode(CENTER);
rectMode(CENTER);
//fullScreen();
//stroke(0);
} //END Setup
void draw() {
drawSnowman();
mouseClick();
} //END Draw
void keyPressed() {
background(mouseX, mouseY, pmouseX, pmouseY);
} //END keyPressed
void drawSnowman() {
if(mouseClick == true) {
// Bottom Ball
fill(mouseX, mouseY, pmouseX, pmouseY);
ellipse(snowmanX, snowmanY, snowmanX, snowmanY - 200);
// Middle Ball
fill(mouseX, mouseY, pmouseY, pmouseX);
ellipse(snowmanX, snowmanY - 70, snowmanX - 20, snowmanY - 220);
// Head
fill(mouseX, mouseY);
ellipse(snowmanX, snowmanY - 130, snowmanX - 40, snowmanY - 240);
// Hat
fill(random(red),random(green - 100), 0);
rect(snowmanX, snowmanY - 175, snowmanX - 70, snowmanY - 275);
rect(snowmanX, snowmanY - 160, snowmanX - 55, snowmanY - 295);
// Eyes
fill(red - 155, green - 105, 0);
ellipse(snowmanX - 15, snowmanY - 135, snowmanX -84, snowmanY - 280);
ellipse(snowmanX + 15, snowmanY - 135, snowmanX - 84, snowmanY - 280);
// Mouth
fill(mouseX, mouseY, 0);
ellipse(snowmanX - 22, snowmanY - 119, snowmanX - 92, snowmanY - 292);
ellipse(snowmanX - 16, snowmanY - 115, snowmanX - 92, snowmanY - 292);
ellipse(snowmanX - 10, snowmanY - 110, snowmanX - 92, snowmanY - 292);
ellipse(snowmanX - 2, snowmanY - 110, snowmanX - 92, snowmanY - 292);
ellipse(snowmanX + 6, snowmanY - 110, snowmanX - 92, snowmanY - 292);
ellipse(snowmanX + 12, snowmanY - 115, snowmanX - 92, snowmanY - 292);
ellipse(snowmanX + 18, snowmanY - 119, snowmanX - 92, snowmanY - 292);
// Arms
stroke(0);
line(lineX + 38, lineY + 125, lineX + 85, lineY + 75);
line(lineX - 38, lineY + 125, lineX - 70, lineY + 75);
/*beginShape(TRIANGLES);
vertex(30, 75);
vertex(40, 20);
vertex(50, 75);
endShape();
*/
}else{
fill(255);
ellipse(snowmanX, snowmanY, snowmanX, snowmanY - 200);
// Middle Ball
fill(255);
ellipse(snowmanX, snowmanY - 70, snowmanX - 20, snowmanY - 220);
// Head
fill(255);
ellipse(snowmanX, snowmanY - 130, snowmanX - 40, snowmanY - 240);
// Hat
fill(random(red),random(green - 100), 0);
rect(snowmanX, snowmanY - 175, snowmanX - 70, snowmanY - 275);
rect(snowmanX, snowmanY - 160, snowmanX - 55, snowmanY - 295);
// Eyes
fill(red - 155, green - 105, 0);
ellipse(snowmanX - 15, snowmanY - 135, snowmanX -84, snowmanY - 280);
ellipse(snowmanX + 15, snowmanY - 135, snowmanX - 84, snowmanY - 280);
// Mouth
fill(0, 0, 0);
ellipse(snowmanX - 22, snowmanY - 119, snowmanX - 92, snowmanY - 292);
ellipse(snowmanX - 16, snowmanY - 115, snowmanX - 92, snowmanY - 292);
ellipse(snowmanX - 10, snowmanY - 110, snowmanX - 92, snowmanY - 292);
ellipse(snowmanX - 2, snowmanY - 110, snowmanX - 92, snowmanY - 292);
ellipse(snowmanX + 6, snowmanY - 110, snowmanX - 92, snowmanY - 292);
ellipse(snowmanX + 12, snowmanY - 115, snowmanX - 92, snowmanY - 292);
ellipse(snowmanX + 18, snowmanY - 119, snowmanX - 92, snowmanY - 292);
// Arms
stroke(0);
line(lineX + 38, lineY + 125, lineX + 85, lineY + 75);
line(lineX - 38, lineY + 125, lineX - 70, lineY + 75);
}
}
void mouseClick() {
if(mouseButton == RIGHT || mouseButton == LEFT) {
mouseClick = true;
}else{
mouseClick = false;
}
}
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team