Rotating an Image around it's center


/ Published in: Processing
Save to your folder(s)



Copy this code and paste it in your HTML
  1. float counter;
  2. PImage img;
  3.  
  4. void setup()
  5. {
  6. counter=0.0;
  7. size(300,300);
  8. img=loadImage("brownplane.png");
  9. }
  10.  
  11. void draw()
  12. {
  13. background(0);
  14. counter++;
  15. translate(width/2-img.width/2, height/2-img.height/2);
  16. rotate(counter*TWO_PI/360);
  17. translate(-img.width/2, -img.height/2);
  18. image(img,0,0);
  19. }

URL: http://processing.org/discourse/yabb2/YaBB.pl?num=1251909297

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.