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
向きを維持したままカメラの位置を移動します。
| 引数名 | 内容 | 備考 | オプション | デフォルト値 |
|---|---|---|---|---|
| x | x方向の移動量 | |||
| y | y方向の移動量 | |||
| z | z方向の移動量 |
obj (メソッドを呼び出した p5cameraオブジェクト自身)