<script language="javascript" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.3/p5.js"></script>
body {margin:0px; padding:0px; overflow: hidden}
function setup() {
createCanvas(windowWidth, windowHeight);
const N = 1280;
}
let N = 1;
function draw() {
background(235, 255, 160);
push();
for (let i = 0; i < N; i++) {
const h = Hammersley(i, N);
noStroke();
fill(0);
circle(h[0] * width, h[1] * height, 2);
}
pop();
N ++;
if (N > 1280) {N = 0;}
}
function VanDerCorput(n, base)
{
let invBase = 1.0 / base;
let denom = 1.0;
let result = 0.0;
for (let i = 0; i < 32; ++i)
{
if (n > 0)
{
denom = float(n) % 2.0;
result += denom * invBase;
invBase = invBase / 2.0;
n = floor(n / 2.0);
}
}
return result;
}
function Hammersley(i, N) {
return [i / N, VanDerCorput(i, 2)];
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.