Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                
              
            
!

CSS

              
                
              
            
!

JS

              
                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); //create the canvas
  background(20,60,90); //black background
  strokeWeight(0.1);//thin lines
  fill(0, 250, 250,80)//gradient fill
}

function draw() {
  translate(width/2,width/2) //translate the canvas for (0,0)middle
  x1 = cnt; //set x to counter
  y1 = (a*pow((x1),4))/100 //Polynomial y value ax^4
  if(y1>-200 && y1 <200){ //only draw circles if it is on the canvas
    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; //increase counter for x
    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; //increment screen reset counter
  if (t> 10){ 
    //background(0);//reset canvas
    fill(random(255), random(255), random(255),80) //randomize color after 10 rounds
  }
}
              
            
!
999px

Console