diff options
Diffstat (limited to 'derelict.js')
-rw-r--r-- | derelict.js | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/derelict.js b/derelict.js index 77767bf..ff100e0 100644 --- a/derelict.js +++ b/derelict.js @@ -9,7 +9,7 @@ const SCALE = 10000 init() animate() -function Wreck(vec3) { +function Wreck(vec3, km) { const point = new THREE.Object3D() point.position.copy(vec3) @@ -56,12 +56,29 @@ function processKillmails(killmails) { let positions = clusters[0].map(km => km.victim.position) positions.forEach(pos => center.add(new THREE.Vector3(pos.x, pos.y, pos.z))) center.divideScalar(positions.length) + clusters[0].sort((a, b) => a.killmail_time.localeCompare(b.killmail_time)) + let elements = [] clusters[0].forEach(km => { const vec3 = km.victim.position vec3.sub(center) vec3.divideScalar(SCALE) - scene.add(Wreck(vec3)) + const point = new THREE.Object3D() + point.position.copy(vec3) + const div = document.createElement('div') + div.className = 'wreck' + const w = document.importNode(wreck, true) + div.appendChild(w) + const label = new CSS2DObject(div) + point.add(label) + scene.add(point) + elements.push(div) }) + const timeline = document.getElementById("timeline") + timeline.max = elements.length + 1 + timeline.oninput = function () { + elements.slice(0, this.value).forEach(element => element.classList.add("killed")) + elements.slice(this.value, this.max).forEach(element => element.classList.remove("killed")) + } } function init() { |