(p5camera).move

def setup 
  createCanvas(100, 100, WEBGL)
  normalMaterial
  @cam = createCamera
  @delta = 0.5
end

def draw 
  background(200)

  # move the camera along its local axes
  @cam.move(@delta, @delta, 0)

  # every 150 frames, switch direction
  if frameCount % 150 == 0
    @delta *= -1
  end

  translate(-10, -10, 0)
  box(50, 8, 50)
  5.times do
    translate(15, 15, 0)
    box(50, 8, 50)
  end
end

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

[p5.js] (p5.Camera.obj).move

概要

向きを維持したままカメラの位置を移動します。

書式

obj.move(x, y, z)

引数

引数名内容備考オプションデフォルト値
xx方向の移動量
yy方向の移動量
zz方向の移動量

戻値

obj (メソッドを呼び出した p5cameraオブジェクト自身)

備考

関連