Public
Edited
Dec 28
Importers
30 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
// The object being shown at the moment
mutable obj = cube
Insert cell
function setObj (mesh) {
mutable obj = mesh;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
mutable view = mat4.lookAt([],[0,0,5],[0,0,0],[0,1,0])
Insert cell
mutable projection = mat4.perspective ([], 45 * Math.PI/180, 1, 0.01, 100)
Insert cell
mutable model = mat4.identity([])
Insert cell
Insert cell
Insert cell
refresh = {
let triMesh = triangleMesh(obj,displayConfig.flatShading);
let drawFaces = makeTriMeshDraw(triMesh);
let drawEdges = makeMeshEdgeDraw(obj);
let scaleFactor = displayConfig.autoSize ? Math.sqrt(3)/obj.radius : 1;
return function (model,view,projection) {
regl.clear({
color: toWebGLColor(displayConfig.background).concat([1]),
depth: 1
})
let conf = {modelview: mat4.mul([],view,model), projection, scaleFactor};
drawFaces(conf);
if (displayConfig.showEdges) drawEdges(conf)
}
}
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
demoImg = [FileAttachment("demo1.png"), FileAttachment("demo2.png"), FileAttachment("demo3.png"), FileAttachment("demo4.png"),FileAttachment("demo5.png")]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import {tabbed,paged,combo} from "@esperanc/aggregated-inputs"
Insert cell
import {select,checkbox,button,slider, color} from "@jashkenas/inputs"
Insert cell
createRegl = require('regl@1.4.2/dist/regl.js')
Insert cell
regl = createRegl({gl:canvas.getContext('webgl', {
antialias: true,
preserveDrawingBuffer: true
})})

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