riffusion-app/components/ThreeCanvas.tsx

35 lines
796 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[];
getTime: () => number;
audioLength: number;
2022-11-23 22:46:32 -07:00
}
2022-11-20 14:39:15 -07:00
/**
* React three fiber canvas with spectrogram drawing.
*/
export default function ThreeCanvas({
paused,
inferenceResults,
getTime,
audioLength,
}: CanvasProps) {
return (
2022-11-24 11:43:11 -07:00
<Canvas camera={{ position: [0, 0, 7], rotation: [0.4, 0, 0] }}>
2022-11-20 14:39:15 -07:00
<ambientLight intensity={2} />
<pointLight position={[40, 40, 40]} />
<SpectrogramViewer
paused={paused}
inferenceResults={inferenceResults}
getTime={getTime}
audioLength={audioLength}
2022-11-23 22:46:32 -07:00
/>
2022-11-20 14:39:15 -07:00
</Canvas>
);
}