···
15
15
"@threlte/rapier": "^3.1.4",
16
16
"@threlte/studio": "^0.1.7",
17
17
"@types/three": "^0.176.0",
18
18
+
"howler": "^2.2.4",
18
19
"three": "^0.176.0"
19
20
},
20
21
"devDependencies": {
···
3171
3172
"engines": {
3172
3173
"node": ">=8"
3173
3174
}
3175
3175
+
},
3176
3176
+
"node_modules/howler": {
3177
3177
+
"version": "2.2.4",
3178
3178
+
"resolved": "https://registry.npmjs.org/howler/-/howler-2.2.4.tgz",
3179
3179
+
"integrity": "sha512-iARIBPgcQrwtEr+tALF+rapJ8qSc+Set2GJQl7xT1MQzWaVkFebdJhR3alVlSiUf5U7nAANKuj3aWpwerocD5w==",
3180
3180
+
"license": "MIT"
3174
3181
},
3175
3182
"node_modules/ignore": {
3176
3183
"version": "5.3.2",
···
44
44
"@threlte/rapier": "^3.1.4",
45
45
"@threlte/studio": "^0.1.7",
46
46
"@types/three": "^0.176.0",
47
47
+
"howler": "^2.2.4",
47
48
"three": "^0.176.0"
48
49
}
49
50
}
···
1
1
<script>
2
2
-
import { T, useTask } from '@threlte/core';
3
3
-
import { interactivity, OrbitControls, Sky } from '@threlte/extras';
4
4
-
import { Debug } from '@threlte/rapier';
5
5
-
import { Spring } from 'svelte/motion';
2
2
+
import { T } from '@threlte/core';
3
3
+
import { interactivity, Sky } from '@threlte/extras';
6
4
import Particle from './Particle.svelte';
7
5
import Ground from './Ground.svelte';
8
6
import { game, ids } from './main.svelte';
9
9
-
import { Audio, AudioListener } from '@threlte/extras';
10
7
import { base } from '$app/paths';
11
8
import GltfModel from './GLTFModel.svelte';
12
9
···
20
17
</script>
21
18
22
19
<T.OrthographicCamera makeDefault zoom={100} position={[0, 0, 10]}>
23
23
-
<AudioListener />
24
20
</T.OrthographicCamera>
25
21
26
22
<!-- <T.PerspectiveCamera makeDefault fov={75} position={[0, 0, 10]}>
27
23
<OrbitControls />
28
24
</T.PerspectiveCamera> -->
29
29
-
30
30
-
<Audio autoplay loop src={base + '/audio/music.mp3'} />
31
31
-
32
25
<T.DirectionalLight position={[0, 10, 10]} castShadow />
33
26
34
27
<Ground />
···
4
4
import { Canvas } from '@threlte/core';
5
5
import { World } from '@threlte/rapier';
6
6
import { ACESFilmicToneMapping } from 'three';
7
7
+
8
8
+
import { Howl, Howler } from 'howler';
9
9
+
import { onMount } from 'svelte';
10
10
+
import { base } from '$app/paths';
11
11
+
12
12
+
onMount(() => {
13
13
+
const sound = new Howl({
14
14
+
src: [base + '/audio/music.mp3'],
15
15
+
loop: true,
16
16
+
volume: 0.5
17
17
+
});
18
18
+
19
19
+
sound.play();
20
20
+
});
7
21
</script>
8
22
9
23
<div class="h-screen w-screen">