Public
Edited
Sep 25, 2023
2 forks
15 stars
Insert cell
Insert cell
SwissGL = fetch(
"https://raw.githubusercontent.com/google/swissgl/024ff9c26495a9e30b3b361a0ebdf230e89ac6c7/swissgl.js"
)
.then((d) => d.text())
.then((d) =>
eval(`(function() { ${d.replace(/(function SwissGL)/, "return $1")} })()`)
)
// (We can alternatively load the library with esm.sh, but for some reason my example code fails with that version.)
// SwissGL = import("https://esm.sh/gh/google/swissgl").then((d) => d.default)
Insert cell
{
const canvas = document.createElement("canvas");
canvas.width = 600;
canvas.height = 400;
const glsl = SwissGL(canvas);

function render(t) {
t /= 1000; // ms to sec
glsl({ t }, `P,cos(t*TAU),1`);
requestAnimationFrame(render);
}
render();
return canvas;
}
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