Skip to content

Instantly share code, notes, and snippets.

@tboydar
Last active December 24, 2015 15:29
Show Gist options
  • Save tboydar/6820500 to your computer and use it in GitHub Desktop.
Save tboydar/6820500 to your computer and use it in GitHub Desktop.
processing in 實踐
//show photos
PImage photo_a;
PImage photo_b;
PImage photo_c;
int mode = 0;
void setup() //設定
{
size(300, 300);
photo_a = loadImage("a.jpg");
photo_b = loadImage("b.jpg");
photo_c = loadImage("c.jpg");
frameRate(10);
}
void draw() //繪圖
{
background(0);
if (mode == 0) image(photo_a, 30, 10, 30, 30);
if (mode == 1) image(photo_b, 30, 50, 30, 30);
if (mode == 2) image(photo_c, 30, 90, 30, 30);
}
void mousePressed() //滑鼠按下
{
mode = mode + 1;
println("mode:"+mode);
if (mode == 3) mode = 0;
println(mouseX);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment