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

              
                <!-- HTML (Body-Only) -->
<svg xmlns="http://www.w3.org/2000/svg" style="display:none">
  <defs>
    <filter id="dissolve-filter" x="-200%" y="-200%" width="500%" height="500%" color-interpolation-filters="sRGB" overflow="visible">
      <feTurbulence type="fractalNoise" baseFrequency="0.004" numOctaves="1" result="bigNoise" />
      <feComponentTransfer in="bigNoise" result="bigNoiseAdjusted">
        <feFuncR type="linear" slope="5" intercept="-2" />
        <feFuncG type="linear" slope="5" intercept="-2" />
      </feComponentTransfer>
      <feTurbulence type="fractalNoise" baseFrequency="1" numOctaves="1" result="fineNoise" />
      <feMerge result="mergedNoise">
        <feMergeNode in="bigNoiseAdjusted" />
        <feMergeNode in="fineNoise" />
      </feMerge>
      <feDisplacementMap in="SourceGraphic" in2="mergedNoise" scale="0" xChannelSelector="R" yChannelSelector="G" />
    </filter>
  </defs>
</svg>

<div class="container">
  <div class="image-container">
    <img id="displayed-image" src="https://i.ibb.co/2sxT6jZ/Retro-80s-Human-Flying-Poster-cropped.jpg" alt="Selected Image">
    <button id="delete-image">Delete Image</button>
  </div>
  <p class="support-text">
    Crafted by <a href="https://refero.design?aff=9gJqd" target="_blank" rel="noopener noreferrer">Refero</a> team – we make design research faster and easier than ever
  </p>
</div>

<div class="safari-warning hidden">
  <p>⚠️ <strong>Safari is currently not supported.</strong> If you'd like to help improve Safari support, feel free to contribute to this project!</p>
</div>
              
            
!

CSS

              
                /* CSS */
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  padding: 0;
  background: #000;
  color: #fff;
  font-family: Arial, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  flex-direction: column;
}
.container {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.image-container {
  position: relative;
  width: 500px;
  max-width: 90vw;
  height: 500px;
  margin-bottom: 20px;
  background: #000;
  overflow: visible;
  border-radius: 24px;
}
#displayed-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: url(#dissolve-filter);
  -webkit-filter: url(#dissolve-filter);
  transform: scale(1);
  opacity: 1;
  border-radius: 24px;
  /* GPU acceleration hint */
  will-change: transform, opacity;
}
#delete-image {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 24px;
  font-size: 16px;
  cursor: pointer;
  background: #650000;
  color: #ff5c5c;
  border: none;
  border-radius: 25px;
  transition: transform 0.2s ease;
  z-index: 1;
}
#delete-image:hover {
  transform: translate(-50%, -50%) scale(1.2);
}
#delete-image:active {
  transform: translate(-50%, -50%) scale(0.9);
}
.hidden {
  display: none;
}
.support-text {
  font-size: 14px;
  color: #cfd3e1;
  width: 400px;
  margin-top: 10px;
}
.support-text a {
  color: #4babff;
  text-decoration: none;
}
.support-text a:hover {
  text-decoration: underline;
}
.safari-warning {
  padding: 20px;
  background: #af8900;
  color: #000;
  border: 2px solid #ff9900;
  border-radius: 8px;
  max-width: 500px;
  text-align: center;
}
.safari-warning p {
  margin: 0;
  font-size: 16px;
}

              
            
!

JS

              
                // JavaScript
document.addEventListener("DOMContentLoaded", () => {
  const $ = (sel) => document.querySelector(sel),
    $id = (id) => document.getElementById(id),
    delBtn = $id("delete-image"),
    img = $id("displayed-image"),
    filt = $("#dissolve-filter"),
    disp = filt.querySelector("feDisplacementMap"),
    bNoise = filt.querySelector('feTurbulence[result="bigNoise"]'),
    warn = $(".safari-warning"),
    cont = $(".container");

  // Simple Safari check
  if (
    /Safari/.test(navigator.userAgent) &&
    !/Chrome/.test(navigator.userAgent)
  ) {
    cont.classList.add("hidden");
    warn.classList.remove("hidden");
    return;
  }

  const config = { d: 1000, max: 2000, ease: (t) => 1 - (1 - t) ** 3 },
    imgs = [
      "https://i.ibb.co/2sxT6jZ/Retro-80s-Human-Flying-Poster-cropped.jpg",
      "https://i.ibb.co/W5qWCkK/mishkadoing-summer-flowers-sky-close-up-details-painting-grad-0e9886ef-403e-4514-866f-e7806fa3dad8-1.jpg",
      "https://i.ibb.co/Xp6s8KR/Monet-Flowers-Rocks-Corals.png",
      "https://i.ibb.co/cYp3hCD/Field-of-Wildflowers-Constellations.png",
      "https://i.ibb.co/5FP5HD9/Summer-Flowers-Sky-Close-Up.png",
      "https://i.ibb.co/cL1fKgc/Summer-Flowers-Painting.png"
    ];
  let i = 0;
  const preload = (url) => (new Image().src = url);

  // Optimized dissolve animation with cached config values
  const animate = (cb) => {
    const start = performance.now(),
      { d, max, ease } = config; // cache configuration values
    bNoise.setAttribute("seed", Math.floor(Math.random() * 1000));
    const step = (now) => {
      const t = Math.min((now - start) / d, 1),
        e = ease(t);
      disp.setAttribute("scale", e * max);
      // Batch style updates
      img.style.transform = `scale(${1 + 0.1 * e})`;
      img.style.opacity = t < 0.5 ? "1" : String(1 - (t - 0.5) / 0.5);
      t < 1 ? requestAnimationFrame(step) : cb();
    };
    requestAnimationFrame(step);
  };

  delBtn.addEventListener("click", () => {
    if (img.style.display === "none") return;
    delBtn.classList.add("hidden");
    animate(() => {
      // Reset image state
      img.style.display = "none";
      img.style.transform = "scale(1)";
      img.style.opacity = "1";
      disp.setAttribute("scale", "0");
      // Update image and preload next one
      img.src = imgs[(i = ++i % imgs.length)];
      img.style.display = "block";
      delBtn.classList.remove("hidden");
      preload(imgs[(i + 1) % imgs.length]);
    });
  });

  preload(imgs[(i + 1) % imgs.length]);
});

              
            
!
999px

Console