Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <canvas id="canvas" width=1800 height=1200 style=width:100%></canvas>

<script id="source" type="plain">
#include util
@run {
  vec2 uv = UVx2() * rot2(.5);
  float x = mod(uv.x, .05);
  float y = mod(uv.y - uTime * .05, .05);
  FLUSH(max(x, y) < 0.03 ? 0.5 : 0.0);
}
</script>

<div class="layer" id="logs" style="color:#ff0;text-shadow:0 0 6px #000"></div>

<div class="layer" id="info" style="color:#f00;text-shadow:0 0 6px #000;text-align:center"></div>

<div class="layer" style="text-align:right">
  <button id="pause">pause</button>
  <button id="resume">resume</button>
  <button id="stopp">stop</button>
</div>

              
            
!

CSS

              
                body{font-family:monospace;font-size:130%;margin:0;background:#000}
.layer{position:absolute;left:0;top:0;bottom:0;right:0;padding:1rem}
              
            
!

JS

              
                /*

  DDZEB lands runner demo
  https://ddzeb.com
  
*/

(async() => {
  
  const {frag} = await import('https://ddzeb.com/lands/frag');
  const lands  = await import('https://ddzeb.com/lands/runner');
  const runner = lands.runner();
  
  // configure event handlers
  const logmsg = (msg) => {
    const div = document.createElement('div');
    div.innerText = msg;
    logs.appendChild(div);
    return div;
  };
  runner.onlog    = logmsg;
  runner.onstatus = (status) => logmsg('status:' + status);
  runner.onfps    = (fps, time, frame) => {
    info.innerText = frame + ' / ' + fps.toFixed(1) + ' fps';
  };
  
  // prepre
  runner.bind(canvas);
  runner.init();
  
  // attach rendering engine
  await frag(canvas, {
    preludes : 'base',
    progcode : source.innerText,
  });
  
  // animation
  runner.loop(canvas.render);
  
  // status control
  pause.addEventListener('click', runner.pause);
  resume.addEventListener('click', runner.resume);
  stopp.addEventListener('click', () => {
    runner.stop();
    runner.unbind();
  });
  
})();
              
            
!
999px

Console