Published
Edited
Nov 8, 2020
Insert cell
Insert cell
Insert cell
Insert cell
textDivider('在下面编写片元着色器(fragment shader)部分代码');
Insert cell
fragShaderSource = `
precision highp float; // 声明float的精度
// 与JS单向通信的变量
uniform vec2 u_size; // 当前画布的尺寸
uniform float u_time; // 一个随时间变化的量

void main() {
vec2 rg_size = gl_FragCoord.xy / u_size; // x,y分量限制在[0,1]
gl_FragColor = vec4(
abs(sin(u_time)),
rg_size.x,
rg_size.y,
1.0
);
}
`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function textDivider(text) {
return md`
---

${text}

---
`
}
Insert cell
Insert cell
Insert cell
Insert cell
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