xxxxxxxxxx
38
/*
Based on Alexander Miller’s video on Recreating Vintage Computer Art with Processing and inspired by John Whitney's work:
https://www.youtube.com/watch?v=LaarVR1AOvs&t=181s
*/
let t = 0;
function setup() {
createCanvas(windowWidth, windowHeight);
strokeWeight(2);
stroke(255);
frameRate(15);
}
function draw() {
background(0, 25);
translate(width / 2, height / 2);
let amplitude = width / 5;
let x1 = sin(t / 25) * amplitude + cos(t / 30 * amplitude);
let y1 = cos(t / 200) * amplitude + sin(t / 45 * amplitude);
let x2 = sin(t / 20) * amplitude * 2 + cos(t / 30 * amplitude);
let y2 = cos(t / 100) * amplitude * 2 + sin(t / 50 * amplitude);
line(x1, y1, x2, y2);
line(y2, x2, y1, x1);
t += 5;
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
background(0);
}