Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

College Algebra With Modeling And Visualization

Authors: Gary Rockswold

6th Edition

0134418042, 978-0134418049

More Books

Students also viewed these Programming questions

Question

Let a 0. Solve |x| 3.

Answered: 1 week ago