-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
185 lines (157 loc) · 6.99 KB
/
index.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta property="description" content="2D flocking simulation!">
<meta property="og:title" content="Boids Simulation">
<meta property="og:description" content="2D flocking simulation!">
<meta property="og:url" content="https://boids.cubedhuang.com/">
<meta property="og:image" content="https://cubedhuang.com/logo.png">
<link rel="apple-touch-icon" sizes="57x57" href="https://cubedhuang.com/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://cubedhuang.com/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://cubedhuang.com/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://cubedhuang.com/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://cubedhuang.com/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://cubedhuang.com/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://cubedhuang.com/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://cubedhuang.com/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="https://cubedhuang.com/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="https://cubedhuang.com/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="https://cubedhuang.com/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="https://cubedhuang.com/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="https://cubedhuang.com/favicon-16x16.png">
<link rel="shortcut icon" href="https://cubedhuang.com/favicon.ico">
<link rel="manifest" href="https://cubedhuang.com/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
<meta name="theme-color" content="#2ecc71">
<link rel="stylesheet" href="./style.css">
<link rel="canonical" href="https://boids.cubedhuang.com/">
<link rel="author" href="https://cubedhuang.com/">
<link rel="publisher" href="https://cubedhuang.com/">
<title>Boids Simulation</title>
</head>
<body>
<div id="container" :class="menu ? '' : 'hidden'">
<h3>boids</h3>
<p>
left and right click to move the boids, or just watch their flocking patterns! <br>
double click to make an explosion <br>
middle click or click in the top right to toggle this menu <br>
press space to pause, and use . to advance one frame
</p>
<div id="pauser">
<input type="checkbox" id="pauseButton" v-model="paused">
<label for="pauseButton"> </label>
<button class="nexter" @click="next">next frame</button>
</div>
<div class="resetters">
<button @click="restart">restart simulation</button>
<button @click="reset">reset settings</button>
</div>
<p>number of boids: {{ boids }}</p>
<input type="range" min="25" max="2000" step="25" v-model="rboids">
<h4>visual settings</h4>
<div>
<input type="checkbox" id="toggle" v-model="toggle">
<label for="toggle"> hide menu toggle (it still works)</label>
</div>
<div>
<input type="checkbox" id="squares" v-model="squares">
<label for="squares"> show boids as squares (faster)</label>
</div>
<div>
<input type="checkbox" id="direction" v-model="direction">
<label for="direction"> show boid directions</label>
</div>
<div>
<input type="checkbox" id="desired" v-model="desired">
<label for="desired"> show boid desired directions</label>
</div>
<div>
<input type="checkbox" id="hues" v-model="hues">
<label for="hues"> change hues to indicate speed</label>
</div>
<div>
<input type="checkbox" id="areas" v-model="areas">
<label for="areas"> show vision areas</label>
</div>
<div>
<input type="checkbox" id="outlines" v-model="outlines">
<label for="outlines"> show vision outlines</label>
</div>
<div>
<input type="checkbox" id="neighbors" v-model="neighbors">
<label for="neighbors"> show visible neighbors</label>
</div>
<p>trail opacity: {{ trail }}</p>
<input type="range" min="0" max="120" step="5" v-model="rtrail">
<h4>boid movement</h4>
<div>
<input type="checkbox" id="particle" v-model="particle">
<label for="particle"> particle mode</label>
</div>
<div>
<input type="checkbox" id="bounce" v-model="bounce">
<label for="bounce"> bounce off of edges</label>
</div>
<p>boid vision: {{ vision }}</p>
<input type="range" min="0" max="300" step="5" v-model="rvision">
<p>alignment force: {{ alignment }}</p>
<input type="range" min="0" max="4" step="0.1" v-model="ralignment">
<p>cohesion force: {{ cohesion }}</p>
<input type="range" min="0" max="4" step="0.1" v-model="rcohesion">
<p>separation force: {{ separation }}</p>
<input type="range" min="0" max="4" step="0.1" v-model="rseparation">
<p>steering force: {{ maxForce }}</p>
<input type="range" min="0" max="1" step="0.05" v-model="rmaxForce">
<p>min speed: {{ minSpeed }}</p>
<input type="range" min="0" :max="maxSpeed" step="0.25" v-model="rminSpeed">
<p>max speed: {{ maxSpeed }}</p>
<input type="range" min="0" max="25" step="0.5" v-model="rmaxSpeed">
<p>drag: {{ drag }}</p>
<input type="range" min="0" max="0.05" step="0.0025" v-model="rdrag">
<p>movement randomness: {{ noise }}</p>
<input type="range" min="0" max="10" step="0.5" v-model="rnoise">
<h4>debug info</h4>
<div>
<input type="checkbox" id="debug" v-model="debug">
<label for="debug">show debug info</label>
</div>
<div v-if="debug">
<p :key="special.rerender">fps: {{ special.fps.toFixed(1) }}</p>
<div>
<input type="checkbox" id="hidden" v-model="hidden">
<label for="hidden"> hide boids</label>
</div>
<div>
<input type="checkbox" id="indices" v-model="indices">
<label for="indices"> show boid indices</label>
</div>
<div>
<input type="checkbox" id="quadtree" v-model="quadtree">
<label for="quadtree"> show quadtree</label>
</div>
</div>
</div>
<canvas id="canvas" oncontextmenu="event.preventDefault()"></canvas>
<!-- Allow the C++ to access the canvas element -->
<script type='text/javascript'>
var Module = {
canvas: (function() { return document.getElementById('canvas'); })()
};
</script>
<script src="./lib/vue.min.js"></script>
<script src="./lib/d3-quadtree.min.js"></script>
<script src="./lib/hammer.min.js"></script>
<script src="./lib/p5.min.js"></script>
<script src="./js/settings.js"></script>
<script src="index.js"></script>
<!-- <script src="./js/v.js"></script>
<script src="./js/boid.js"></script>
<script src="./js/flock.js"></script> -->
<script src="./js/script.js"></script>
</body>
</html>