Advertisement
xeromino

dis

Apr 22nd, 2015
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. PImage img1;
  2. int posX, posY, w, h, frames=240;
  3. float theta, d;
  4.  
  5. void setup() {
  6.   img1 = loadImage("pic2.jpg");
  7.   size(540,img1.height);
  8.   posX = int(random(width));
  9.   posY = int(random(height));
  10.   w = h = 200;
  11.   d = 100;
  12. }
  13.  
  14. void draw() {
  15.   image(img1, 0, 0);
  16.   posX = int(width/2+cos(theta)*d);
  17.   posY = int(height/2+sin(theta)*d);
  18.   for (int x=posX-w/2; x<posX+w/2; x++) {
  19.     for (int y=posY-h/2; y<posY+h/2; y++) {
  20.       color col1= img1.get(x+10, y);
  21.       set(x, y, col1);
  22.     }
  23.   }
  24.   //ellipse(posX,posY,10,10);
  25.   theta += TWO_PI/frames;
  26.   if (frameCount<=frames) saveFrame("image-###.gif");
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement