http://www.contrechoc.com/crosslab/applet/rotateDisplayImage.html
PImage a; // Declare variable "a" of type PImage
float theta = 0;//rotating angle in degrees
void setup() {
size(200, 200);
a = loadImage("jelly.jpg"); // Load the image into the program
}
void draw() {
// Displays the image at its actual size at point (0,0)
pushMatrix();//used to get an independent rotation
translate(width/2, height/2);
rotate(radians(theta));
translate(-a.width/2, -a.height/2);
image(a, 0, 0);
popMatrix();//sort of boundaries for a rotation translation
pushMatrix();//start another rotation
translate(width/4, height/4);
rotate(radians(-2*theta));
translate(-a.width/4, -a.height/4);
image(a, 0, 0, a.width/2, a.height/2);
popMatrix();//
theta+=1;
}
Aucun commentaire:
Enregistrer un commentaire