summaryrefslogtreecommitdiff
path: root/client/splash/cloud/index.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2019-01-27 19:10:16 +0100
committerJules Laplace <julescarbon@gmail.com>2019-01-27 19:10:16 +0100
commit618af6682e6de7662da961abd7e7de3a2f996bac (patch)
tree6595cb673033c194d8e3b6d2bc91ed6a3dd8d160 /client/splash/cloud/index.js
parent215b201bdc4d2ddcc36c83c86b6e8133d5ad4add (diff)
render smaller tag cloud
Diffstat (limited to 'client/splash/cloud/index.js')
-rw-r--r--client/splash/cloud/index.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/client/splash/cloud/index.js b/client/splash/cloud/index.js
new file mode 100644
index 00000000..7bbc56c9
--- /dev/null
+++ b/client/splash/cloud/index.js
@@ -0,0 +1,34 @@
+import TextSprite from 'three.textsprite'
+
+import datasetList from './datasetList'
+import { choice } from '../../util'
+
+import { scene } from '../renderer'
+
+export const fontFamily = 'Helvetica, Arial, sans-serif'
+
+export function init() {
+ let sprites = Array.from({ length: Math.min(datasetList.length, 80) }, (t, i) => {
+ const sprite = new TextSprite({
+ textSize: 0.03 + Math.random() * 0.04,
+ redrawInterval: 1,
+ material: {
+ color: choice([ 0xffffff, 0xffffff, 0xffffff, 0xdddde6, 0x888896 ]),
+ },
+ texture: {
+ text: datasetList[i],
+ fontFamily,
+ },
+ })
+ sprite.position
+ .setX(Math.random())
+ .setY(Math.random())
+ .setZ(Math.random())
+ .subScalar(1 / 2)
+ .setLength(1 + Math.random())
+ .multiplyScalar(1)
+ scene.add(sprite)
+ return sprite
+ })
+ return sprites
+}