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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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.


                <script src=></script>
<!-- <script src=loader.js></script> -->

<div class="cover flexbox-container" id=myContainer>
  <div id=loading><h2>Loading</h2></div>
  <div class=title>
      <li class=item-title></li>
      <li class=item-description></li>
      <li><a id=jsRefresh href=#><b>Run Another Random Sketch</b></a></li>




 * Random p5.js Loader (v3.0.2)
 * by  FedPep   (2016-Dec-13)
 * mod GoToLoop (2016-Dec-21)
 * browser-one-click-behind-when-loading-different-p5-sketches-on-click#Item_4

"use strict";

$(document).ready(() => {
  const $loading = $('#loading'),
        $title = $('.item-title'),
        $descript = $('.item-description'),
        JSON_URL = '',
        actions = () => (pickAnotherItem(), loadScripts()),
        intRandom = (n = 2) => n * Math.random() | 0;

  let json, item, idx, scripts;

  $.getJSON(JSON_URL, data => {
    if (!data.length)  return $title.html('ERROR! Empty JSONArray!!!');

    $.ajaxSetup({ cache: true });
    window.mocha || (window.mocha = 'Hack to stop global auto run for p5.js');

    json = data, actions();
   .fail(() => $title.html('ERROR! JSON file loading failed!!!'));

  function pickAnotherItem() {
    if (json.length === 1)  return item = json[0];
    for (var rnd; (rnd = intRandom(json.length)) === idx; );
    return item = json[idx = rnd];

  function loadScripts() {

    scripts = [...item.includes, item.href];
    scripts.length && loadOrdered();

  function loadOrdered() {
    $.getScript(scripts.shift(), scripts.length && loadOrdered || sketchLoaded);

  function sketchLoaded() {
    $title.html(item.title + ' | ' +;

    window.p5 && (window.setup || window.draw) && new p5;

  function p5RemoveHack() {
    if (window.p5 && p5.instance) {
      p5.instance = window.setup = window.draw = null;
    } else {
      const canv = document.querySelector('canvas');
      canv && canv.remove();