Loading...
Logo
Processing Forum
I am displaying tweets on a static map. The tweets are plotted over time on the map, so I don't set any background color in the Draw() method. Otherwise it will refresh the screen and plotted points will disappear. 

However, I want to move a small circle from one location to another (based on plotted tweets) without drawing a line. Is there anyway to do so without setting background in the Draw()?

Replies(4)

Duplicate with answers you did in (at least) another thread. Since I cannot answer to your comments, I just removed them...

The usual way of updating the display in Processing is to redraw the whole sketch area on each draw() call.
Why you don't want to do it this way? Performance reason?
At worst, you can use the old way used in video games in the times performances were very low: save the portion of background around the area where you will draw your marker, draw it, then on next frame, restore the portion of background and repeat for the new place.
Not sure if it is worth the trouble.
Thanks! I was worried about performance (the sketch is listening to streaming API from twitter). But I don't have any other choice. I will try how effective the 'old game style' is. 
Use PG graphics and draw another transparent layer and refresh it. 


PGraphics pg;

void setup() {
  size(100, 100);
  pg = createGraphics(40, 40);
}

void draw() {
  pg.beginDraw();
  pg.background(100,50);// pg.background(BG_color,Alpha);
  pg.stroke(255);
  pg.line(20, 20, mouseX, mouseY);
  pg.endDraw();
  image(pg, 9, 30); 
  image(pg, 51, 30);
}
Don't worry about performance: try, and optimize only if performance is poor!
Drawing a background image should not be so slow, unless you have a very large sketch, perhaps.