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

              
                <!-- CSS Only animation of still frames sequence extracted from D A R K serie of Baran Bo Odar https://www.netflix.com/fr/title/80100172 -->
<!-- Commands -->
<input type="radio"
       name="cmd-play-pause"
       id="cmd-play"
       class="u-d-none"
       checked>
<input type="radio"
       name="cmd-play-pause"
       id="cmd-pause"
       class="u-d-none">
<input type="radio"
       name="cmd-direction"
       id="cmd-normal"
       class="u-d-none">
<input type="radio"
       name="cmd-direction"
       id="cmd-reverse"
       class="u-d-none">
<input type="radio"
       name="cmd-direction"
       id="cmd-alternate"
       class="u-d-none"
       checked>
<input type="radio"
       name="cmd-direction"
       id="cmd-alternate-reverse"
       class="u-d-none">

<!-- Animation container -->
<figure id="the_scene" 
        class="scene u-p-none u-m-none"></figure>

<!-- Title -->
<h1 class="c-position m-fixed m-middle-center m-anchor-middle-center c-grid m-nowrap u-m-none u-ff-lead u-fw-100 u-fs-xl u-tt-uppercase u-c-primary-max">
    <span class="u-inline-block u-ml-xs u-mr-xs">D</span>
    <span class="u-inline-block u-ml-xs u-mr-xs">A</span>
    <span class="u-inline-block u-ml-xs u-mr-xs" 
          id="special-letter">
        <span class="u-inline-block">R</span>
    </span>
    <span class="u-inline-block u-ml-xs u-mr-xs">K</span>
</h1>

<!-- Commands -->
<nav class="c-position m-fixed m-bottom-0 m-left-0 u-p-sm u-w-100 u-bg-gradient-vertical" 
     u-fs-xs="sm">
    <ul class="c-grid m-nowrap u-ls-none u-p-none u-m-none">
        <li>
            <label for="cmd-play" 
                   class="u-p-sm u-cur-pointer" 
                   u-p-xs="sm">
                play
            </label>
            <label for="cmd-pause" 
                   class="u-p-sm u-cur-pointer" 
                   u-p-xxs="sm">
                pause
            </label>
        </li>
        <li class="u-bl-thin-solid-primary u-pl-sm u-ml-sm">
            <label for="cmd-alternate" 
                   class="u-p-sm u-cur-pointer" 
                   u-p-xxs="sm">
                alternate
            </label>
            <label for="cmd-normal" 
                   class="u-p-sm u-cur-pointer" 
                   u-p-xxs="sm">
                normal
            </label>
            <label for="cmd-reverse" 
                   class="u-p-sm u-cur-pointer" 
                   u-p-xxs="sm">
                reverse
            </label>
            <label for="cmd-alternate-reverse" 
                   class="u-p-sm u-cur-pointer" 
                   u-p-xxs="sm">
                alternate-reverse
            </label>
        </li>
    </ul>
</nav>
              
            
!

CSS

              
                // ANIMATION BUILDER
$video_frames: (
    // ID of the scene
    the_scene: (
        // Amount of frames
        amount: 88,
        // Aspect ratio
        aspect_ratio: 2,
        // Animation duration
        duration: 3s,
        // Animation direction (normal, alternate, reverse, etc)
        direction: normal,
        // URL start mask
        url_start: "https://olivier3lanc.github.io/cinematics-resources/wormhole_c/wormhole_c_",
        // URL end mask
        url_end: ".webp"
    )
);

body {
    background-color: black;
}
// COMMON PROPERTIES FOR ANIMATION
.scene {
    position: fixed;
    display: flex;
    min-height: 100%;
    min-width: 100%;
    overflow: hidden;
    top: 50%;
    left: 50%;
    background-color: black;
    transform: translateX(-50%) translateY(-50%);
    // ANIMATION CONTAINER
    &::after {
        content: "";
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translateX(-50%) translateY(-50%);
        width: 111.5%;
        height: 111.5%;
        transition: none;
        animation-timing-function: step-start;
        animation-iteration-count: infinite;
        background-size: 90%;
        background-repeat: no-repeat;
    }
}
// TITLE
@keyframes specialLetter {
    100% {
        transform: rotateY(180deg);
    }
}
#special-letter {
    perspective: 1em;
    & > span {
        animation: specialLetter 3s 3s infinite alternate;
    }
}

// COMMANDS
#cmd-play {
    &:checked {
        ~ figure {
            &::after {
                animation-play-state: running;
            }
        }
        ~ nav {
            [for="cmd-play"] {
                color: var(--cin-color-primary);
            }
        }
    }
}
#cmd-pause {
    &:checked {
        ~ figure {
            &::after {
                animation-play-state: paused;
            }
        }
        ~ nav {
            [for="cmd-pause"] {
                color: var(--cin-color-primary);
            }
        }
    }
}
#cmd-normal {
    &:checked {
        ~ figure {
            &::after {
                animation-direction: normal;
            }
        }
        ~ nav {
            [for="cmd-normal"] {
                color: var(--cin-color-primary);
            }
        }
    }
}
#cmd-reverse {
    &:checked {
        ~ figure {
            &::after {
                animation-direction: reverse;
            }
        }
        ~ nav {
            [for="cmd-reverse"] {
                color: var(--cin-color-primary);
            }
        }
    }
}
#cmd-alternate {
    &:checked {
        ~ figure {
            &::after {
                animation-direction: alternate;
            }
        }
        ~ nav {
            [for="cmd-alternate"] {
                color: var(--cin-color-primary);
            }
        }
    }
}
#cmd-alternate-reverse {
    &:checked {
        ~ figure {
            &::after {
                animation-direction: alternate-reverse;
            }
        }
        ~ nav {
            [for="cmd-alternate-reverse"] {
                color: var(--cin-color-primary);
            }
        }
    }
}

// Function that set up multiple background-image property
@function backgroundImage($url_start, $url_end, $total) {
    $bg_image_value: "";
    @for $i from 1 through $total {
        $separator: ", ";
        @if $i == 1 {
            $separator: "";
        }
        $bg_image_value: $bg_image_value +
            $separator +
            url($url_start + $i + $url_end);
    }
    @return unquote($bg_image_value);
}

// Function that set up multiple background-position property
@function backgroundPosition($iteration, $total) {
    $current_frame_value: "";
    $bg_size_value: $current_frame_value;
    @for $i from 1 through $total {
        @if $i == $iteration {
            $current_frame_value: 50%;
        } @else {
            $current_frame_value: -1000%;
        }
        $separator: ",";
        @if $i == 1 {
            $separator: "";
        }
        $bg_size_value: $bg_size_value + $separator + $current_frame_value;
    }
    @return unquote($bg_size_value);
}

// CSS DECLARATION OF EACH ANIMATION
@each $anim_id, $anim_data in $video_frames {
    $amount_of_frames: map-get($anim_data, amount);
    // CREATE KEYFRAMES
    @keyframes #{$anim_id} {
        @for $i from 1 through $amount_of_frames {
            #{$i*100/$amount_of_frames + unquote('%')} {
                background-position: backgroundPosition($i, $amount_of_frames);
            }
        }
    }
    // CREATE ANIMATION
    ##{$anim_id} {
        // PLAYER CONTAINER
        aspect-ratio: map-get($anim_data, aspect_ratio);
        // ANIMATION CONTAINER
        &::after {
            content: "";
            animation-name: $anim_id;
            animation-duration: map-get($anim_data, duration);
            animation-direction: map-get($anim_data, direction);
            background-image: backgroundImage(
                map-get($anim_data, url_start),
                map-get($anim_data, url_end),
                map-get($anim_data, amount)
            );
        }
    }
}
              
            
!

JS

              
                
              
            
!
999px

Console