MCPcopy Index your code
hub / github.com/processing/p5.js / draw

Function draw

test/types/basic.ts:47–72  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45
46let lastScene = -1
47function draw() {
48 const period = 8000
49
50 const ms = millis()
51 const scene = floor(ms / period)
52 if (scene !== lastScene) {
53 regenerate()
54 lastScene = scene
55 }
56
57 const t = (ms % period)/period
58 background(0)
59 orbitControl()
60 const s = map(t, 0, 0.2, 0, 1, true) * map(t, 0.8, 1, 1, 0, true)
61 directionalLight(s*255, s*255, s*255, -0.4, 0, 1)
62 directionalLight(s*255, s*255, s*255, 0.4, 0, 1)
63 directionalLight(s*255, s*255, s*255, 0, -0.4, 1)
64 directionalLight(s*255, s*255, s*255, 0, 0.4, 1)
65 noStroke()
66 fill(100)
67 specularMaterial(255)
68 shininess(400)
69 scale(0.8)
70 rotateY(millis() * 0.0001)
71 model(geom)
72}
73
74function mousePressed(){
75 //only type-checking the relevant properties exist on the mouseButton object type.

Callers

nothing calls this directly

Calls 2

regenerateFunction · 0.85
mapFunction · 0.85

Tested by

no test coverage detected