- 画面サイズ: size(x, y)
- 点と線: point(x, y), line(x1, y1, x2, y2)
- 多角形: rect(x1, y1, w, h), triangle(x1, y1, x2, y2, x3, y3), quad(x1, y1, x2, y2, x3, y3, x4, y4)
- 多角形モード: rectMode([CORNER, CENTER, CORNERS])
- 円と弧: ellipse(xc, yc, dw, dh), arc(xc, yc, dw, dh, radians(rs), radians(re))
- 曲線: curve(x1, y1, x2, y2, x3, y3, x4, y4), bezier(x1, y1, cx1, cy1, x2, y2, cx2, cy2)
- 複雑な形: beginShape(); vertex(x1, y1); vertex(x2, y2).. endShape(CLOSE);
- 複雑な曲形: beginShape(): curveVertex(x1, y1).. endShape();
- 色モード: colorMode([HSB, RGB], range(h_range, s_range, b_range))
- 背景色: background([grayscale, 16bit, (H, S, B/R, G, B)])
- 線の属性: stroke([grayscale, 16bit, (H, S, B/R, G, B)], opac), noStroke(), strokeWeight(w)
- 面の属性: fill([grayscale, 16bit, (H, S, B/R, G, B)], opac), noFill()
- エッジの属性: smooth(), noSmooth()
- データ型: boolean, int, float, color, byte, char
- 変数宣言: int i_data; float f1_data, f2_data; int i_data = 10
- 型変換: boolean(string_data), int(data)
- 色データ型: color c = color(h, s, b); fill(c)
- システム変数: width, height
- 座標変換: translate(moveX, moveY), rotate(radians(120)), scale(0.5), pushMatrix(), popMatrix()
- 画像の読み込み: PImage img = loadImage("sample.jpg")
- 画像の表示: image(img, x, y, w, h)
- 画像モード: imageMode([CORNER, CORNERS, CENTER])
- 画像の色指定: tint([grayscale, 16bit, (H, S, B/R, G, B)]), noTint()
- 画像の操作: img.width, img.height, img.copy(), img.mask(other_pimage)
- 文字の表示: textSize(24); textAlign(CENTER), text("hello", x, y (w, h))
- フォントの指定: PFont font = loadFont("sample.vlw"); textFont(font)
- コンソール出力: println(x)
- ゆらぎの表現: rect(x+random(-range, range), y+random(-range, range), 10, 10)
- マウスの移動距離: dist(mouseX, mouseY, pmouseX, pmouseY)
- PDFに出力: import processing.pdf.*; size(x, y, "out.pdf"); exit()
- 初期化: void setup(){ size(x, y); background(); colorMode(); frameRate(r); }
- メインループ: void draw(){ stroke(color); int x = int(random(w)); int y = int(random(h)); rect(...) }
- 関数定義: void fadeToWhite(c, f){ noStroke(); fill(c, f); rectMode(CORNER); rect(0,0,width,height); }
- スピードの減衰: float FRICTION = 0.94; SpeedX *= FRICTION; X += SpeedX
- 円の動き: Angle += 10; X = CircleX + (R * cos(radians(Angle))); Y = CircleY + sin(radians(Angle))
- 落下の動き: float GRAVITY = 3; SpeedY += GRAVITY; Y += Speedy
- バネの動き: float distY = Y - SpringLen; Accy = -K * distY; SpeedY = FRICTION * (SpeedY + Accy)
- 引力の動き: float SCALE = 0.0005; float distX = X - targetX; Accx = SCALE * sq(distX); if(X>targeX) Accx = -Accx
- マウスの動き: float speed = dist(mouseX, mouseY, pmouseX, pmouseY)
- マウスクリック: void mousePressed(){ if(mouseButton == LEFT) ... }
- マウスの移動: void mouseMoved(){...}, void mouseDragged(){...}
- キーの入力: void keyPressed(){ switch(key){ case 'a':...break;}}, void keyReleased(){...}
- 配列宣言: int[] X = new int[Length], int[][] map = {{1,2,3},{4,5,6},{7,8,9}}
- マウスドラッグ: void mousePressed(){ if(OnMouse) onDrag = true }; void mouseReleased(){ OnDrag = false}
- 力をためる: if(mousePressed){ Power += 1}
- ピクセル操作: PImage img = loadImage("s.jpg"); img.loadPixels(); pos = (y*img.width)+x; pixels[pos] = img.pixels[pos]; updatePixels();
- 3D座標: size(x, y, P3D); line(x1, y1, z1, x2, y2, z2)
- クラス定義: public class Ball(){ Ball(){ ..initialize..} public void move(){...} }
- テキストファイルの読み込み: String[] Str; Str = loadString("data.txt"); text(Str, x, y)
- 時間の表示: text(year() + "/" + month() + "/" + day())
- 範囲変換: float mapped_val = map(mouseX, 0, width, 0, 100)
- 中間色変換:color c = lerpColor(color1, color2, map(x, 0, width, 0, 1))
- XMLを読む: XMLElement Xml = new XMLElement(this, xml_data); Xml.getChild(0).getContent()
- 音楽再生: import ddf.minim.*; Minim m = new Minim(this); AudioPlayer audio = m.loadFile("s.mp3", 2048);
- 音楽再生2: audio.play(), pause(), isPlaying, length, position, close(); m.stop()
- 波形発振: import ddf.minim.*;import ddf.minim.signals.*; Minim minim; AudioOutput out; SineWave sine; SquareWave square;
- 波形発振2: minim = new Minim(this); out = minim.getLineOut(Minim.STEREO); sine = new SineWave(440, 0.5, out.sampleRate()); out.addSignal(sine)
Friday, September 10, 2010
Processing methods
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment