Skip to content

Instantly share code, notes, and snippets.

@alkemann alkemann/the_horror.js Secret
Created Sep 26, 2017

Embed
What would you like to do?
const WIDTH = 300, HEIGHT = 300;
function setup() {
createCanvas(WIDTH, HEIGHT)
background(0);
frameRate(30);
noLoop();
}
const left = (x, y) => line(x, y, x+10, y+10);
const right = (x, y) => line(x+10, y, x, y+10);
const loopy = (bias) => {
let x = 0, y = 0;
while (y < HEIGHT) {
random(100) > bias ? left(x, y) : right(x, y);
x += 10;
if (x >= WIDTH) {
x = 0;
y += 10;
}
}
}
function draw() {
strokeWeight(3); stroke(20, 240, 20);
loopy(85);
strokeWeight(1);stroke(240, 20, 20);
loopy(45);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.