tobogganSe connecter

starfleet-ui

Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.

27 lignes · 870 octetsBrut · Historique
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 import { MODELS } from '$lib/assets/manifest';
6 import Model from './Model.svelte';
7
8 interface Props {
9 position: [number, number, number];
10 onclick?: (e: IntersectionEvent<MouseEvent>) => void;
11 }
12
13 let { position, onclick }: Props = $props();
14
15 let group = $state<THREE.Group>();
16
17 useTask((delta) => {
18 if (group) group.rotation.y += delta * 0.08;
19 });
20</script>
21
22<T.Group {position} bind:ref={group}>
23 <Model src={MODELS.stationCore} scale={4} {onclick} />
24 <Model src={MODELS.stationDome} scale={2.6} position={[0, 3, 0]} {onclick} />
25 <Model src={MODELS.dish} scale={3.4} position={[5.5, 2, 0]} {onclick} />
26 <T.PointLight color="#38bdf8" intensity={30} distance={40} position={[0, 4, 0]} />
27</T.Group>