perspective

概要

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

[p5.js] perspective

サンプル

def setup
  createCanvas(100, 100, WEBGL)
  perspective(PI / 3.0, width / height, 0.1, 500)
end

def draw
  background(200)
  # orbitControl
  normalMaterial

  rotateX(-0.3)
  rotateY(-0.2)
  translate(0, 0, -50)

  push do
    translate(-15, 0, sin(frameCount / 30) * 95)
    box(30)
  end
  push do
    translate(15, 0, sin(frameCount / 30 + PI) * 95)
    box(30)
  end
end

構文

戻値