diff options
Diffstat (limited to 'client/splash/cloud/index.js')
| -rw-r--r-- | client/splash/cloud/index.js | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/client/splash/cloud/index.js b/client/splash/cloud/index.js index 7bbc56c9..f753e77c 100644 --- a/client/splash/cloud/index.js +++ b/client/splash/cloud/index.js @@ -1,19 +1,31 @@ +import { Object3D } from 'three' + import TextSprite from 'three.textsprite' import datasetList from './datasetList' import { choice } from '../../util' +import { + CLOUD_COLORS, + CLOUD_ROTATION_SPEED, + CLOUD_MAX_COUNT, + CLOUD_TEXT_MIN_SIZE, + CLOUD_TEXT_MAX_SIZE, +} from '../constants' + import { scene } from '../renderer' export const fontFamily = 'Helvetica, Arial, sans-serif' +let cloud = new Object3D() + export function init() { - let sprites = Array.from({ length: Math.min(datasetList.length, 80) }, (t, i) => { + let sprites = Array.from({ length: Math.min(datasetList.length, CLOUD_MAX_COUNT) }, (t, i) => { const sprite = new TextSprite({ - textSize: 0.03 + Math.random() * 0.04, + textSize: CLOUD_TEXT_MIN_SIZE + Math.random() * (CLOUD_TEXT_MAX_SIZE - CLOUD_TEXT_MIN_SIZE), redrawInterval: 1, material: { - color: choice([ 0xffffff, 0xffffff, 0xffffff, 0xdddde6, 0x888896 ]), + color: choice(CLOUD_COLORS), }, texture: { text: datasetList[i], @@ -27,8 +39,13 @@ export function init() { .subScalar(1 / 2) .setLength(1 + Math.random()) .multiplyScalar(1) - scene.add(sprite) + cloud.add(sprite) return sprite }) - return sprites + scene.add(cloud) + return cloud +} + +export function update() { + cloud.rotation.y += CLOUD_ROTATION_SPEED } |
