-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
52 lines (47 loc) · 1.47 KB
/
index.html
File metadata and controls
52 lines (47 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Spark + A-Frame • Hello World</title>
</head>
<body>
<script type="importmap">
{
"imports": {
"three": "https://cdn.jsdelivr.net/npm/super-three@0.177.0/build/three.module.js",
"aframe": "https://aframe.io/releases/1.7.1/aframe.module.min.js",
"@sparkjsdev/spark": "https://sparkjs.dev/releases/spark/0.1.8/spark.module.js"
}
}
</script>
<script type="module">
import AFRAME from 'aframe';
import { SplatMesh, SparkRenderer } from "@sparkjsdev/spark";
AFRAME.registerComponent('splat', {
schema: {
src: {default: ''},
},
init: function () {
const splat = new SplatMesh({ url: this.data.src });
splat.quaternion.set(1, 0, 0, 0);
this.el.setObject3D('mesh', splat);
}
});
AFRAME.registerSystem('splat', {
init: function () {
const sparkRenderer = new SparkRenderer({ renderer: this.el.renderer });
this.sceneEl.object3D.add(sparkRenderer);
}
});
</script>
<a-scene background="color: black">
<a-entity camera wasd-controls position="0 1.6 0"></a-entity>
<a-entity
splat="src: https://sparkjs.dev/assets/splats/butterfly.spz"
position="0 1.6 -2"
animation="property: rotation; to: 0 360 0; loop: true; dur: 10000; easing: linear;"
></a-entity>
</a-scene>
</body>
</html>