Published
Edited
Mar 8, 2020
1 fork
2 stars
Insert cell
Insert cell
createREGL = require('https://unpkg.com/regl@1.3.1/dist/regl.min.js')
Insert cell
function createGL (opts) {
var canvas = html`<canvas width="960" height="600">`
var regl = createREGL(Object.assign({canvas: canvas}, opts || {}))
return {canvas, regl}
}
Insert cell
gl = createGL()
Insert cell
Insert cell
Insert cell
Insert cell
cmd = gl.regl({
vert: vertexShader,
frag: fragmentShader,
attributes: {
a_vertex: [[-1, -1], [+1, -1], [+1, +1], [-1, +1]],
},
uniforms: {
u_size: gl.canvas.width,
u_time: gl.regl.prop("u_time")
},
primitive: "triangle fan",
count: 4
})
Insert cell
function draw (t) {
gl.regl.clear({color: [0, 0, 0, 1]})
cmd({u_time: t})
}
Insert cell
draw((now % 100000) / 1000)
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