标题: processing数组-图片系列 [打印本页]

作者: 51hei小林    时间: 2016-9-24 22:58
标题: processing数组-图片系列
如下用processing实现图片切换,改天在raspberry pi运行下看看效果

int numFrames = 5;
PImage [] images = new PImage[numFrames];
int currentFrame = 1;


void setup(){
  size(440,360);
  for(int i=1;i<images.length;i++){
  String  imageName = "frame-"+ nf(i,4)+".png";
  images[i-1] = loadImage(imageName);
  }
  frameRate(1); //每贞一秒钟
}

void draw(){
    int s =  second();
  //  println(s);
    if(s%3==0){ //每隔3秒钟换图一次
    changePic();
    }
}










欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1