by 鄭婷卉 卉潔!?
Processing
網頁
Processing通過可視化的方式輔助編程教學,並在此基礎之上表達數字創意。 Processing基於Java語言,進一步簡化了語法,並用圖形編程模式取代了命令行程序模式。
size (width, height);
size(150, 200);line(x1, y1, x2, y2);
(x1, y1)
(x2, y2)
size(160, 320);
line(100, 50, 200, 150);ellipse(x, y, width, height);
(x, y)
width
height
ellipse(50, 50, 80, 80);rect(x, y, width, height);
width
height
(x, y)
size(150, 300);
rect(50, 50, 50, 100);quad(x1, y1, x2, y2, x3, y3, x4, y4);
(x1, y1)
(x2, y2)
(x3, y3)
(x4, y4)
size(150, 300);
quad(50, 50, 100, 100, 120, 150, 130, 270);triangle(x1, y1, x2, y2, x3, y3)
(x1, y1)
(x2, y2)
(x3, y3)
size(100, 200);
triangle(30, 40, 60, 50, 90, 150);strokeWeight(num);
裡面填的數字代表筆畫粗細為幾個像素strokeJoin(ROUND/BEVEL);
控制線段遇到轉角的型:圓角/斜角
strokeCap(ROUND/SQUARE);
控制線段在開頭與結尾的樣子:圓形/方形
smooth(); / noSmooth();
控制線段的圓滑性
background(R, G, B);
size(300, 300);
background(0, 0, 0);fill(R, G, B, alpha);
size(300, 300);
background(255, 255, 255);
fill(151, 203, 255, 0);
rect(20, 30, 40, 40);
fill(151, 203, 255, 50);
rect(40, 50, 40, 40);
fill(151, 203, 255, 100);
rect(60, 70, 40, 40);
fill(151, 203, 150, 150);
rect(80, 90, 40, 40);
fill(151, 203, 255, 255);
rect(90, 110, 40, 40);void setup(){
size(600, 600);
background(128, 128, 255);
}
void draw(){
strokeWeight(15);
strokeJoin(ROUND);
rect(mouseX, mouseY, 100, 100);
}