Skip to content

Commit 87bb3b9

Browse files
committed
docs: Homepage BG Effect
1 parent cb396f4 commit 87bb3b9

File tree

10 files changed

+1267
-0
lines changed

10 files changed

+1267
-0
lines changed

apps/typegpu-docs/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"@babel/standalone": "^7.28.6",
2121
"@dimforge/rapier2d-compat": "^0.19.3",
2222
"@loaders.gl/core": "^4.3.4",
23+
"@loaders.gl/gltf": "^4.3.4",
2324
"@loaders.gl/obj": "^4.3.4",
2425
"@monaco-editor/react": "^4.7.0",
2526
"@radix-ui/react-select": "^2.2.6",
21 KB
Binary file not shown.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { useEffect, useRef } from 'react';
2+
import { initHeroEffect } from './hero-effect.ts';
3+
4+
export function HeroEffect() {
5+
const canvasRef = useRef<HTMLCanvasElement>(null);
6+
7+
useEffect(() => {
8+
const canvas = canvasRef.current;
9+
if (!canvas) return;
10+
11+
const ctrl = new AbortController();
12+
initHeroEffect({ canvas, signal: ctrl.signal });
13+
14+
return () => {
15+
ctrl.abort();
16+
};
17+
});
18+
19+
return (
20+
<div className="relative h-[48rem] w-[48rem]">
21+
<canvas ref={canvasRef} className="absolute inset-0 h-full w-full bg-transparent" />
22+
</div>
23+
);
24+
}

0 commit comments

Comments
 (0)