xxxxxxxxxx
40
let x = 0;
function setup() {
createCanvas(750, 500);
fill(255);
stroke(100);
}
function draw() {
//background(0);
textSize(32);
textSize(32);
text(frameCount, 10, 32);
//center guide lines
line(0, height/2, width, height/2);
line(width/2, 0, width/2, height);
// map colors to tan
freq = frameCount * 0.02;
let sinVal = map(sin(freq), -1, 1, -200, 200);
let cosVal = map(cos(freq), -1, 1, -200, 200);
let tanVal = map(tan(freq), -1, 1, -200, 200);
colors = map(tanVal,-1, 1, 0, 255)
fill(colors)
//let amp = 100;
//x = x+1
x = frameCount; // moves one step each frame
ellipse(x, height/2+sinVal, 50, 10);
ellipse(x, height/2+cosVal, 50, 10);
ellipse(x, height/2+tanVal, 50, 10);
}