Question: This is my code everything works fine but i want more circles to appear can someone tell me how i can multiply the circles thanks

This is my code everything works fine but i want more circles to appear can someone tell me how i can multiply the circles thanks

function Circle() { this.name = "circle"; var x = 0; var y = 0;

var spectrumSpeed = 2;

this.draw = function(){

var spectrum = fourier.analyze(); // Increment x position of spectrum by 2 pixels every frame x += spectrumSpeed; // noise to move y position of spectrum y = noise(frameCount * 0.003) * height;

// Bounce spectrum back and forth horizontally if(x > width || x < 0){ spectrumSpeed *= -1; } noStroke(); for (var i = 0; i < spectrum.length; i++){ var c = map(spectrum[i], 0,255, 255, 0); fill(0,spectrum[i],c); var size = map(spectrum[i],0, 255, 0, random(0,width/3)); circle(x,y, size); };

} }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To create multiple circles you can simply create an array of Circle objects and then call the draw m... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!