summaryrefslogtreecommitdiff
path: root/client/splash/index.js
blob: 8821133759d6ffc8e036a6227350de9507184b4f (plain)
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
import { Vector3 } from 'three'
import OrbitControls from 'three-orbitcontrols'

import { init, render, camera, renderer } from './renderer'

import * as cloud from './cloud'
import * as face from './face'

const controls = new OrbitControls(camera, renderer.domElement)
controls.maxDistance = camera.far / 2
controls.enableDamping = true
controls.dampingFactor = 1 / 8
controls.rotateSpeed = 1 / 4
controls.zoomSpeed = 1
controls.keyPanSpeed = 1 / 2

function build() {
  init()
  cloud.init()
  face.init()
  animate()
}

function animate() {
  requestAnimationFrame(animate)

  // camera.position.z += -0.0025
  // camera.rotation.y += 0.00001

  controls.update()
  cloud.update()
  // face.update()

  let cameraTarget = new Vector3(0, 0, 0)
  camera.lookAt(cameraTarget)

  render()
}

document.addEventListener('DOMContentLoaded', build)