riffusion-app/components/ThreeCanvas.tsx

26 lines
646 B
TypeScript
Raw Normal View History

import { Canvas } from "@react-three/fiber";
import { InferenceResult } from "../types";
import SpectrogramViewer from "./SpectrogramViewer";
2022-11-23 22:46:32 -07:00
interface CanvasProps {
paused: boolean;
inferenceResults: InferenceResult[];
2022-11-23 22:46:32 -07:00
}
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) {
return (
<Canvas camera={{ position: [0, 0, 7], rotation: [0.2, 0, 0] }}>
2022-11-20 14:39:15 -07:00
<ambientLight intensity={2} />
<pointLight position={[40, 40, 40]} />
<SpectrogramViewer
2022-11-23 22:46:32 -07:00
paused={props.paused}
inferenceResults={props.inferenceResults}
2022-11-23 22:46:32 -07:00
/>
2022-11-20 14:39:15 -07:00
</Canvas>
);
}