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

              
                <html lang="en">
<head>
  <meta charset="UTF-8" />
  <title>d100 18/100 grid</title>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <title>Document</title>
  <style>
  ul {
    position:fixed;
    color:white;
    position:absolute;
    right:10%;
    bottom:10%;
  }

input[type=range] {
  width:40%;
  display:inline-block;
}

  </style>
  
  <script src="https://codepen.io/sixsided/pen/xCLFA.js"></script>
  <script src="https://code.createjs.com/createjs-2014.12.12.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ramda/0.11.0/ramda.min.js"></script>
<!--  <script src="/lib/lib6.js"></script>
  <script src="/lib/easeljs-NEXT.min.js"></script>
  <script src="/lib/ramda.js"></script>
-->
 </head>
<body>
<input type="range" id="a" min="-1" max="1" value="0" step="0.01">
<input type="range" id="b" min="-1" max="1" value="0" step="0.01">
<input type="range" id="c" min="-1" max="1" value="0" step="0.01">
<input type="range" id="d" min="-1" max="1" value="0" step="0.01">
  <script src="_d.js"></script>
</body>
</html>
<!--

Separable blend modes
  normal blend mode
  multiply blend mode
  screen blend mode
  overlay blend mode
  darken blend mode
  lighten blend mode
  color-dodge blend mode
  color-burn blend mode
  hard-light blend mode
  soft-light blend mode
  difference blend mode
  exclusion blend mode

Non-separable blend modes
  hue blend mode
  saturation blend mode
  color blend mode
  luminosity blend mode

-->
              
            
!

CSS

              
                
              
            
!

JS

              
                /*eslint-disable*/
/* day 18/100 matrix */
/*global lib6, R, createjs */

document.body.style.backgroundColor = '#111111';

// -- constants + common setup ---------------------------------
var W = window.innerWidth * .85,
    H = window.innerHeight * .85,
    C = [W/2,H/2];

var cnvs = document.createElement('canvas');
document.body.appendChild(cnvs);
// update the canvas' attributes to counter stretching
cnvs.setAttribute('width',  W);
cnvs.setAttribute('height', H);

// -- setup ---------------------------------

function drawing(cb){
  var g = new createjs.Graphics();
  var s = new createjs.Shape(g);
  cb(g, s);
  return s;
}

function zeroGroup(){
  return new createjs.Container().set({x:C[0], y:C[1]});
}

var stage = new createjs.Stage(cnvs);
// var group = ...
var shape = new createjs.Shape();
stage.addChild(shape);
// stage.addChild(shape);

// -- animation -----------------------------------
// createjs.Ticker.addEventListener("tick", _ => {
//   stage.update();
// });
var gap        = 60,
    offset     = 100,
    N          = Math.ceil( W / gap ),
    rad        = 30,
    circleSize = 5;

console.log(gap, offset, N, W);
var hue        = 0,
    saturation = 100,
    lightness  = 50;

// var fills = 'red orange yellow blue indigo violet'.split(' ');
// g2.compositeOperation = 'screen';

// Undulation extremity cycle
// lib6.Time.cycle(5000, (phase) => {
//   rad = 30 + 30 * lib6.sin1(phase)
// })

// Circle size cycle
lib6.Time.cycle(10000, (phase) => {
  circleSize = 25 + 20 * lib6.sin1(phase)
})

// Hue angle cycle
lib6.Time.cycle(7777, h => hue = Math.floor(h * 360));

// Render cycle: lightness, position
var overphase = 0, start = +new Date;
lib6.Time.cycle(1000, (phase, msec) => {
  overphase = (+new Date - start) / 1000;
  var G = shape.graphics;
  G.clear();
  R.range(0,N).map( i => {
    R.range(0,N).map( j => {
      // G.beginFill(fills[(i * N + j) % fills.length]);
      // G.beginStroke('white')
      // G.beginStroke('hsl(', [hue, saturation, lightness].join(','));
        G.beginStroke(createjs.Graphics.getHSL(
          hue, 
          saturation, 
          Math.max(25, 25 + lightness * lib6.sin1((overphase / 12) * i/N))
          ));
      G.drawCircle(
        j * gap + offset + gap * lib6.cos1(overphase * i/N) //+ lib6.sin1(phase) * i/N * rad, 
       ,i * gap + offset + gap * lib6.sin1(overphase * j/N) //+ lib6.cos1(phase) * j/N * rad,
       ,circleSize
      )
      G.endStroke();
      // G.endFill();
    })
  })
  stage.update();
});

function handleRange(sel, label, cb){
  document.querySelector(sel).addEventListener('input', e => {
    cb(e.target.value);
    lib6.dbg(label, e.target.value);
  });
}
handleRange('#a', 'offset', v => offset = 100 + 100 * v);
handleRange('#b', 'spacing', v => gap = 30 + 30 * v);
handleRange('#c', 'count', v => N = 15 + Math.floor(14 * v));
handleRange('#d', 'lightness', v => lightness = 50 + 50 * v);

// -- interactions -----------------------------------
var theMouseWithin = false;
cnvs.addEventListener('mousemove', e => {
  theMouseWithin = true;
  // theBias.x = 4 * (e.offsetX - C.x) / W;
  // theBias.y = 4 * (e.offsetY - C.y) / H;
  lib6.dbg('mouse offset', e.offsetX, e.offsetY);
});

cnvs.addEventListener('mouseout', e => {
  theMouseWithin = false;
});

// document.body.addEventListener('mousedown', function(e){ 
//   // block annoying accidental selection
//   e.preventDefault(); 
// });

// -- messages / ui -----------------------------
// lib6.dbg('protip', '');
createjs.Ticker.timingMode = createjs.Ticker.RAF;
              
            
!
999px

Console