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
指定した球面角から 3次元のベクトルを生成します。
| 引数名 | 内容 | 備考 | オプション | デフォルト値 |
|---|---|---|---|---|
| theta | 極角 | 単位: ラジアン | ||
| phi | 方位角 | 単位: ラジアン | ||
| length | 長さ | ○ | 1 |
p5.Vectorオブジェクト