var cnt =-12;//x-value and counter for each polynomial
var a=1,t=0;//initial a, and reset counter t
function setup() {
createCanvas(400, 400);
background(20,60,90);
strokeWeight(0.1);//thin lines
fill(0, 250, 250,80)//gradient fill
}
function draw() {
translate(width/2,width/2)
x1 = cnt;
y1 = (a*pow((x1),4))/100
if(y1>-200 && y1 <200){
circle(x1*20,y1,5)//draw a circle for a point on the polynomial
circle(x1*10,y1,5)//draw a circle for a point on the polynomial (modify x)
circle(x1*5,y1,5)//draw a circle for a point on the polynomial(modify x)
circle(x1,y1,5)//draw a circle for a point on the polynomial(modify x)
}
cnt=cnt+0.2;
if (cnt>12){//draw the next polynomial
newCoeff();// function to change coefficients
}
}
function newCoeff(){
a = random(-5,5)//change a
cnt = -12;//reset cnt
t = t+1;
if (t> 10){
fill(random(255), random(255), random(255),80)
}
}