INTERNET ART: networks, performative programming, and web as context


Leave a comment

Soccer

screen-shot-2016-09-27-at-4-49-22-pm

My code:

Boolean soccer=false;

float ellipseX=(300);
float ellipseY=(300);
int eSize=(50);
float speed=random(-10,-20);

color black=color(0,0,0);
color white=color(255,255,255);
color green=color(27,179,22);
color red=color(255,0,0);
color blue=color(0,77,255);

void setup(){
size(600,600);
background(green);
}

void draw(){
float r=random(255);
background(green);

//soccer ball
stroke(black);
fill(white);
ellipse(ellipseX,ellipseY,eSize,eSize);

ellipseX=ellipseX+speed;

if((ellipseX>width-100||ellipseX<+100)){
speed=speed*(-1);
}

//left goal
stroke(black);
noFill();
line(90,260,100,340);
line(90,260,50,300);
line(100,340,50,380);
line(100,340,100,380);
line(50,300,50,380);

//right goal
stroke(black);
noFill();
line(510,260,500,340);
line(510,260,550,300);
line(500,340,550,380);
line(500,340,500,380);
line(550,300,550,380);
}

Advertisements


Leave a comment

Responsive Game

Still glitchy, if you press the mouse for an even amount of frames it won’t work.

float X = 500;
float Y = 500;
float eX = width/2;
float eY = height/2;

float eD = 10;

float rectW = 100;
float rectH = 500;

float speed= 20;

String n = “LOSER”;

boolean button = false;

void setup (){
size (500,500);
frameRate(15);
}

void draw(){
background(0);
fill(100);
rect(0,0,rectW,rectH);

fill(0,255,0);
ellipse (eX,eY,eD,eD);
eX=eX+speed;

if (eX > width){
speed=speed*-1;
}

if (eX<0){
background(255,0,0);
fill(255,255,255);
text (n, X/3, Y/2);
textSize(72);
}
if (mousePressed){
fill(255,255,255);
rect(0,0,rectW,rectH);
}

if (mouseX < rectW && mouseX > 0 && mouseY > 0 && mouseY < rectH && mousePressed && eX < rectW){
button = true;
}
else {
button = false;

}
if (button){
speed = speed*-1+1;
rectW = rectW -1;

}

}
screen-shot-2016-09-27-at-3-13-23-pm


Leave a comment

Button

I still can’t take screen shots of my computer
Button on_button;
int clk = 1;

void setup() {
size (300, 150);
smooth();

// create the button object
on_button = new Button(“Counting is Fun!”, 20, 20, 100, 50);
}

void draw() {
float r = random(255);
float g = random(255);
float b = random(255);
color random = color(r,g,b);
if (on_button.MouseIsOver()) {
rect(200, 20, 50, 50);
background(255,0,0);
}
else {
background(0);
}

on_button.Draw();
}

// mouse button clicked
void mousePressed()
{
if (on_button.MouseIsOver()) {
background(fill);
fill(random);
frameRate(2);
print(“Clicked: “);
println(clk++);
}
}

// the Button class
class Button {
String label; // button label
float x; // top left corner x position
float y; // top left corner y position
float w; // width of button
float h; // height of button

// constructor
Button(String labelB, float xpos, float ypos, float widthB, float heightB) {
label = labelB;
x = xpos;
y = ypos;
w = widthB;
h = heightB;
}

void Draw() {
fill(218);
stroke(141);
rect(x, y, w, h, 10);
textAlign(CENTER, CENTER);
fill(0);
text(label, x + (w / 2), y + (h / 2));
}

boolean MouseIsOver() {
if (mouseX > x && mouseX < (x + w) && mouseY > y && mouseY < (y + h)) {
return true;
}
return false;
}
}


Leave a comment

Find the Hidden Triangle

sketch_160926ascreen
void setup(){
size(400,400);
background(0);
}

void draw(){
line(width/2,0,width/2,height);
line(0,height/2,width,height/2);

if (mouseX < width/2 && mouseY < height/4 && mousePressed){ background(0,0,255); color(0,255,255); line(width/2,0,width/2,height); line(0,height/2,width,height/2); triangle(30,90,35,70,40,80); } else if (mouseX > width/4 && mouseY > height/4){
background(0,255,0);
line(width/2,0,width/2,height);
line(0,height/2,width,height/2);
}
else {
background(0);
}
line(width/2,0,width/2,height);
line(0,height/2,width,height/2);
}