La fonction qui suit répète une image quatre fois sur l’écran, avec un effet d’inversion qui permet donc de créer un kaléidoscope.
L’image d’origine est celle-ci :

void repeteLimage(PImage g){
image(g,0,0);
pushMatrix();
translate(width,0);
scale(-1,1);
image(g,0,0);
popMatrix();
pushMatrix();
translate(width,height);
scale(-1,-1);
image(g,0,0);
popMatrix();
pushMatrix();
translate(0,height);
scale(1,-1);
image(g,0,0);
popMatrix();
}
L’image finalement obtenue à l’écran est celle-ci :
