/
5.html
60 lines (48 loc) · 1.1 KB
/
5.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="canvas">
<meta name="author" content="hoskra">
<title>Crown shyness</title>
<style>
* {overflow: hidden;}
body {
margin: 0;
font-family: 'Courier New', Courier, monospace;
}
</style>
</head>
<body>
</body>
<script type="module">
import p5 from 'p5';
import * as d3 from 'd3';
import { Delaunay } from 'd3-delaunay';
import { getPoints } from './utils';
import { Forest, Tree } from './forest';
// config variables
let cnt = 400; // more than cca 400 has no effect
let maxMinPointDistance = 30;
// help variables
let W = window.innerWidth;
let H = window.innerHeight;
let f = 0;
let forest;
function setup() {
let canvas = createCanvas(W, H)
forest = new Forest(W, H, cnt, maxMinPointDistance);
// forest.curveToggle();
// noLoop()
}
function draw() {
f += 0.01
// forest.move(f);
forest.moveAndRegenerate(f);
forest.drawAll();
}
window.setup = setup;
window.draw = draw;
</script>
</html>