Skip to content

Instantly share code, notes, and snippets.

Janis Pritzkau janispritzkau

Block or report user

Report or block janispritzkau

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@janispritzkau
janispritzkau / index.html
Last active Nov 1, 2019
Rendering area chart with WebGL (1 million points)
View index.html
<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WebGL Chart</title>
<span id="fps">Loading</span>
<canvas></canvas>
<style>
body {
@janispritzkau
janispritzkau / webgl-example.js
Last active Oct 18, 2019
Simple WebGL example with basic error handling
View webgl-example.js
const canvas = document.querySelector("canvas")
canvas.width = 800, canvas.height = 600
canvas.style.width = `${canvas.width / devicePixelRatio}px`
const gl = canvas.getContext("webgl")
const vertexShader = gl.createShader(gl.VERTEX_SHADER)
const fragmentShader = gl.createShader(gl.FRAGMENT_SHADER)
gl.shaderSource(vertexShader, `
@janispritzkau
janispritzkau / game-of-life.html
Last active Aug 21, 2019
Code golf: Game of Life (286 bytes)
View game-of-life.html
<canvas id="c"><script>t=c.getContext("2d"),s=150,a=[];for(i=s*s;i--;)a[i]=Math.random()<.1;setInterval(_=>{b=[],t.clearRect(0,0,s,s);for(i=s*s;i--;){n=0;for(j=9;j--;)n+=a[(~~(i/s)+s+j%3-1)%s*s+(i+s+~~(j/3)-1)%s];b[i]=n==3||n-a[i]==3,a[i]&&t.fillRect((i%s),~~(i/s),1,1)}a=b},s)</script>
You can’t perform that action at this time.