riffusion-app/components/ThreeCanvas.tsx

35 lines
866 B
TypeScript
Raw Normal View History

import { Canvas } from "@react-three/fiber";
2022-11-20 14:39:15 -07:00
import RotatingBox from "./RotatingBox";
import ImagePlane from "./ImagePlane";
2022-11-23 22:46:32 -07:00
interface CanvasProps {
paused: boolean;
}
2022-11-20 14:39:15 -07:00
/**
* React three fiber canvas with spectrogram drawing.
*/
2022-11-23 22:46:32 -07:00
export default function ThreeCanvas(props: CanvasProps) {
// change the image URL
const spectrogram_image = "spectrogram.jpeg";
const height = -30.0;
return (
2022-11-23 22:46:32 -07:00
<Canvas camera={{ position: [0, 0, 35], rotation: [0.2, 0, 0] }}>
2022-11-20 14:39:15 -07:00
<ambientLight intensity={2} />
<pointLight position={[40, 40, 40]} />
2022-11-23 22:46:32 -07:00
<ImagePlane
url={spectrogram_image}
height={height}
paused={props.paused}
/>
2022-11-20 14:39:15 -07:00
<RotatingBox position={[-12, 0, 1]} />
<RotatingBox position={[-4, 0, 1]} />
<RotatingBox position={[4, 0, 1]} />
<RotatingBox position={[12, 0, 1]} />
</Canvas>
);
}