实例1:加载图片
把一张图片直接拖入编辑器界面,这样自动会在本程序项目文件夹下创建dada文件夹,图片被复制在dada目录下。
float x;
PImage p1;
void setup(){
size(720,404);
background(20);
x = width;
frameRate(16);
p1 = loadImage("f35.png");
//size(360,202);
//fullScreen();
// ---------------- Variables -------------------
}
void draw(){
image(p1,x,0);
x -= 5;
if (x <= 0) x = 0;
}
void keyPressed() {
println("Key Pressed, key (",key,"), keyCode(", keyCode, ")");
if (key == 32) {
setup();
}
}