Processing is a flexible software sketchbook and a language for learning how to code within the context of the visual arts.
プロセッシングはjavaで、主にアーティスト・デザイナー向けです。
processing
size(200, 200); smooth(); background(255); rect(50, 50, 80, 30);

角丸
rect(50, 50, 80, 30, 10);
rectMode()
rectMode(CORNER); rect(50, 50, 30, 30); rectMode(RADIUS); rect(50, 50, 30, 40);
fill(255, 0, 0, 127); rect(50, 50, 30, 40);
枠線
stroke(#ff0000); strokeWeight(3); fill(127); rect(50, 50, 100, 100);
円、線
stroke(#ff0000); fill(#999999); line(50, 50, 100, 100); ellipse(50, 50, 80, 80); arc(50, 50, 80, 80, 0, radians(180));
矢印
stroke(#ff0000); fill(#999999); beginShape(); vertex(100, 20); vertex(120, 100); vertex(100, 80); vertex(80, 100); endShape(CLOSE);
画像の表示
PImage img;
img = loadImage("a.jpg");
image(img,10, 10);
テキスト描画
PFont f;
f = createFont("Helvetica", 16, true);
textFont(f, 12);
fill(#ff0000);
text("hello world", 100, 100);
座標空間の変更
fill(#ff0000, 127); noStroke(); rect(10, 10, 50, 50); fill(#0000ff, 127); noStroke(); pushMatrix(); translate(10, 10); rect(10, 10, 50, 50); popMatrix();
立体
size(200, 200, P3D); smooth(); background(255); lights(); pushMatrix(); translate(50, 50, 0); rotateX(radians(30)); rotateY(radians(40)); rotateZ(radians(10)); box(40); popMatrix();
setup()
void setup(){
size(200, 200, P3D);
smooth();
background(255);
noStroke();
fill(#ff0000);
frameRate(30);
}
int x = 0;
int y = 0;
void draw(){
rect(x, y, 100, 100);
x++;
y++;
println(frameCount);
}
マウス情報
int r = 100;
void draw(){
ellipse(mouseX, mouseY, r, r);
}