xxxxxxxxxx
46
/*
Based on Lissajous Curve from Code as a Creative Medium
https://github.com/CodeAsCreativeMedium/exercises/blob/main/09_curves/06_lissajous/lissajous_js/lissajous_js.js
p. 164: "Lissajous curves are parametric functions of the form:
x = cos(a*t);
y = sin(b*t);
where a and b are typically small whole numbers."
*/
let x1, y1;
let t = 1;
let a = 3;
let b = 2;
function setup() {
createCanvas(windowWidth, windowHeight);
console.log(windowWidth);
stroke(255);
strokeWeight(8);
}
function draw() {
background(0, 5);
let xAmplitude = width * 0.375;
let yAmplitude = height * 0.375;
let xShift = width / 2;
let yShift = height / 2;
x = xAmplitude * cos(a * t / 10) + xShift;
y = yAmplitude * sin(b * t / 10) + yShift;
point(x, y)
t += 0.1;
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
background(0);
}