From de877acdb34a5e07ce6b7b9d21b9ca720181594d Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 28 Jan 2019 20:24:42 +0100 Subject: transitions --- client/splash/face/index.js | 67 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 61 insertions(+), 6 deletions(-) (limited to 'client/splash/face/index.js') diff --git a/client/splash/face/index.js b/client/splash/face/index.js index 4090a9fa..5e7792d3 100644 --- a/client/splash/face/index.js +++ b/client/splash/face/index.js @@ -1,3 +1,4 @@ +import oktween from '../../util/vendor/oktween' import { choice } from '../../util' import { faces, names } from './faces' import * as markers from './markers' @@ -7,16 +8,70 @@ export function init() { const name = choice(names) const face = faces[name] markers.build(face) - mesh.load(name) + // mesh.load(name) + startAnimation() } -export function load() { +export function startAnimation() { const name = choice(names) const face = faces[name] - markers.swap(face) - // mesh.load(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() { +// export function update() { // markers.update() -} +// } -- cgit v1.2.3-70-g09d2 From 121cfd1b48254b54730ba323f0b60872f1c782d9 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 28 Jan 2019 20:28:36 +0100 Subject: more --- client/splash/constants.js | 8 ++++---- client/splash/face/index.js | 10 +++++++--- client/splash/renderer.js | 8 -------- 3 files changed, 11 insertions(+), 15 deletions(-) (limited to 'client/splash/face/index.js') diff --git a/client/splash/constants.js b/client/splash/constants.js index 520da350..1d00d068 100644 --- a/client/splash/constants.js +++ b/client/splash/constants.js @@ -3,9 +3,9 @@ export const CAMERA_NEAR = 0.001 export const CAMERA_FAR = 1000 -export const CAMERA_X = 0 -export const CAMERA_Y = 0 -export const CAMERA_Z = 1.5 +export const CAMERA_X = 0.5 +export const CAMERA_Y = -0.5 +export const CAMERA_Z = 2.5 export const FOG_COLOR = 0x191919 @@ -21,7 +21,7 @@ export const CLOUD_COLORS = [ export const CLOUD_SCALE = 1 export const CLOUD_ROTATION_SPEED = 0.001 -export const CLOUD_MAX_COUNT = 80 +export const CLOUD_MAX_COUNT = 100 export const CLOUD_TEXT_MIN_SIZE = 0.01 export const CLOUD_TEXT_MAX_SIZE = 0.04 diff --git a/client/splash/face/index.js b/client/splash/face/index.js index 5e7792d3..31ce8f3b 100644 --- a/client/splash/face/index.js +++ b/client/splash/face/index.js @@ -17,7 +17,7 @@ export function startAnimation() { const face = faces[name] mesh.remove() mesh.load(name).then(meshes => { - meshes.wireframe.position.z -= 0.01 + meshes.wireframe.position.z -= 0.001 markers.swap(face) .then({ from: { n: 0 }, @@ -31,19 +31,23 @@ export function startAnimation() { .then({ from: { n: 0 }, to: { n: 1 }, + delay: 500, duration: 500, easing: oktween.easing.quad_in, update: (obj) => { meshes.blank.material.opacity = 1 - obj.n meshes.solid.material.opacity = obj.n }, + finished: () => { + mesh.removeMesh('blank') + } }) .then({ from: { n: 0 }, to: { n: 1 }, delay: 500, - duration: 500, - easing: oktween.easing.quad_in_out, + duration: 1000, + easing: oktween.easing.quad_in, update: (obj) => { meshes.solid.material.opacity = 1 - obj.n meshes.wireframe.material.opacity = obj.n diff --git a/client/splash/renderer.js b/client/splash/renderer.js index 5e973d77..14326f77 100644 --- a/client/splash/renderer.js +++ b/client/splash/renderer.js @@ -21,9 +21,6 @@ lights[0].position.set(3, 3, 3).normalize() lights[1].position.set(-3, -3, -3).normalize() lights.forEach(light => scene.add(light)) -var ambient = new THREE.AmbientLight( 0x555555 ); -scene.add(ambient); - export function init() { const container = document.querySelector('#three_container') container.appendChild(renderer.domElement) @@ -37,8 +34,3 @@ export function init() { export function render() { renderer.render(scene, camera) } - - -window.scene = scene -window.THREE = THREE - -- cgit v1.2.3-70-g09d2