* Introduced BevyScene React component in landing-component for rendering a 3D cockpit visualization.

* Included WebAssembly asset `yachtpit.js` for cockpit functionality.
* Added Bevy MIT license file.
* Implemented a service worker to cache assets locally instead of fetching them remotely.
* Added collapsible functionality to **Tweakbox** and included the `@chakra-ui/icons` dependency.
* Applied the `hidden` prop to the Tweakbox Heading for better accessibility.
* Refactored **Particles** component for improved performance, clarity, and maintainability.

  * Introduced helper functions for particle creation and count management.
  * Added responsive resizing with particle repositioning.
  * Optimized animation updates, including velocity adjustments for speed changes.
  * Ensured canvas size and particle state are cleanly managed on component unmount.
This commit is contained in:
geoffsee
2025-06-28 16:55:14 -04:00
committed by Geoff Seemueller
parent 858282929c
commit 0ff8b5c03e
21 changed files with 798 additions and 38 deletions

View File

@@ -0,0 +1,45 @@
import { Box } from '@chakra-ui/react';
import { useEffect } from 'react';
export interface BevySceneProps {
speed?: number; // transition seconds
intensity?: number;
glow?: boolean;
}
export const BevyScene: React.FC<BevySceneProps> = ({ speed = 1, intensity = 1, glow = false }) => {
useEffect(() => {
const script = document.createElement('script');
script.src = '/yachtpit.js';
script.type = 'module';
document.body.appendChild(script);
script.onload = loaded => {
console.log('loaded', loaded);
};
}, []);
return (
<Box
pos="absolute"
inset={0}
zIndex={0}
pointerEvents="none"
opacity={Math.min(Math.max(intensity, 0), 1)}
filter={glow ? 'blur(1px)' : 'none'}
transition={`opacity ${speed}s ease-in-out`}
>
<script type="module"></script>
<canvas id="yachtpit-canvas" width="1280" height="720"></canvas>
{/*<iframe*/}
{/* src="/yachtpit.html"*/}
{/* style={{*/}
{/* width: '100%',*/}
{/* height: '100%',*/}
{/* border: 'none',*/}
{/* backgroundColor: 'transparent',*/}
{/* }}*/}
{/* title="Bevy Scene"*/}
{/*/>*/}
</Box>
);
};