Pen Settings



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


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.


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.


  <div class="cover"></div>



                :root {
  --pixel: 1px;
  --cover: black;
  --duration: 500ms;
  --covered: calc(var(--pixel) * 4); /*5 frames, 4 covered at a time */
  --space: white; /* will cause transparency when mix blend mode multiply */
  --w: 240px;
  --h: 160px;
  --direction: normal;
  --blend: multiply;
main div {
  --offset: calc(var(--pixel) * 1);
  --ball-position: 0% 60%;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  overflow: hidden;
    linear-gradient(to right, 
      transparent 0, transparent calc(var(--pixel)), 
      var(--space) var(--pixel), var(--space) calc(var(--covered))),
    radial-gradient(circle at var(--ball-position), 
      hotpink 0px, hotpink 45px, white 55px);
  mix-blend-mode: var(--blend);
  background-position: calc(var(--offset) - calc(var(--pixel) * 1)) 0, center center;
  background-size: calc(var(--pixel) * 5) 100%, 100% 100%;
  transform: translateX(52%);

main div:nth-of-type(2) {
  --offset: calc(var(--pixel) * 2);
  --ball-position: 25% 75%;
main div:nth-of-type(3) {
  --offset: calc(var(--pixel) * 3);
  --ball-position: 50% 60%;
main div:nth-of-type(4) {
  --offset: calc(var(--pixel) * 4);
  --ball-position: 75% 50%;
main div:nth-of-type(5) {
  --offset: calc(var(--pixel) * 5);
  --ball-position: 100% 60%;

.no-animation {
  --show: paused;

/*the sliding cover that triggers the motion illusion */
.cover {
    linear-gradient(to right, 
      transparent 0px, transparent calc(var(--pixel) * 1), 
      var(--cover) calc(var(--pixel) * 1), 
      var(--cover) calc(var(--pixel) * 5));
  background-size: calc(var(--pixel) * 5) 100%;
  transform: translateX(-52%);

@keyframes slide {
  100% {
    transform: translateX(var(--covered));

main {
  width: var(--w);
  height: var(--h);
  position: relative;
  transition: transform var(--duration) ease-in-out;
  background: white;
  transform: scale(1);
*, *::after {
  box-sizing: border-box;

body {
  width: 100%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  background: hsl(203, 50%, 98%);
  margin: 0;
  overflow: hidden;
  overflow-y: scroll;
  font-family: system-ui, 'Segoe UI', sans-serif

button {
  appearance: none;
  background: transparent;
  border: .1rem solid currentColor;
  padding: .5rem 1rem;
  font-size: 1rem;
  background: hsl(203, 50%, 94%);



                document.getElementById('go').addEventListener('click', function() {