Published
Edited
Mar 3, 2021
22 forks
24 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
vertexLocation = gl.getAttribLocation(program, 'position')
Insert cell
Insert cell
resolutionLocation = gl.getUniformLocation(program, 'iResolution')
Insert cell
offsetLocation = gl.getUniformLocation(program, 'distanceOffset')
Insert cell
Insert cell
drawFrame = {
loadVertices; // Reactive dependency!
gl.clearColor(0.0, 0.0, 0.0, 1.0); // Opaque black
gl.clear(gl.COLOR_BUFFER_BIT);
gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);
gl.useProgram(program);

gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
gl.vertexAttribPointer( vertexLocation, 2, gl.FLOAT, false, 0, 0);
gl.enableVertexAttribArray(vertexLocation);
gl.uniform3fv(resolutionLocation, [canvas.width,canvas.height,1])
gl.uniform1f(offsetLocation, config.offset)
gl.drawArrays(gl.TRIANGLES, 0, 6);
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more