P5Vector.fromAngles

def setup
  createCanvas(100, 100, WEBGL)
  fill(255)
  noStroke
end

def draw
  background(255)
  t = millis / 220
  # add three point lights
  pointLight(color('#f00'), P5Vector.fromAngles(t * 1.0, t * 1.3, 100))
  pointLight(color('#0f0'), P5Vector.fromAngles(t * 1.1, t * 1.2, 100))
  pointLight(color('#00f'), P5Vector.fromAngles(t * 1.2, t * 1.1, 100))
  sphere(35)
end

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

[p5.js] fromAngles

概要

指定した球面角から 3次元のベクトルを生成します。

書式

P5Vector.fromAngles(theta, phi, [length])

引数

引数名内容備考オプションデフォルト値
theta極角単位: ラジアン
phi方位角単位: ラジアン
length長さ1

戻値

p5.Vectorオブジェクト

備考

関連