animation.pde

来自「This is processing for java examples.」· PDE 代码 · 共 28 行

PDE
28
字号
// Class for animating a sequence of GIFsclass Animation {  PImage[] images;  int imageCount;  int frame;    Animation(String imagePrefix, int count) {    imageCount = count;    images = new PImage[imageCount];    for (int i = 0; i < imageCount; i++) {      // Use nf() to number format 'i' into four digits      String filename = imagePrefix + nf(i, 4) + ".gif";      images[i] = loadImage(filename);    }  }  void display(float xpos, float ypos) {    frame = (frame+1) % imageCount;    image(images[frame], xpos, ypos);  }    int getWidth() {    return images[0].width;  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?