www: add hero animation & new logo (#153)

This commit is contained in:
hashrock
2022-04-23 15:09:35 +02:00
committed by GitHub
parent 4e1d4231f7
commit f1a39e2e7a
6 changed files with 270 additions and 29 deletions
+17
View File
@@ -41,3 +41,20 @@ export function IconPlus() {
</svg>
);
}
export function Leaf() {
return (
<svg width="24" height="24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill="#fff" d="M0 0h24v24H0z" />
<path
d="M2 10.276c.862-2.673 2.155-5.259 5.603-5.69"
stroke="#6BA377"
stroke-width="1.724"
/>
<path
d="M19.091 5.146c-4.44-5.697-10.945-2.374-13.643 0 2.081-1.662 3.006 4.747 4.163 9.733.925 3.987 8.71 6.409 12.486 7.121.848-3.244 1.434-11.157-3.006-16.854Z"
fill="#25D24B"
/>
</svg>
);
}
+51
View File
@@ -0,0 +1,51 @@
export interface Spring {
p: number;
v: number;
}
export class WaveTank {
springs = [] as Spring[];
waveLength = 100;
k = 0.02;
damping = 0.02;
spread = 0.02;
constructor() {
for (let i = 0; i < this.waveLength; i++) {
this.springs[i] = {
p: 0,
v: 0,
};
}
}
update(springs: Spring[]) {
for (const i of springs) {
const a = -this.k * i.p - this.damping * i.v;
i.p += i.v;
i.v += a;
}
const leftDeltas = [];
const rightDeltas = [];
for (let t = 0; t < 8; t++) {
for (let i = 0; i < springs.length; i++) {
const prev = springs[(i - 1 + springs.length) % springs.length];
const next = springs[(i + 1) % springs.length];
leftDeltas[i] = this.spread * (springs[i].p - prev.p);
rightDeltas[i] = this.spread * (springs[i].p - next.p);
}
for (let i = 0; i < springs.length; i++) {
const prev = springs[(i - 1 + springs.length) % springs.length];
const next = springs[(i + 1) % springs.length];
prev.v += leftDeltas[i];
next.v += rightDeltas[i];
prev.p += leftDeltas[i];
next.p += rightDeltas[i];
}
}
}
}