Public
Edited
Feb 6, 2023
1 fork
67 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
reglLines = require('https://unpkg.com/regl-gpu-lines@2.2.0')
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
mainDrawLoop = {
initializeState;
camera.taint();
const simulate = ~opts.indexOf('Simulate');
let frame = regl.frame(() => {
try {
if (simulate) {
integrate({
src: state,
dst: tmpStateColumn,
srcColumn: mutable currentColumn,
dt,
t: mutable t
});

mutable t += dt;
mutable currentColumn = (mutable currentColumn + 1) % stepCount;

copyStateColumn({
src: tmpStateColumn,
dst: state,
dstColumn: mutable currentColumn
});
}

camera(({ dirty }) => {
// Only render if we're currently simulating or if the camera is moved
if (!simulate && !dirty) return;
regl.clear({ color: [1, 1, 1, 1], depth: 1 });

drawLines({
...lineData,
src: state,
texOffset: (mutable currentColumn - stepCount + 1) / stepCount
});
});
} catch (e) {
console.error(e);
frame && frame.cancel();
frame = null;
}
});
invalidation.then(() => {
frame && frame.cancel();
frame = null;
});
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more