going somewhere

This commit is contained in:
didier amyot committed 2024-01-27 07:00:26 -05:00
1 parent a7cb0e7fa7
commit 1da186a759
8 files changed
+3660 -6883

No files matched your search

+9
View File
@@ -14,6 +14,15 @@
<h1>Hello, world!</h1>
<h3 id="first-ts"></h3>
<div>
<select>
<option value="lmbn_n_cuhk03_d">lmbn_n_cuhk03_d</option>
</select>
</div>
<svg width="900" height="450" id="first" style="background-color: lightgray">
</svg>
+14 -6
View File
@@ -1,5 +1,7 @@
import anime from "https://esm.sh/animejs@3.2.2";
import m from "https://esm.sh/mithril@2.2.2"
import colormap from "https://esm.sh/colormap@2.3.2"
const second = 1000;
@@ -68,23 +70,29 @@ document.querySelector('#seek').onclick = function(){
function generatePoints(points, frames){
const lst = [];
for(const point of points.points){
const colors = colormap({
colormap: 'viridis',
nshades: new Set(points.map(p => p.objectId)).size,
format: 'hex',
alpha: 1
});
for(const point of points){
if(frames.indexOf(point.frameIndex) !== -1){
lst.push(m("circle", {cx: point.y, cy: point.x, r: 3, fill: point.color}));
lst.push(m("text", {x: point.y, y: point.x, fill: colors[point.objectId]}, point.objectId));
}
}
return m("g", lst);
}
function getTimeStamp(points, frameId){
for(const point of points.points){
for(const point of points){
if(point.frameIndex === frameId){
return `${point.frameTimestamp / 1000} seconds`;
}
}
}
const url = "/dodgeball-tracker/outputs/output.json";
const url = "/dodgeball-tracker/outputs/output-lmbn_n_cuhk03_d.json";
const resp = await fetch(url);
const points = await resp.json();
@@ -97,5 +105,5 @@ function range(min, max){
return ret
}
m.render(document.getElementById("first"), generatePoints(points, range(-10, 400)));
m.render(document.getElementById("first-ts"), m("span", getTimeStamp(points, 80)));
m.render(document.getElementById("first"), generatePoints(points.points, range(-10, 400)));
m.render(document.getElementById("first-ts"), m("span", getTimeStamp(points.points, 80)));