Published
Edited
Dec 25, 2020
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
snowFlakeRenderable = ({
frag: `
precision mediump float;
uniform float alpha;
void main () {
gl_FragColor = vec4(0.5,0.1,0.9,alpha);
}`,

vert: `
attribute vec2 position;
uniform mat4 projection, view;
void main () {
gl_Position = projection * view * vec4(position, 0, 1);
}`,

attributes: {
position: snowFlake2D.positions
},

uniforms: {
view: snowFlakeViewMatrix,
projection: snowFlakeProjectionMatrix,
alpha: +srcAlpha
},
count : snowFlake2D.positions.length
})
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
snowFlakeViewMatrix = mat4.lookAt([],[ 0, 0, 1000],[0, 0, 0], [0, 1, 0])
Insert cell
snowFlakeProjectionMatrix = mat4.perspective([], Math.PI / 4, canvasWidth / canvasHeight, 500, 5000)
Insert cell
Insert cell
Insert cell
Insert cell
disableBlend = regl({
blend: {
enable: false
}
})
Insert cell
enableBlend = regl({
blend: {
enable: true,
func: {
src:blendOptions.srcFactor,dst:blendOptions.dstFactor //default: src:'src alpha',dst:'one minus src alpha'
},
equation: 'add', // Default. Yoy may or may not add this line.
},
depth: { enable: false }
})
Insert cell
blendOptions
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

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