starfleet-ui
Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.
Dernier runRéussi#6 · main · 2 min 01 s
0Étoiles
0Forks
0Issues
| 1 | <script lang="ts"> |
| 2 | import { T, useTask } from '@threlte/core'; |
| 3 | import type { IntersectionEvent } from '@threlte/extras'; |
| 4 | import * as THREE from 'three'; |
| 5 | |
| 6 | interface Props { |
| 7 | position: [number, number, number]; |
| 8 | onclick?: (e: IntersectionEvent<MouseEvent>) => void; |
| 9 | } |
| 10 | |
| 11 | let { position, onclick }: Props = $props(); |
| 12 | |
| 13 | let ring = $state<THREE.Mesh>(); |
| 14 | |
| 15 | useTask((delta) => { |
| 16 | if (ring) ring.rotation.z += delta * 0.4; |
| 17 | }); |
| 18 | </script> |
| 19 | |
| 20 | <T.Group {position}> |
| 21 | <!-- outer ring --> |
| 22 | <T.Mesh bind:ref={ring} {onclick}> |
| 23 | <T.TorusGeometry args={[3.4, 0.35, 12, 48]} /> |
| 24 | <T.MeshStandardMaterial |
| 25 | color="#7c3aed" |
| 26 | emissive="#a855f7" |
| 27 | emissiveIntensity={1.4} |
| 28 | metalness={0.6} |
| 29 | roughness={0.3} |
| 30 | /> |
| 31 | </T.Mesh> |
| 32 | <!-- energy membrane --> |
| 33 | <T.Mesh {onclick}> |
| 34 | <T.CircleGeometry args={[3.1, 48]} /> |
| 35 | <T.MeshBasicMaterial color="#a855f7" transparent opacity={0.22} side={2} /> |
| 36 | </T.Mesh> |
| 37 | <T.PointLight color="#a855f7" intensity={25} distance={35} /> |
| 38 | </T.Group> |