Skip to content
23 changes: 23 additions & 0 deletions BasicImages/BasicImages.pde
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
PImage vac;
float scalefactor = .2;
PVector loc = new PVector (width/2,height/2), vel = PVector.random2D ();

void setup () {
size(800, 600);
vac=loadImage("vacation spot.jpg");
}

void draw() {
background(0);
image(vac, loc.x, loc.y,vac.width*scalefactor,vac.height*scalefactor);
loc.add(vel);
if (loc.x>width) {
loc.x=0;
} else if (loc.x<0){
loc.x = width;
}
if(loc.y>height){
loc.y=0;
} else if (loc.y<0){
loc.y= height;
}
}
Binary file added BasicImages/data/vacation spot.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 10 additions & 1 deletion FilteringImages/FilteringImages.pde
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@

PImage vacation;
void setup (){
size(800,600);
vacation = loadImage("vacation spot.jpg");
}
void draw (){
background (0);
image(vacation,0,0,width,height);
filter(GRAY);
}
Binary file added FilteringImages/data/vacation spot.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions IndependentImagePractice/IndependentImagePractice.pde
Original file line number Diff line number Diff line change
@@ -1 +1,35 @@
PImage beach;
PImage beachball;

PImage sunset; //declare variables
PVector loc = new PVector (0, height/4*3);
PVector vel = new PVector (10, 20);

void setup() {
size(800, 600); //size of canvas
beach=loadImage("beach.jpg");
sunset=loadImage("sunset.jpg");

beachball=loadImage("ball.png"); //load images
}

void draw() {
image(sunset, 0, 0, 800, 600);

image(beach, 0, 0, 800, 600); //added images
beach.blend(sunset, 0, 0, sunset.width, sunset.height, 0, 0, beach.width, beach.height, SOFT_LIGHT);
//blended sunset with beach
image(beachball, loc.x, loc.y, 100, 100); //beach ball location
loc.add(vel); //add velocity

if (loc.x>width) {
vel.x=-abs(vel.x);
} else if (loc.x<0) {
vel.x=abs(vel.x);
}
if (loc.y>height) {
vel.y=-abs(vel.y);
} else if (loc.y<0) {
vel.y=abs(vel.y); //bouncing of beach ball
}
}
Binary file added IndependentImagePractice/data/ball.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added IndependentImagePractice/data/beach.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added IndependentImagePractice/data/sunset.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions MaskingImages/MaskingImages.pde
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
PImage beach; PImage vacation;

void setup(){
size (800,600);
vacation=loadImage("vacation spot.jpg");
beach=loadImage("beach gray.jpg");
vacation.mask(beach);
}

void draw (){
background(map(mouseY,0,height,0,255));
image(vacation,0,0);
}
Binary file added MaskingImages/data/beach gray.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MaskingImages/data/vacation spot.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.