我的蜜蜂不会出现。在绘图循环中加载和显示图像的正确方法是什么?
/* @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
最佳答案
Pjs 不支持使用多个预加载。相反,您需要用逗号分隔这两个图像作为单个预加载命令的参数。请参阅http://processingjs.org/reference/preload , “多个图像的语法”
关于javascript - 将图像加载到Processingjs中的绘制循环中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14699253/