File size: 1,129 Bytes
2227959
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import React from 'react';
import { useFrame } from '@react-three/fiber';
import * as THREE from 'three';

const Sun = ({ onClick }) => {
  const sunRef = React.useRef();
  
  useFrame((state) => {
    if (sunRef.current) {
      sunRef.current.rotation.y = state.clock.getElapsedTime() * 0.02;
      sunRef.current.rotation.z = state.clock.getElapsedTime() * 0.01;
    }
  });
  
  return (
    <mesh 
      ref={sunRef} 
      onClick={onClick}
      onPointerOver={() => document.body.style.cursor = 'pointer'}
      onPointerOut={() => document.body.style.cursor = 'auto'}
    >
      <sphereGeometry args={[15, 64, 64]} />
      <meshStandardMaterial 
        emissive="#FFD700" 
        emissiveIntensity={2}
        color="#FF8C00"
        roughness={0.4}
        metalness={0.1}
      />
      {/* Sun glow effect */}
      <pointLight 
        position={[0, 0, 0]} 
        intensity={2} 
        distance={300} 
        color="#FFD700" 
      />
      <pointLight 
        position={[50, 50, 50]} 
        intensity={1} 
        distance={200} 
        color="#FFA500" 
      />
    </mesh>
  );
};

export default Sun;