CarbonO2 commited on
Commit
2227959
·
verified ·
1 Parent(s): 0ffc500

Upload components/Sun.jsx with huggingface_hub

Browse files
Files changed (1) hide show
  1. components/Sun.jsx +47 -0
components/Sun.jsx ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React from 'react';
2
+ import { useFrame } from '@react-three/fiber';
3
+ import * as THREE from 'three';
4
+
5
+ const Sun = ({ onClick }) => {
6
+ const sunRef = React.useRef();
7
+
8
+ useFrame((state) => {
9
+ if (sunRef.current) {
10
+ sunRef.current.rotation.y = state.clock.getElapsedTime() * 0.02;
11
+ sunRef.current.rotation.z = state.clock.getElapsedTime() * 0.01;
12
+ }
13
+ });
14
+
15
+ return (
16
+ <mesh
17
+ ref={sunRef}
18
+ onClick={onClick}
19
+ onPointerOver={() => document.body.style.cursor = 'pointer'}
20
+ onPointerOut={() => document.body.style.cursor = 'auto'}
21
+ >
22
+ <sphereGeometry args={[15, 64, 64]} />
23
+ <meshStandardMaterial
24
+ emissive="#FFD700"
25
+ emissiveIntensity={2}
26
+ color="#FF8C00"
27
+ roughness={0.4}
28
+ metalness={0.1}
29
+ />
30
+ {/* Sun glow effect */}
31
+ <pointLight
32
+ position={[0, 0, 0]}
33
+ intensity={2}
34
+ distance={300}
35
+ color="#FFD700"
36
+ />
37
+ <pointLight
38
+ position={[50, 50, 50]}
39
+ intensity={1}
40
+ distance={200}
41
+ color="#FFA500"
42
+ />
43
+ </mesh>
44
+ );
45
+ };
46
+
47
+ export default Sun;