0

我的蜜蜂不会出现。在绘图循环中加载和显示图像的正确方法是什么?

/* @pjs preload="/static/uploaded_resources/p.8706/Flower-Ice-icon.png"; */
/* @pjs preload="/static/uploaded_resources/p.8706/bee.png"; */
void setup() {  // this is run once.   

    PImage img;
    PImage bee;
    // set the background color
    background(255);

    // canvas size (Variable aren't evaluated. Integers only, please.)
    size(256, 256); 

    img = loadImage("/static/uploaded_resources/p.8706/Flower-Ice-icon.png");
    bee = loadImage("/static/uploaded_resources/p.8706/bee.png");
    image(img, 0, 0);
} 
void draw() {  // this is run repeatedly.  
    image(bee, mouseX, mouseY);
}

这是草图的链接: http: //studio.sketchpad.cc/sp/pad/view/VfC92Mrf5o/rev.119

4

1 回答 1

2

Pjs 不支持使用多个预加载。相反,您需要用逗号分隔这两个图像作为单个预加载命令的参数。请参阅http://processingjs.org/reference/preload,“多个图像的语法”

于 2013-02-05T15:33:18.670 回答