Processing art program

Screen Shot 2016-09-30 at 12.53.29 AM.png

int BS = 50;
color c1 = color(0,0,0);
boolean square;
boolean circle;
boolean gifB1;
boolean gifB2;
boolean one;
boolean zero;
int nothing;
PImage button1;
PImage button2;
PImage zeroI;
PImage oneI;
PImage zeroPNG;
PImage onePNG;

void setup() {
size( 900,700);
background(255);
button1 = loadImage(“button1.jpg”);
button2 = loadImage(“button2.jpg”);
zeroI = loadImage(“zero.jpg”);
oneI = loadImage(“one.jpg”);
zeroPNG = loadImage(“zero.png”);
onePNG = loadImage(“one.png”);
}
//GUI
void draw() {
fill(0,0,0);
rect(0,0,70,70);

fill(33,184,90);
rect(70,0,70,70);

fill(106,221,242);
rect(140,0,70,70);

fill(195,19,69);
rect(210,0,70,70);

fill(149,36,132);
rect(280,0,70,70);
//row 2

fill(70,74,216);
rect(0,70,70,70);

fill(211,209,41);
rect(70,70,70,70);

fill(156,244,92);
rect(140,70,70,70);

fill(221,67,216);
rect(210,70,70,70);

fill(150,60,60);
rect(280,70,70,70);
line(0,140,1000,140);

image(button1,350,70);
image(button2,350,0);
image(zeroI,420,0);
image(oneI,420,70);
}

void mouseClicked() {
//GUI

//colors row 1
if (mouseY <= 70 && mouseX <= 70) {
c1 = color(0,0,0);
}
if (mouseY <= 70 && mouseX <= 140 && mouseX >= 71) {
c1 = color(33,184,90);
}
if (mouseY <= 70 && mouseX <= 210 && mouseX >= 141) {
c1 = color(106,221,242);
}
if (mouseY <= 70 && mouseX <= 280 && mouseX >= 211) {
c1 = color(195,19,69);
}
if (mouseY <= 70 && mouseX <= 350 && mouseX >= 281) {
c1 = color(149,36,132);
}
//tools row 1
if (mouseY <= 70 && mouseX <= 420 && mouseX >= 351) {
circle = true;
square = false;
zero = false;
one = false;
}
if (mouseY <= 70 && mouseX <= 490 && mouseX >= 420) {
circle = false;
square = false;
zero = true;
one = false;
}
//colors row 2
if (mouseY <= 140 && mouseY >= 71 && mouseX <= 70) {
c1 = color(70,74,216);
}
if (mouseY <= 140 && mouseY >= 71 && mouseX >= 71 && mouseX <=140) {
c1 = color(211,209,41);
}
if (mouseY <= 140 && mouseY >= 71 && mouseX >= 141 && mouseX <=210) {
c1 = color(156,244,92);
}
if (mouseY <= 140 && mouseY >= 71 && mouseX >= 211 && mouseX <=280) {
c1 = color(221,67,216);
}
if (mouseY <= 140 && mouseY >= 71 && mouseX >= 281 && mouseX <=350) {
c1 = color(150,60,60);
}
//tools row 2
if (mouseY <= 140 && mouseY >= 71 && mouseX >= 351 && mouseX <=420) {
square = true;
circle = false;
zero = false;
one = false;
}
if (mouseY <= 140 && mouseY >= 71 && mouseX >= 420 && mouseX <=490) {
circle = false;
square = false;
zero = false;
one = true;
}
}

void mouseDragged(){
if (square == true) {
noStroke();
fill(c1);
rect(mouseX-(BS/2),mouseY-(BS/2),BS,BS);
}
if (circle == true) {
noStroke();
fill(c1);
ellipse(mouseX,mouseY,BS,BS);
}
if (one == true) {
image(onePNG,mouseX-35,mouseY-35);
}
if (zero == true) {
image(zeroPNG,mouseX-35,mouseY-35);
}
}
//buttons
void keyPressed () {
if (key == ‘=’ || key == ‘=’) {
BS = BS+15;
}
if (key == ‘-‘ || key == ‘-‘) {
BS = BS-15;
}
if (key == ‘1’ || key == ‘1’) {
fill(random(255));
ellipse(random(900),random(700),random(900),random(700));
}
if (key == ‘2’ || key == ‘2’) {
stroke(random(10));
line(random(900),random(700),random(900),random(700));
}
}

 

Advertisements
This entry was posted in interactive, non time based and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s