Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1dc90c1

Browse files
added link
1 parent 227cbc4 commit 1dc90c1

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

‎src/index.html‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ <h2>Controls</h2>
7171
id="cohesionSlider"
7272
/>
7373
</div>
74+
<a
75+
class="anchor"
76+
target="_blank"
77+
href="https://en.wikipedia.org/wiki/Boids"
78+
>What is this?</a
79+
>
7480
</div>
7581
<button onclick="showMenu()" class="menuOpen">
7682
<p>🍔</p>

‎src/scripts/index.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ export let c = canvas.getContext("2d");
3939
let boidsArr = [];
4040
let numBoids = 200;
4141

42+
let showTrails = true;
43+
4244
const colors = ["#ffbe0b", "#fb5607", "#ff006e", "#8338ec", "#3a86ff"];
4345

4446
for (let i = 0; i < numBoids; i++) {
@@ -50,7 +52,7 @@ for (let i = 0; i < numBoids; i++) {
5052
function animate() {
5153
requestAnimationFrame(animate);
5254

53-
c.fillStyle = " rgba(1, 1, 10,0.2) ";
55+
c.fillStyle = `rgba(1, 1, 10,${showTrails ? "0.2" : "1"} )`;
5456
c.fillRect(0, 0, width, height);
5557

5658
boidsArr.forEach((boid) => {

‎src/styles/index.scss‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,15 @@ canvas {
151151
background: rgba(255, 255, 255, 0.4);
152152
}
153153
}
154+
155+
.anchor {
156+
margin-top: 10px;
157+
color: #2c3e50;
158+
text-decoration: none;
159+
160+
transition: ease-in-out 100ms color;
161+
162+
&:hover {
163+
color: #000;
164+
}
165+
}

‎todo.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
1. add predator logic.
2+
2. quadtree optimization.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /