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

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

              
                <p id="loading">Now Loading...</p>
<ul>
  <li> <img src="
https://source.unsplash.com/ezSFnAFi9hY/500x500" alt="cut citrus fruits. " />Lorem Ipsum</li>
  <li> <img src="https://source.unsplash.com/TIGDsyy0TK4/500x500" alt="sliced mango. " />Dolor Sit</li>
  <li> <img src="https://source.unsplash.com/TdDtTu2rv4s/500x500" alt="a bunch of blueberries. " />Amet Consectetur</li>
  <li> <img src="https://source.unsplash.com/eudGUrDdBB0/500x500" alt="a pineapple sitting on a table. " />Adipiscing Elit</li>
  <li> <img src="https://source.unsplash.com/eJH4f1rlG7g/500x500" alt="frozen raspberries. " /> Nunc Tortor</li>
  <li> <img src="https://source.unsplash.com/24RUrLSW1HI/500x500" alt="a sliced strawberry. " />Metus Mollis</li>
  <li> <img src="https://source.unsplash.com/h5yMpgOI5nI/500x500" alt="an arrangement of assorted sliced fruits. " />Congue Sagittis</li>
  <li> <img src="https://source.unsplash.com/2TYrR2IB72s/500x500" alt="sliced watermelons. " />Vestibulum Et</li>
  <li> <img src="https://source.unsplash.com/1cWZgnBhZRs/500x500" alt="grapefruits, lemons, and pomegranates. " />Donec Eget</li>
  <li> <img src="https://source.unsplash.com/9aOswReDKPo/500x500" alt="half of an avocado. " />Maecenas et Justo</li>
  <li> <img src="https://source.unsplash.com/Nl7eLS8E2Ss/500x500" alt="half of a lime. " />Malesuada Quam</li>
  <li> <img src="https://source.unsplash.com/3HhXWJzG5Ko/500x500" alt="a single cherry with stem. " />Ultricies Sollicitudin</li>
  <li> <img src="https://source.unsplash.com/fczCr7MdE7U/500x500" alt="a bunch of bananas. " />Gravida Nibh</li>
  <li> <img src="https://source.unsplash.com/uI900SItAyY/500x500" alt="three pears. " />Pellentesque Sapien</li>
  <li> <img src="https://source.unsplash.com/0AynZdszfz0/500x500" alt="a basket full of peaches next to a plate with sliced peaches. " />Suspendisse Vel</li>
  <li> <img src="https://source.unsplash.com/C6JhUKs9q8M/500x500" alt="a bowl of avocados. " />Mauris Consectetur</li>
</ul>
              
            
!

CSS

              
                *
  padding: 0
  margin: 0
  overflow: hidden

ul
  display: none

p
  z-index: -1
  position: fixed
  top: 50%
  left: 50%
  transform: translate(-50%, -50%)
              
            
!

JS

              
                var w, m, c, C, W, H, HW, HH, r, d, nd, wv, p, countLoaded, nowIndex, ts, tm, te, images = [];

var makeCanvas = function () {
  document
    .getElementsByTagName("body")[0]
    .appendChild(document.createElement("canvas"));
  w = window;
  m = Math;
  c = document.getElementsByTagName("canvas")[0];
  C = c.getContext("2d");
};

var init = function () {
  W = c.width = w.innerWidth;
  HW = W / 2;
  H = c.height = w.innerHeight;
  HH = H / 2;
  wv = 0;
  p = 0;
  countLoaded = 0;
  nowIndex = 0;
};

var getImageData = function () {
  C.drawImage(images[nowIndex], HW - images[nowIndex].width / 2, HH - images[nowIndex].height / 2);
  d = C.getImageData(0, 0, W, H);
  nd = C.createImageData(W, H);
};

var loadImage = function (img) {
  img.addEventListener("load", function () {
    countLoaded++;
    if (countLoaded === images.length) {
      getImageData();
      f();
    }
  }, false);
};

var loadImages = function () {
  var htmlImages = document.getElementsByTagName("img");
  for (var i = 0; i < htmlImages.length; i++) {
    images[i] = new Image();
    images[i].crossOrigin = "Anonymous";
    images[i].src = htmlImages[i].src;
  }
  for (var i = 0; i < images.length; i++) {
    loadImage(images[i]);
  }
};

var f = function (t) {
  t /= 1000;
  C.save();
  C.clearRect(0, 0, W, H);
  for (i = 0; i < H; i++) {
    for (j = 0; j < W; j++) {
      o = m.floor(m.sin((i / m.sin(t)) * wv * wv + t) * ((t % m.tan(t)) * wv * wv));
      k = (i * W + j) * 4;
      s = (i * W + j + o) * 4;
      if (d.data[k + 3] > 0 && i + o > 0 && i + o < H) {
        nd.data[k + 0] = d.data[s + 0];
        nd.data[k + 1] = d.data[s + 1];
        nd.data[k + 2] = d.data[s + 2];
        nd.data[k + 3] = 0xff;
      }
    }
  }
  C.putImageData(nd, 0, 0);
  C.globalAlpha = 0.1;
  C.strokeStyle = "black";
  C.lineWidth = 200;
  C.beginPath();
  C.arc(HW, HH, 250 - 100, 0, m.PI * 2 * p, false);
  C.stroke();
  C.globalAlpha = 0.4;
  C.fillStyle = "black";
  C.font = "32px serif";
  C.textAlign = "center";
  C.textBaseline = "middle";
  C.fillText(m.floor(p * 100) + "%", HW, HH);
  C.restore();
  r = requestAnimationFrame(f);
};

window.onload = function () {
  makeCanvas();
  init();
  loadImages();
  c.onwheel = function (e) {
    wv += m.abs(e.deltaY / 200);
    p = wv / 10;
    if (wv > 10 && nowIndex < 15) {
      nowIndex++;
      getImageData();
      wv = 0;
    }
    if (wv > 10 && nowIndex >= 15) {
      nowIndex = 0;
      getImageData();
      wv = 0;
    }
  };

  c.ontouchstart = function (e) {
    var touch = e.targetTouches[0];
    ts = touch.pageY;
  };
  
  c.ontouchmove = function (e) {
    var touch = e.targetTouches[0];
    tm = touch.pageY;
    te = ts - tm;
    c.mouseX = touch.pageX;
    c.mouseY = touch.pageY;
    wv += m.abs(te / 700);
    p = wv / 10;
    if (wv > 10 && nowIndex < 15) {
      nowIndex++;
      getImageData();
      wv = 0;
    }
    if (wv > 10 && nowIndex >= 15) {
      nowIndex = 0;
      getImageData();
      wv = 0;
    }
  };
  
  c.ontouchend = function (e) {
    c.mouseX = null;
    c.mouseY = null;
    ts = null;
    tm = null;
    te = null;
  };
  
  w.onresize = function () {
    cancelAnimationFrame(r);
    init();
    getImageData();
    f();
  };
};

              
            
!
999px

Console