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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
import oktween from '../../util/vendor/oktween'
import { choice } from '../../util'
import { faces, names } from './faces'
import * as markers from './markers'
import * as mesh from './mesh'
export function init() {
const name = choice(names)
const face = faces[name]
markers.build(face)
// mesh.load(name)
startAnimation()
}
export function startAnimation() {
const name = choice(names)
const face = faces[name]
mesh.remove()
mesh.load(name).then(meshes => {
meshes.wireframe.position.z -= 0.01
markers.swap(face)
.then({
from: { n: 0 },
to: { n: 1 },
duration: 500,
easing: oktween.easing.quad_in_out,
update: (obj) => {
meshes.blank.material.opacity = obj.n
},
})
.then({
from: { n: 0 },
to: { n: 1 },
duration: 500,
easing: oktween.easing.quad_in,
update: (obj) => {
meshes.blank.material.opacity = 1 - obj.n
meshes.solid.material.opacity = obj.n
},
})
.then({
from: { n: 0 },
to: { n: 1 },
delay: 500,
duration: 500,
easing: oktween.easing.quad_in_out,
update: (obj) => {
meshes.solid.material.opacity = 1 - obj.n
meshes.wireframe.material.opacity = obj.n
},
finished: () => {
mesh.removeMesh('solid')
}
})
.then({
from: { n: 1 },
to: { n: 0 },
delay: 5000,
duration: 500,
easing: oktween.easing.quad_in_out,
update: (obj) => {
meshes.wireframe.material.opacity = obj.n
},
})
.then({
obj: {},
duration: 0,
finished: () => {
startAnimation()
}
})
})
}
// export function update() {
// markers.update()
// }
|