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

Function regenerate

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

Source from the content-addressed store, hash-verified

18}
19
20function regenerate() {
21 if (geom) {
22 freeGeometry(geom)
23 }
24 geom = buildGeometry(() => {
25 let n = round(random(5, 20))
26 for (let i = 0; i <= n; i++) {
27 push()
28 translate(
29 random(-1, 1)*width*0.05,
30 map(i, 0, n, height*0.4, -height*0.4) + random(-1,1)*height*0.05
31 )
32 rotateX(PI/2 + random(-1, 1) * PI * 0.15)
33 rotateZ(random(-1, 1) * PI * 0.15)
34 torus(
35 random(0.1, 0.3) * width,
36 random(0.01, 0.05) * width,
37 50,
38 30
39 )
40 pop()
41 }
42 })
43 geom.clearColors()
44}
45
46let lastScene = -1
47function draw() {

Callers 1

drawFunction · 0.85

Calls 3

mapFunction · 0.85
clearColorsMethod · 0.80
randomFunction · 0.50

Tested by

no test coverage detected