We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, I am new to processing. I am trying to move a red circle along a line. I have a background (not just a color). The problem for animation is inside draw function I always have to call ellipse(x, y, w, h) function to create a new ellipse and to hide the previous one I need to call background(255) before the ellipse(). But in my case the background is a static content generated with code in setup() and I do not want to redraw it. So without creating hundreds of ellipses inside draw() can I somehow create an ellipse object in setup() and just change it's co-ordinates inside draw()? Can anybody help please?
Answers
You can crop a region from the canvas (or a PGraphics) and store it as a PImage using get()! *-:)
http://processing.org/reference/get_.html
2 online examples:
http://studio.processingtogether.com/sp/pad/export/ro.9ck0KLYubLcZG/latest
http://studio.processingtogether.com/sp/pad/export/ro.9lSicL0a3WMfi/latest (run it offline!)
Thanks a lot. The problem seems to be solved. I created a small red icon instead of an ellipse, using PImage I am changing its co-ordinate. Thank you.