Digital Craft 3: interactive sketch or patterns

My file incorporates the use of an animation I created and coding bouncing balls through processing.

Movie Manipulation Real-1ov5xhj

import processing.video.*;
Movie myMovie;
int rad1= 35; //purple
int rad2 = 40; //orange
int rad3 = 30; // green
int rad4 = 60; //red
int rad5 = 50; //magenta

//starting position of shape;
float xpos1=width/2;
float xpos2=width/2;
float xpos3=width/2;
float xpos4=width/2;
float xpos5=width/2;

float ypos1 = height/2;
float ypos2 = height/2;
float ypos3 = height/2;
float ypos4 = height/2;
float ypos5 = height/2;

float xspeed=2.8;
float yspeed = 2.2;

int xdirection1 =3; //left or right
int ydirection1 = 7; //top to bottom

int xdirection2 =8; //left or right
int ydirection2 = 3; //top to bottom

int xdirection3 =3; //left or right
int ydirection3 = 5; //top to bottom

int xdirection4 =4; //left or right
int ydirection4 = 10; //top to bottom

int xdirection5 =11; //left or right
int ydirection5 = 4; //top to bottom

 

void setup() {
size(800,1000);
myMovie = new Movie(this, “image.mov”);
myMovie.loop();
noStroke();
frameRate(30);
ellipseMode(RADIUS);

}

// Called every time a new frame is available to read
void movieEvent(Movie myMovie) {
myMovie.read();
}

void draw() {
image(myMovie,0,0);

xpos1=xpos1+(xspeed*xdirection1);
ypos1 = ypos1+(yspeed*ydirection1);

xpos2=xpos2+(xspeed*xdirection2);
ypos2 = ypos2+(yspeed*ydirection2);

xpos3=xpos3+(xspeed*xdirection3);
ypos3 = ypos3+(yspeed*ydirection3);

xpos4=xpos4+(xspeed*xdirection4);
ypos4 = ypos4+(yspeed*ydirection4);

xpos5=xpos5+(xspeed*xdirection5);
ypos5 = ypos5+(yspeed*ydirection5);

if(xpos1 >width-rad1 || xpos1 <rad1){
xdirection1*=-1;
}
if (ypos1 > height-rad1 || ypos1 < rad1) {
ydirection1 *= -1;
}

if(xpos2 >width-rad2 || xpos2 <rad2){
xdirection2*=-1;
}
if (ypos2 > height-rad2 || ypos2 < rad2) {
ydirection2 *= -1;
}

if(xpos3 >width-rad3 || xpos3 <rad3){
xdirection3*=-1;
}
if (ypos3 > height-rad3 || ypos3 < rad3) {
ydirection3 *= -1;
}

if(xpos4 >width-rad4 || xpos4 <rad4){
xdirection4*=-1;
}
if (ypos4 > height-rad4 || ypos4 < rad4) {
ydirection4 *= -1;
}

if(xpos5 >width-rad5 || xpos5 <rad5){
xdirection5*=-1;
}
if (ypos5 > height-rad5 || ypos5 < rad5) {
ydirection5 *= -1;
}

fill(127,0,255,150);
ellipse(xpos1,ypos1, rad1,rad1);

fill(255,128,0,150);
ellipse(xpos2,ypos2, rad2,rad2);

fill(128,255,0,150);
ellipse(xpos3,ypos3, rad3,rad3);

fill(255,0,0,150);
ellipse(xpos4,ypos4, rad4,rad4);

fill(255,0,127,150);
ellipse(xpos5,ypos5, rad5,rad5);

}

Leave a reply

Skip to toolbar