11=interface=20130607
TRANSCRIPT
![Page 1: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/1.jpg)
ProcessingProcessing
11
Interface IInterface I 介面 介面 II
![Page 2: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/2.jpg)
Input : Mouse I, IIInput : Mouse I, II
![Page 3: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/3.jpg)
mouseX, mouseY,pmouseX, pmouseY, mousePressed, mouseButton,cursor(), noCursor().
![Page 4: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/4.jpg)
![Page 5: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/5.jpg)
void setup() { size(400,400); background(255); ellipseMode(CENTER);}
void draw() { noFill(); stroke(2); circles(mouseX,mouseY);}
void circles(int x, int y) { translate(x,y); ellipse(0,0,50,50);}
![Page 6: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/6.jpg)
void setup() { size(400,400); background(255); ellipseMode(CENTER);}
void draw() { noFill(); stroke(2); circles(mouseX,mouseY);}
void circles(int x, int y) { translate(x,y); ellipse(0,0,50,50);}
![Page 7: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/7.jpg)
![Page 8: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/8.jpg)
void setup() { size(400,400); background(255); ellipseMode(CENTER);}
void draw() { noFill(); stroke(2); if (mousePressed == true) { circles(mouseX,mouseY); }}
void circles(int x, int y) { translate(x,y); ellipse(0,0,50,50);}
![Page 9: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/9.jpg)
![Page 10: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/10.jpg)
void setup() { size(400,400); background(255); ellipseMode(CENTER); smooth(); strokeWeight(3);}
void draw() { noStroke(); fill(random(255),random(255),random(255),random(200)); if (mousePressed == true) { circles(mouseX,mouseY);}}
void circles(int x, int y) { translate(x,y); ellipse(0,0,50, 50);}
![Page 11: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/11.jpg)
![Page 12: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/12.jpg)
void setup() { size(400,400); background(255); ellipseMode(CENTER); smooth(); strokeWeight(3);}
void draw() { noStroke(); fill(random(255),random(255),random(255),random(200)); if (mousePressed == true) { circles(mouseX,mouseY);}}
void circles(int x, int y) { translate(x,y); ellipse(0,0,50,random(50));}
![Page 13: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/13.jpg)
![Page 14: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/14.jpg)
void circles(int x, int y) { translate(x,y); ellipse(0,0,50,random(50));}
void circles(int x, int y) { translate(x,y); ellipse(0,0,random(100),random(100));}
![Page 15: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/15.jpg)
void setup() { size(400,400); background(255); ellipseMode(CENTER); smooth(); strokeWeight(3);}
void draw() { noStroke(); fill(random(255),random(255),random(255),random(200)); if (mousePressed == true) { circles(mouseX,mouseY);}}
void circles(int x, int y) { translate(x,y); ellipse(0,0,random(100),random(100));}
![Page 16: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/16.jpg)
![Page 17: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/17.jpg)
void setup() { size(400,400); background(255); ellipseMode(CENTER); smooth(); strokeWeight(3);}
void draw() { if (mousePressed == true) { lines(mouseX,mouseY);}}
void lines(int x, int y) { translate(x,y); line(0,0,random(100),random(100));}
![Page 18: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/18.jpg)
![Page 19: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/19.jpg)
void lines(int x, int y) { translate(x,y); // stroke(random(255)); stroke(random(255),random(255),random(255)); float d = random(50); line(0,0,d,d);}
![Page 20: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/20.jpg)
void setup() { size(400,400); background(255); ellipseMode(CENTER); smooth(); strokeWeight(3);}
void draw() { if (mousePressed == true) { lines(mouseX,mouseY);}}
void lines(int x, int y) { translate(x,y); // stroke(random(255)); stroke(random(255),random(255),random(255)); float d = random(50); line(0,0,d,d);}
![Page 21: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/21.jpg)
![Page 22: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/22.jpg)
void setup() { size(400,400); }void draw() { noFill(); stroke(1); rectangles(mouseX,mouseY);}void rectangles(int x, int y) { translate(x,y); rect(-5,-5,10,10); rect(-15,-15,30,30); rect(-25,-25,50,50);}
![Page 23: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/23.jpg)
![Page 24: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/24.jpg)
void setup() { size(400,400); }void draw() { noFill(); stroke(1); if (mousePressed == true) { rectangles(mouseX,mouseY);}}void rectangles(int x, int y) { translate(x,y); rect(-5,-5,10,10); rect(-15,-15,30,30); rect(-25,-25,50,50);}
![Page 25: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/25.jpg)
![Page 26: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/26.jpg)
void setup() { size(400,400); ellipseMode(CENTER); strokeWeight(2); smooth(); }void draw() { noFill(); stroke(1); if (mousePressed == true) { Bulleye(mouseX,mouseY);}}void Bulleye(int x, int y) { translate(x,y); fill(255); ellipse(0,0,50,50); fill(0); ellipse(0,0,30,30); fill(255); ellipse(0,0,10,10);}
![Page 27: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/27.jpg)
![Page 28: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/28.jpg)
void setup() { size(400,400); smooth();}void draw() { noFill(); stroke(1); if ((mousePressed == true) && (mouseButton == LEFT)) { rectangles(mouseX,mouseY);} if ((mousePressed == true) && (mouseButton == RIGHT)) { circles(mouseX,mouseY);}}void rectangles(int x, int y) { translate(x,y); rect(-5,-5,10,10); rect(-15,-15,30,30); rect(-25,-25,50,50);}
void circles(int x, int y) { translate(x,y); ellipse(0,0,10,10); ellipse(0,0,30,30); ellipse(0,0,50,50);}
![Page 29: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/29.jpg)
![Page 30: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/30.jpg)
int num = 10;
void setup(){ size(400, 400); smooth(); noFill();}
void draw() { background(255); for (int y = 0; y <= num; y ++) { for (int x = 0; x <= num; x ++) { stroke(random(255),random(255),random(255)); float posX = width / num * x; float posY = height / num * y; ellipse(posX, posY, 10, 10);}}}
![Page 31: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/31.jpg)
int num = 10;
void setup(){ size(400, 400); smooth(); noFill();}
void draw() { background(255); randomSeed(0); strokeWeight(mouseY / 50); for (int y = 0; y <= num; y ++) { for (int x = 0; x <= num; x ++) { stroke(random(255),random(255),random(255)); float posX = width / num * x; float posY = height / num * y; float shiftX = random(-mouseX, mouseX) / 20; float shiftY = random(-mouseX, mouseX) / 20; ellipse(posX+shiftX, posY+shiftY, mouseY/5, mouseY/5);}}}
![Page 32: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/32.jpg)
void setup() { size(100, 100); noCursor();}void draw() { background(204); if (mousePressed == true) { cursor();}}
![Page 33: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/33.jpg)
void setup() { size(100, 100); strokeWeight(8); smooth();}void draw() { background(204); line(mouseX, mouseY, pmouseX, pmouseY);}
![Page 34: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/34.jpg)
mousePressed(), mouseReleased(), mouseMoved(), mouseDragged()keyPressed(), keyReleased()loop(), redraw()
Input 3:Events (P.229)
![Page 35: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/35.jpg)
constrain(), dist(), abs(), atan2()
Input 4:Mouse II (P.237)
![Page 36: 11=Interface=20130607](https://reader036.vdocument.in/reader036/viewer/2022062902/577cca0b1a28aba711a53785/html5/thumbnails/36.jpg)
Ch. 23, 2706/07/2013