translate

概要

p5.jsリファレンス(参考情報)

[p5.js] translate

サンプル

def setup
  background(200)
  translate(30, 20)
  rect(0, 0, 55, 55)
end
def setup
  background(200)
  rect(0, 0, 55, 55)   # Draw rect at original 0,0
  translate(30, 20);
  rect(0, 0, 55, 55)   # Draw rect at new 0,0
  translate(14, 14);
  rect(0, 0, 55, 55)   # Draw rect at new 0,0
end
def draw
  background(200)
  rectMode(CENTER)
  translate(width / 2, height / 2)
  translate(P5Vector.fromAngle(millis / 1000, 40))
  rect(0, 0, 20, 20)
end

構文

戻値