Spaces:
Sleeping
Sleeping
disable auto rotate
Browse files- src/components/cube-piece.tsx +2 -11
- src/components/env.tsx +5 -2
src/components/cube-piece.tsx
CHANGED
|
@@ -18,15 +18,6 @@ type CubePieceProps = {
|
|
| 18 |
export const CubePiece = ({ roughness, position }: CubePieceProps) => {
|
| 19 |
const [x, y, z] = position;
|
| 20 |
|
| 21 |
-
const visibleFaces: Record<keyof typeof CUBE_COLORS, boolean> = {
|
| 22 |
-
front: z > 0, // Front face (positive z)
|
| 23 |
-
back: z < 0, // Back face (negative z)
|
| 24 |
-
right: x > 0, // Right face (positive x)
|
| 25 |
-
left: x < 0, // Left face (negative x)
|
| 26 |
-
top: y > 0, // Top face (positive y)
|
| 27 |
-
bottom: y < 0, // Bottom face (negative y)
|
| 28 |
-
};
|
| 29 |
-
|
| 30 |
return (
|
| 31 |
<mesh position={position}>
|
| 32 |
<RoundedBox args={[0.95, 0.95, 0.95]} radius={0.05} smoothness={4}>
|
|
@@ -37,8 +28,7 @@ export const CubePiece = ({ roughness, position }: CubePieceProps) => {
|
|
| 37 |
/>
|
| 38 |
</RoundedBox>
|
| 39 |
|
| 40 |
-
{Object.
|
| 41 |
-
if (!isVisible) return null;
|
| 42 |
const color = CUBE_COLORS[face as keyof typeof CUBE_COLORS];
|
| 43 |
let stickerPosition: [number, number, number] = [0, 0, 0];
|
| 44 |
let stickerRotation: [number, number, number] = [0, 0, 0];
|
|
@@ -46,6 +36,7 @@ export const CubePiece = ({ roughness, position }: CubePieceProps) => {
|
|
| 46 |
switch (face) {
|
| 47 |
case "front":
|
| 48 |
stickerPosition = [0, 0, 0.48];
|
|
|
|
| 49 |
break;
|
| 50 |
case "back":
|
| 51 |
stickerPosition = [0, 0, -0.48];
|
|
|
|
| 18 |
export const CubePiece = ({ roughness, position }: CubePieceProps) => {
|
| 19 |
const [x, y, z] = position;
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
return (
|
| 22 |
<mesh position={position}>
|
| 23 |
<RoundedBox args={[0.95, 0.95, 0.95]} radius={0.05} smoothness={4}>
|
|
|
|
| 28 |
/>
|
| 29 |
</RoundedBox>
|
| 30 |
|
| 31 |
+
{Object.keys(CUBE_COLORS).map((face) => {
|
|
|
|
| 32 |
const color = CUBE_COLORS[face as keyof typeof CUBE_COLORS];
|
| 33 |
let stickerPosition: [number, number, number] = [0, 0, 0];
|
| 34 |
let stickerRotation: [number, number, number] = [0, 0, 0];
|
|
|
|
| 36 |
switch (face) {
|
| 37 |
case "front":
|
| 38 |
stickerPosition = [0, 0, 0.48];
|
| 39 |
+
stickerRotation = [0, 0, 0];
|
| 40 |
break;
|
| 41 |
case "back":
|
| 42 |
stickerPosition = [0, 0, -0.48];
|
src/components/env.tsx
CHANGED
|
@@ -10,7 +10,10 @@ export const Env = () => {
|
|
| 10 |
const [_, startTransition] = useTransition();
|
| 11 |
|
| 12 |
const [preset, setPreset] = useState<PresetsType>("sunset");
|
| 13 |
-
useControls({
|
|
|
|
|
|
|
|
|
|
| 14 |
preset: {
|
| 15 |
value: preset,
|
| 16 |
options: ["sunset", "dawn", "forest"],
|
|
@@ -20,7 +23,7 @@ export const Env = () => {
|
|
| 20 |
return (
|
| 21 |
<>
|
| 22 |
<OrbitControls
|
| 23 |
-
autoRotate
|
| 24 |
autoRotateSpeed={0.5}
|
| 25 |
enablePan={false}
|
| 26 |
enableZoom={true}
|
|
|
|
| 10 |
const [_, startTransition] = useTransition();
|
| 11 |
|
| 12 |
const [preset, setPreset] = useState<PresetsType>("sunset");
|
| 13 |
+
const { autoRotate } = useControls({
|
| 14 |
+
autoRotate: {
|
| 15 |
+
value: true,
|
| 16 |
+
},
|
| 17 |
preset: {
|
| 18 |
value: preset,
|
| 19 |
options: ["sunset", "dawn", "forest"],
|
|
|
|
| 23 |
return (
|
| 24 |
<>
|
| 25 |
<OrbitControls
|
| 26 |
+
autoRotate={autoRotate}
|
| 27 |
autoRotateSpeed={0.5}
|
| 28 |
enablePan={false}
|
| 29 |
enableZoom={true}
|