mirror of
https://github.com/geoffsee/open-gsio.git
synced 2025-09-08 22:56:46 +00:00
* 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:

committed by
Geoff Seemueller

parent
858282929c
commit
0ff8b5c03e
@@ -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>
|
||||
);
|
||||
};
|
Reference in New Issue
Block a user