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
Step: 1
To create multiple circles you can simply create an array of Circle objects and then call the draw m...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get StartedRecommended Textbook for
College Algebra With Modeling And Visualization
Authors: Gary Rockswold
6th Edition
0134418042, 978-0134418049
Students also viewed these Programming questions
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
View Answer in SolutionInn App