Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions BasicImages/BasicImages.pde
Original file line number Diff line number Diff line change
@@ -1 +1,35 @@
//sketch->add file: select file to add to data folder
//control+k is shortcut to access data folder

//declare variables
PImage pusheen;
float scaleFactor = .1;

void setup(){
size(600,800); //set size of screen
noCursor(); //rid of cursor
noStroke();

//initialize variables
pusheen=loadImage("Pusheen.jpg");
}

void draw(){
for(int i=0; i<50;i++){
int x=int(random(width));
int y=int(random(height));
fill(pusheen.get(x,y));
ellipse(x,y,20,20);
}

image(pusheen,mouseX,mouseY,pusheen.width*scaleFactor,pusheen.height*scaleFactor); //display image
}

void keyPressed(){ //run this once each time I press a key

if(keyCode==UP){ //if key is up arrow, increase scale factor
scaleFactor+=.01;
}else if(keyCode==DOWN&&scaleFactor>.2){ //otherwise, if key is down arrow AND scale factor is > .2, decrease scale factor
scaleFactor-=.1;
}
}
Binary file added BasicImages/data/Pusheen.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions IndependentImagePractice/IndependentImagePractice.pde
Original file line number Diff line number Diff line change
@@ -1 +1,38 @@
//declare variables
PImage pusheen;
PImage pusheen2;
PImage pusheen3;
PImage pusheen4;
PImage pusheen5;
PImage bat;

void setup(){

size(500,500); //set size of screen

//initialize variables
pusheen=loadImage("pusheen.png");
pusheen2=loadImage("pusheenat.jpg");
pusheen3=loadImage("pusheenbread.jpg");
pusheen4=loadImage("pusheengames.jpg");
pusheen5=loadImage("pusheenpizza.jpg");
bat=loadImage("batsignal.jpg");

pusheen.mask(bat); //mask the pusheen image

}

void draw(){

background(map(mouseY,0,height,0,255)); //draw a background

//display images
image(pusheen2,0,0,250,250);
image(pusheen3,0,250,250,250);
image(pusheen4,250,0,250,250);
image(pusheen5,250,250,250,250);

if(mousePressed){ //if the mouse is pressed...
image(pusheen,0,0,500,500); //...a new image will be displayed
}
}
Binary file added IndependentImagePractice/data/batsignal.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/pusheen.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/pusheenat.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/pusheenbread.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/pusheengames.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/pusheenpizza.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.