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 y1 = 50, x = 0; //set value of y on canvas and inital exponent
function setup() {
  createCanvas(400, 400); //create the canvas
  frameRate(1); //draw slow
}
function draw() {
  num =  pow(2,x); //num = 2^x 
  fill(random(255),random(255),random(255));//randomize color
  circle(200,y1,num)//draw circle with 2^x diameter
  text('2',x*20,12);//write 2 and have it move left with each circle
  text('x',x*20-10,12);//write x and have it move left with each circle
  fill(255)//make a white rectangle diameter text
  rect(330,0,100,20)//rectangle for diameter text
  fill(0)//make the text black
  text(str(num),350,12)//diamter text box
  x = x+1;//increase the exponent by 1
  y1 = y1+12;//move the center of the circle down 12 
  if(x == 11){//make sure that the animation loops and doesn't crash
    x = 0;//reset x
    y1 = 100;//reset y
    background(255)//reset background
  } 
}
              
            
!
999px

Console