https://www.processing.org/re...
https://www.openprocessing.org/
http://www.vizinsight.com/
http://learningprocessing.com/
http://www.wblut.com/processing/
http://www.wblut.com/construc...
http://www.complexification.n...
http://ofcourse.io/
http://learn.travelchinawith.me
http://zenbullets.com/abandon...
單擊run
shift+鼠標單擊run 全屏
Processing文件名不容許空格和連字符-,也不能以數字開始,.pde結尾數組
print() println() printArray()
void setup() {} //定義畫布大小,背景,畫筆等 僅執行一次後跳到draw() void draw() {} //程序做畫 無限循環運行 void functionName() {} //自定義函數 void mousePressed(){} //鼠標事件 void keyPressed(){} //鍵盤事件 class className(){} //自定義類
size(Width,Height);//畫布大小 strokeWeight(5); //畫筆大小 noLoop(); //循環一次 delay(100);
int
( –2147483648 ~ 2147483647)app
int a; a = 23; int b = -256; int c = a + b;
float
String
(S大寫)boolean
color
dom
color c1 = color(204, 153, 0); color c2 = #FFCC00;
char
(字母)byte
( –128 ~ 127)short
( –32768 ~ 32767)long
double
全局變量,局部變量,儘可能用駝峯命名,class是用大寫字母開頭函數
width
—sketch窗口的像素寬度.height
—sketch窗口的像素高度.
size(150, 200, P3D);
delay()
smooth();
cursor()
noCursor()
fullScreen()
frameCount —運行的幀數.
frameRate —每秒運行的幀數.
screen.width —整個螢幕的像素寬度
screen.height —整個螢幕的像素高度.oop
key —最近的一次鍵盤敲擊.
keyCode —鍵盤敲擊的數字代碼(numeric code).
keyPressed —真仍是假?鍵盤被敲擊了麼?
mousePressed —真仍是假?鼠標被點擊了麼?
mouseButton —哪一個鍵被點擊了?左鍵?右鍵?仍是中鍵?.net
//載體 PVector v1; v1 = new PVector(40, 20); v1.x x1.y
int[] numbers = {1,2,3}; numbers[0]; float[] values = new float[1000]; Car[] cars = new Car[num]; balls = (Ball[]) append(balls,b);
color c1 = color(204, 153, 0); colorMode(HSB, 100); colorMode(RGB, 100); fill(); noFill(); stroke(); noStroke(); alpha(rgba); green(rgb); blue(rgb); red(rgb); lerpColor(c1, c2, amt)
PImage img; img = loadImage("1.jpg"); background(img); image(img,0,0); imageMode(CORNER); CORNER, CORNERS, or CENTER save("C:\Users\shumei\Desktop"); saveFrame("line-######.png");
loadPixels(); pixels[]; updatePixels(); red(color); green(color); blue(color);
filter(MODE); //THRESHOLD, GRAY, OPAQUE, INVERT, POSTERIZE, BLUR, ERODE, DILATE blend(x,y,width,height,dx,dy,dwidth,dheight,MODE) blend(srcImg,x,y,width,height,dx,dy,dwidth,dheight,MODE) //BLEND, ADD, SUBTRACT, LIGHTEST, DARKEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, BURN img1.mask(); copy(x,y,width,height,dx,dy,dwidth,dheight) copy(srcImg,x,y,width,height,dx,dy,dwidth,dheight)
arc(x, y, width, height, start, stop) arc(x, y, width, height, start, stop, mode) ellipse(x, y, width, height) line(x1, y1, x2, y2) line(x1, y1, z1, x2, y2, z2) point(x, y) point(x, y, z) quad(x1, y1, x2, y2, x3, y3, x4, y4) rect(x, y, width, height) rect(x, y, width, height, radius) rect(x, y, width, height, tl, tr, br, bl) triangle(x1, y1, x2, y2, x3, y3)
mouseX 鼠標座標
mouseY 鼠標座標
pmouseX 移動鼠標以後的鼠標原位置座標
pmouseY 移動鼠標以後的鼠標原位置座標
abs()絕對值(absolute value)
frameRate(30) 1~60幀
rectMode(CENTER);
random(256);
dist();
max();
textAlign();
x= constrain(x,0,100);code