@crapthings/run3d 0.2.5 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -0,0 +1,8 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
2
+ <title>run3d</title>
3
+ <rect width="64" height="64" rx="16" fill="#0f172a"/>
4
+ <path d="m35 9 20 11-20 12-20-12Z" fill="#a3e635"/>
5
+ <path d="m15 20 20 12v23L15 43Z" fill="#65a30d"/>
6
+ <path d="m35 32 20-12v23L35 55Z" fill="#bef264"/>
7
+ <path d="M7 29h12M5 36h10M8 43h7" fill="none" stroke="#e2e8f0" stroke-width="3" stroke-linecap="round"/>
8
+ </svg>
@@ -1,8 +1,9 @@
1
1
  import { Scene } from '@/Scenes'
2
2
 
3
+ // The starter scene fills the viewport against the favicon's dark background.
3
4
  export function App () {
4
5
  return (
5
- <main className='fixed inset-0 bg-slate-50'>
6
+ <main className='fixed inset-0 bg-slate-900'>
6
7
  <Scene />
7
8
  </main>
8
9
  )
@@ -1,42 +1,38 @@
1
- import { Canvas, extend } from '@react-three/fiber'
2
- import { Grid, OrbitControls, Sky } from '@react-three/drei'
1
+ import { Canvas } from '@react-three/fiber'
2
+ import { OrbitControls } from '@react-three/drei'
3
3
  import { Perf } from 'r3f-perf'
4
- import { SunLight } from 'three/addons/lights/SunLight.js'
5
4
 
6
- extend({ SunLight })
5
+ // Face colors preserve the favicon's lime top, bright right side, and shaded left side.
6
+ const cubeColors = ['#bef264', '#65a30d', '#a3e635', '#65a30d', '#65a30d', '#bef264']
7
7
 
8
- // One world unit represents one meter.
8
+ // Three rounded streaks trail the cube in the initial camera's screen plane.
9
+ function SpeedLines () {
10
+ return (
11
+ <group rotation-y={Math.atan2(4, 6)} position={[0, 0, 1.1]}>
12
+ {[0.32, 0, -0.32].map((height, index) => (
13
+ <mesh key={height} position={[-1.15 + index * 0.08, height, 0]} rotation-z={Math.PI / 2}>
14
+ <capsuleGeometry args={[0.055, 0.65 - index * 0.15, 4, 8]} />
15
+ <meshBasicMaterial color='#e2e8f0' />
16
+ </mesh>
17
+ ))}
18
+ </group>
19
+ )
20
+ }
21
+
22
+ // An orbitable cube and speed lines recreate the run3d favicon in three dimensions.
9
23
  export function Scene () {
10
24
  return (
11
- <Canvas camera={{ position: [4, 3.4, 6], fov: 50, far: 100 }} dpr={1} shadows>
25
+ <Canvas orthographic camera={{ position: [4, 3.4, 6], zoom: 100, near: 0.1, far: 100 }} dpr={[1, 2]}>
26
+ <color attach='background' args={['#0f172a']} />
12
27
  {import.meta.env.DEV && <Perf position='top-right' />}
13
- <sunLight
14
- args={['#fff2e3', 2]}
15
- position={[30, 45, 20]}
16
- castShadow
17
- shadow-camera-far={60}
18
- />
19
- <Sky distance={1000} rayleigh={1} sunPosition={[30, 45, 20]} turbidity={4} />
20
- <mesh castShadow position-y={0.7}>
21
- <boxGeometry args={[1.4, 1.4, 1.4]} />
22
- <meshStandardMaterial color='#38bdf8' metalness={0.15} roughness={0.35} />
23
- </mesh>
24
- <mesh receiveShadow rotation-x={-Math.PI / 2} position-y={-0.01}>
25
- <planeGeometry args={[64, 64]} />
26
- <shadowMaterial transparent opacity={0.25} depthWrite={false} />
28
+ <mesh>
29
+ <boxGeometry args={[1.8, 1.8, 1.8]} />
30
+ {cubeColors.map((color, index) => (
31
+ <meshBasicMaterial key={index} attach={`material-${index}`} color={color} />
32
+ ))}
27
33
  </mesh>
28
- <Grid
29
- args={[64, 64]}
30
- cellColor='#cbd5e1'
31
- cellSize={1}
32
- cellThickness={0.5}
33
- fadeDistance={32}
34
- infiniteGrid
35
- sectionColor='#94a3b8'
36
- sectionSize={2}
37
- sectionThickness={0.8}
38
- />
39
- <OrbitControls makeDefault target={[0, 0.7, 0]} />
34
+ <SpeedLines />
35
+ <OrbitControls makeDefault target={[-0.25, 0, 0]} minZoom={50} maxZoom={200} />
40
36
  </Canvas>
41
37
  )
42
38
  }