SketchBook

音と音が重なり合う

var num;
var values = [];

var time;

function setup() {
createCanvas(windowWidth,
windowHeight);
angleMode(DEGREES);
noFill();

num = 50;
 for (var i = 0; i < num; i = i + 1) {
values[i] = 0.0;
}

time = 5.0;
}

function draw() {
 background(27, 27, 27);

for (var i = 4; i < num; i = i + 1) {
x = 360 / (num - 1) * i + time;
values[i] = windowWidth / 3 * sin(x);
var ellipseX = windowWidth / 3 + values[i];
var ellipseY = windowHeight / (num - 1) * i;

   stroke(0, 160, 250);
   ellipse(ellipseX, ellipseY - 50, 50);

stroke(240, 35, 95);
   ellipse(mirrorX(ellipseX), ellipseY + 50, 50);

stroke(150, 150, 150);
   line(ellipseX, ellipseY - 1,
mirrorX(ellipseX), ellipseY + 70);
}

time = time + 2;
}

function mirrorX(x) {
var mx;
mx = windowWidth - x;
return mx;
}