Processing.js画布不显示图像数组

时间:2016-09-20 18:27:03

标签: javascript jquery arrays canvas processing.js

我从服务器中读取了Ajax数据,其中包含字符串,当我循环播放时,我将获取所有图像并将其存储在数组中,之后我可以检索它们。但是当我试图在画布上展示它们时,没有什么是可怕的,因为浏览器无法如此装载图像,但我不是岸,如果有人知道如何解决这个问题请告诉我。这是我的草图的代码:

PImage img;
int x;
int y;
int pad = 10;
int bs = 50;
String[] Pictures = [];

void setup(){
  size(500,500);
  background(150);
  frameRate(1);
  //img = loadImage(pic);
}

void draw(){
    for (int i = 0; i < Pictures.length ; i++){ 
    String pic; 
        pic = Pictures[i];
        img = loadImage(pic);
        //println (pic);
        x = pad + (bs+pad)*i;
        y = pad;
        image(img,x,y,bs,bs);
        println(i);
        println(Pictures[i]);
    }

}

void change(String val){
String[]  list = split(val," ");
    for(int i = 0; i <list.length; i++){
        Pictures[i] = list[i];
        pic = Pictures[i];
        //println("Picture: "+Pictures[i]);
        //println("List: "+list[i]); 
        //println(list[i]);     
    }
}

0 个答案:

没有答案