I have a processing project where I want a dot moving on a given line.
I’ve put the line (as well as the background) into a PGraphics
object, and I’m redrawing it in the void draw()
in every frame.
The problem is this: It won’t overwrite the entire scene (ie. the “old” dots from previous frames persist). And if I delete it using background(255, 255, 255);
, it seems as though the PGraphics object gets deleted, because calling image
on it has no effect. (This same phenomenon occurs if I execute the following code in the void setup()
function:
background(255,255,255);
image(nameOfPGraphicsObject, 0, 0);
this yields an empty screen.)
I’d be grateful for any aid.