trying to add a background image that does not coveran ellipse i have created
in
Programming Questions
•
6 months ago
Hi
I have been trying to add a background image to an existing piece of code which has some ellipse. when I add the image, it covers my other shapes. Any help to help me put this image in the background instead of covering my ellipse would be really appreciated.
Thanks
// The next line is needed if running in JavaScript Mode with Processing.js
/* @pjs preload="CP.jpg"; */
/* @pjs preload="CP.jpg"; */
PImage bg;
int y;
int y;
void setup() {
size(1440, 1200);
smooth();
noStroke();
size(1440, 1200);
smooth();
noStroke();
//Kick
fill(255,0,0);
ellipse(300, 400, 200, 200);
fill(255,0,0);
ellipse(300, 400, 200, 200);
//Snare
fill(255,255,0);
ellipse(450, 300, 110, 35);
fill(255,255,0);
ellipse(450, 300, 110, 35);
//HiHat
fill(0,255,255);
ellipse(90, 260, 100, 20);
fill(0,255,255);
ellipse(90, 260, 100, 20);
//Tom1
fill(0,255,0);
ellipse(240, 240, 95, 75);
fill(0,255,0);
ellipse(240, 240, 95, 75);
//Tom2
fill(255,200,200);
ellipse(355, 240, 95, 75);
fill(255,200,200);
ellipse(355, 240, 95, 75);
//FloorTom
fill(255,200,200);
ellipse(175, 310, 120, 50);
fill(255,200,200);
ellipse(175, 310, 120, 50);
//OHRight
fill(255,200,200);
ellipse(435, 190, 100, 20);
fill(255,200,200);
ellipse(435, 190, 100, 20);
//OHLeft
fill(255,200,200);
ellipse(190, 180, 100, 30);;
fill(255,200,200);
ellipse(190, 180, 100, 30);;
bg = loadImage("CP.jpg");
}
}
void draw() {
background(bg);
stroke(226, 204, 0);
line(0, y, width, y);
y++;
if (y > height) {
y = 0;
}
}
background(bg);
stroke(226, 204, 0);
line(0, y, width, y);
y++;
if (y > height) {
y = 0;
}
}
1