()
| 18 | } |
| 19 | |
| 20 | function 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 | |
| 46 | let lastScene = -1 |
| 47 | function draw() { |
no test coverage detected