We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello All,
Is it possible to bring the background forward and clear the screen? effectively I want blank canvas for everything apart from the background. I also want this to be timed, I am aware of Millis() but lack the knowledge to where to put the lines of code.
Thank you!!
:)>- :)>- :)>- :)>-
int frames = 10;
PImage bg;
PGraphics pg[] = new PGraphics[frames];
void setup() {
size(1024, 768);
bg = loadImage("003-2.jpg");
for(int i=0; i<frames; i++) {
pg[i] = createGraphics(width, height);
pg[i].beginDraw();
pg[i].background(bg);
pg[i].stroke(255);
pg[i].strokeWeight(3);
pg[i].endDraw();
}
}
void draw() {
int currFrame = frameCount % frames; // 0 .. 19
if(mousePressed) {
pg[currFrame].beginDraw();
pg[currFrame].line(mouseX, mouseY, pmouseX, pmouseY);
pg[currFrame].endDraw();
}
image(pg[currFrame], 0, 0);
}
Answers
I fear I don't fully understand your question.
Perhaps you just need to call background() at the sketch level?
Hi PhiLho
I'm afraid I am a bit of a novice. I'm not quite sure where to put that line of code, I've tried repeatedly.
Also Is there anyway I can do that at timed intervals using millis()?
You can search forum for "timing" or millis().
this is an example I wrote for some other question:
I didn't understand the rest of your question. :)