Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

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


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

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.






                var cnt =-12;//x-value and counter for each polynomial
var a=1,t=0,tmp =1,x1=-12,y1= -12;//initialize variables
function setup() {
  createCanvas(400, 400); //create the canvas
  background(255); //black background
  strokeWeight(0.4);//thin lines
  fill(255,40);//transparent fill

function draw() {
  translate(width/2,width/2) //translate the canvas for (0,0)middle
  rotate(t);//rotate canvas with each polynomial
  oldx = x1;//save previous x
  oldy = y1;//save previous y
  x1 = cnt; //set x to counter
  y1 = (a*pow((x1),tmp)) //Polynomial using tmp as power
  if(y1>-200 && y1 <200){ //only draw circles if it is on the canvas
    if ((tmp % 2 )== 0){//condition for even function
        stroke(230,100,20);//color for even
    if ((tmp % 2 )== 1){//condition for odd function
        stroke(20,60,90);//color for odd
    line(x1*15,y1,oldx*15,oldy) //draw line from previous point to the next
    circle(x1*15,y1,x1*10)//draw a circle for a points on the polynomial
    cnt=cnt+0.2; //increase counter for x
    if (cnt>12){//condition to draw the next polynomial
      newPoly();// function to change coefficients
function newPoly(){
  a = random(-5,5)//change a
  cnt = -12;//reset cnt
  t = t+1; //increment rotation
  x1=-12,y1= -12//reset initial x and y values