Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int num=8, cols=8, edge=50;
- PImage[] moon = new PImage[num];
- int c=0;
- void setup() {
- size(500, 500);
- int counter = 189;
- for (int i=0; i<num; i++) {
- String img = counter + ".png";
- println(img);
- moon[i]=loadImage(img);
- counter++;
- }
- frameRate(5);
- }
- void draw() {
- background(20);
- for (int x=0; x<cols; x++) {
- for (int y=0; y<cols; y++) {
- float px = map(x,0,cols,edge,width-edge);
- float py = map(y,0,cols,edge,height-edge);
- paintMoon(px, py,int(x), int(y));
- }
- }
- if (frameCount<=num) saveFrame("image-###.gif");
- }
- void paintMoon(float x, float y, int offX, int offY) {
- pushMatrix();
- translate(x, y);
- image(moon[(frameCount+offX)%num], 0, 0,50,50);
- popMatrix();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement