We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi there,
first of all, I just started coding a few days ago. So I wonder if it's possible to move a figure I've created with shape primitives together as one through the window, which is 800x600 in size. I want to copy it, but don't want to redefine every single position of every single shape. That would be a real pain.
// Pinguin 1
fill(#FFFFFF);
ellipse(430, 470, 20, 30);
ellipse(450, 470, 20, 30);
fill(#626262);
ellipse(440, 445, 45, 65);
fill(#626262);
ellipse(440, 410, 45, 35);
fill(#FFFFFF);
ellipse(440, 410, 40, 30);
fill(#626262);
ellipse(432, 406, 10, 8);
fill(#00D3ED);
ellipse(432, 406, 6, 5);
fill(#626262);
ellipse(448, 406, 10, 8);
fill(#00D3ED);
ellipse(448, 406, 6, 5);
fill(#FFD31F);
triangle(430, 415, 450, 415, 440, 422);
fill(#626262);
ellipse(422, 435, 20, 20);
ellipse(458, 435, 20, 20);
fill(#838383);
ellipse(440, 445, 25, 35);
Best Regards, iSpectra
Answers
The simplest way is to use translate(). Please check the reference for usage.
The other is to transform it into a PImage like I did below:
http://studio.processingtogether.com/sp/pad/export/ro.9ck0KLYubLcZG/latest
Thank you both! translate() {} did the trick for me.