thanks man i did it
float x=0,y=1;
void setup()
{
size(500,500);
}
void draw()
{
rect(10+x,10,50,50);
x+=y;
if (x>width-50) {
}
but now it have more
when it hit from any edge it should appear of the canvas to the opposite edge. For example, if it flies off the top of the canvas, it should reappear at the bot
do u know how to do it ?