Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions src/components/canvas/Ball.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import React, { Suspense } from "react";
import { Canvas } from "@react-three/fiber";
import React, { Suspense } from 'react'
import { Canvas } from '@react-three/fiber'
import {
Decal,
Float,
OrbitControls,
Preload,
useTexture,
} from "@react-three/drei";
} from '@react-three/drei'

import CanvasLoader from "../Loader";
import CanvasLoader from '../Loader'

const Ball = (props) => {
const [decal] = useTexture([props.imgUrl]);
const [decal] = useTexture([props.imgUrl])

return (
<Float speed={1.75} rotationIntensity={1} floatIntensity={2}>
Expand All @@ -34,8 +34,8 @@ const Ball = (props) => {
/>
</mesh>
</Float>
);
};
)
}

const BallCanvas = ({ icon }) => {
return (
Expand All @@ -45,13 +45,19 @@ const BallCanvas = ({ icon }) => {
gl={{ preserveDrawingBuffer: true }}
>
<Suspense fallback={<CanvasLoader />}>
<OrbitControls enableZoom={false} />
<OrbitControls
enableZoom={false}
minPolarAngle={Math.PI / 4}
maxPolarAngle={Math.PI / 1.35}
minAzimuthAngle={-Math.PI / 4}
maxAzimuthAngle={Math.PI / 4}
/>
<Ball imgUrl={icon} />
</Suspense>

<Preload all />
</Canvas>
);
};
)
}

export default BallCanvas;
export default BallCanvas