Pen Settings



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


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.


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.






                var  x2 = 200, y2 = 200; // initial ordered pairs (at center of screen)
function setup() {
  createCanvas(400, 400); //create the canvas
  background(60); //black background
  frameRate (9); //frame rate or speed

function draw() {
  stroke(random(20), random(255), 255) //random linecolor
  strokeWeight(100-frameCount/3);//shrinking line width with each frame
  x1 = random(400);//random x1 value
  y1 = random(400);//random y1 value
  x2 = random(400);
  y2 = random(400);
  line1 = line(x1,y1,x2,y2) //draw line from center (200,200) to random (x1,y1)
  m1 = (y2-y1)/(x2-x1); //calculate slope of line1
  b1 = y1-x1*m1 //find b for line 1
  m2 = -1/(m1) //perpendicular slope is -1/m for line 1
  b2 = y1-x1*m2 //find b of line2 (y = mx+b)
  line(x2,m2*x2+b2,x1,m2*(x1)+b2) //two points (x2,y2) and (x1,m2(x1)+b2)
  if(frameCount >300){