Help with a processing project
in
Programming Questions
•
4 months ago
I'm trying to create a button that is the first Image of a sequence of 8, when the Image is clicked it will play through the sequence once.
As of right now I have a rectangle as the place holder, Could anybody help me over this hurdle ?
float x = 400;
float y = 100;
float w = 30;
float h = 30;
float ranNum;
int ranNumRound;
PImage img;
void setup(){
size(800,500);
background(255);
stroke(0);
}
void draw(){
fill(0);
rect(x,y,w,h);
}
void mousePressed(){
if(mouseX>x && mouseX <x+w && mouseY>y && mouseY <y+h){
ranNum = random(9);
ranNumRound = round(ranNum);
println(ranNumRound);
img = loadImage("images/pic"+ ranNumRound +".gif");
tint(200,200,100,50);
image(img,random(width),random(height),img.width,img.height);
}
}
1