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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <svg height="320" width="320" class="like" onclick="document.body.classList.toggle('liked')">
  <path class="path" d="M 160 145 c 15 -90 170 -20 0 90 m 0 -90 c -15 -90 -170 -20 0 90" fill="white"/> <!-- 80 by 70 -->
</svg>

<!-- DECORATIONS (quite a lot of them) -->
<div class="dot dot-1"></div>
<div class="dot dot-2"></div>
<div class="dot dot-3"></div>
<div class="dot dot-4"></div>
<div class="dot dot-5"></div>
<div class="dot dot-6"></div>
<div class="dot dot-7"></div>
<div class="dot dot-8"></div>

<svg height="40" width="40" viewBox="0 0 320 320" class="h h-1"><path class="path" d="M 160 145 c 15 -90 170 -20 0 90 m 0 -90 c -15 -90 -170 -20 0 90"/></svg>
<svg height="40" width="40" viewBox="0 0 320 320" class="h h-2"><path class="path" d="M 160 145 c 15 -90 170 -20 0 90 m 0 -90 c -15 -90 -170 -20 0 90"/></svg>
<svg height="40" width="40" viewBox="0 0 320 320" class="h h-3"><path class="path" d="M 160 145 c 15 -90 170 -20 0 90 m 0 -90 c -15 -90 -170 -20 0 90"/></svg>
<svg height="40" width="40" viewBox="0 0 320 320" class="h h-4"><path class="path" d="M 160 145 c 15 -90 170 -20 0 90 m 0 -90 c -15 -90 -170 -20 0 90"/></svg>

<svg height="40" width="40" viewBox="0 0 320 320" class="h h-5"><path class="path" d="M 160 145 c 15 -90 170 -20 0 90 m 0 -90 c -15 -90 -170 -20 0 90"/></svg>
<svg height="40" width="40" viewBox="0 0 320 320" class="h h-6"><path class="path" d="M 160 145 c 15 -90 170 -20 0 90 m 0 -90 c -15 -90 -170 -20 0 90"/></svg>
<svg height="40" width="40" viewBox="0 0 320 320" class="h h-7"><path class="path" d="M 160 145 c 15 -90 170 -20 0 90 m 0 -90 c -15 -90 -170 -20 0 90"/></svg>
<svg height="40" width="40" viewBox="0 0 320 320" class="h h-8"><path class="path" d="M 160 145 c 15 -90 170 -20 0 90 m 0 -90 c -15 -90 -170 -20 0 90"/></svg>

<svg height="110" width="110" viewBox="0 0 320 320" class="fly fly-1"><path class="path" d="M 160 145 c 15 -90 170 -20 0 90 m 0 -90 c -15 -90 -170 -20 0 90"/></svg>
<svg height="110" width="110" viewBox="0 0 320 320" class="fly fly-2"><path class="path" d="M 160 145 c 15 -90 170 -20 0 90 m 0 -90 c -15 -90 -170 -20 0 90"/></svg>
              
            
!

CSS

              
                * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    position: relative;
}

svg.like {
    position: fixed;
    z-index: 10;
    top: calc(50vh - 160px);
    left: calc(50vw - 160px);
    border-radius: 100%;
    transform: scale(0.3);
    transform-origin: 50% 50%;
    box-shadow: 0 0 250px rgba(0, 0, 0, 0.4);
    background: #212121;
    cursor: pointer;
}

svg.fly {
    position: fixed;
    top: calc(50vh - 55px);
    left: calc(50vw - 55px);
    fill: #18FFFF;
}

svg.h {
    position: fixed;
    z-index: 8;
    top: calc(50vh - 20px);
    left: calc(50vw - 20px);
    fill: #fbff00;

    &.h-5,
    &.h-6,
    &.h-7,
    &.h-8 {
        fill: #00ffb8;
    }
}

div.dot {
    width: 12px;
    height: 12px;
    background: white;
    position: fixed;
    z-index: 9;
    border-radius: 100%;
    top: calc(50vh - 6px);
    left: calc(50vw - 6px);

    &:before {
        content: "";
        width: 8px;
        height: 8px;
        border-radius: 100%;
        top: -20px;
        left: 2px;
        position: absolute;
        background: white;
    }

    &:after{
        content: "";
        width: 11px;
        height: 11px;
        border-radius: 100%;
        top: -160px;
        left: 2px;
        position: absolute;
        background: white;
        display: none
    }
}

// ANIMATIONS

body {
    background-image: linear-gradient(-10deg, #7028e4 0%, #e5b2ca 100%);
    width: 100vw;
    height: 100vh;

    &.liked {
        svg.like {
            animation: blink 1s forwards;
        }

        svg.fly {
            &.fly-1 {
                animation: fly-1 1s 0.1s;
            }
            &.fly-2 {
                animation: fly-2 1s 0.1s;
            }
        }

        svg.h {
            transition: margin cubic-bezier(0.165, 0.84, 0.44, 1) 1.4s,
                transform 0.2s 1s, fill 0.2s 1s, opacity 0.2s 1.2s;
            opacity: 0;

            &.h-5,
            &.h-6,
            &.h-7,
            &.h-8 {
                transform: scale(1.5);
                fill: white;
            }

            &.h-1 {
                margin-top: -200px;
            }

            &.h-2 {
                margin-left: 200px;
            }

            &.h-3 {
                margin-top: 200px;
            }

            &.h-4 {
                margin-left: -200px;
            }

            &.h-5 {
                margin-top: -140px;
                margin-left: 140px;
            }

            &.h-6 {
                margin-top: 140px;
                margin-left: 140px;
            }

            &.h-7 {
                margin-top: -140px;
                margin-left: -140px;
            }

            &.h-8 {
                margin-top: 140px;
                margin-left: -140px;
            }
        }

        div.dot {
            opacity: 0;
            transform: translateY(-100px);
            background: #00e5ff;
            transition: transform 1s, opacity 0.5s 1s, background 0.1s 0.2s;
            
            &:after {
                display: block;
            }

            &.dot-2 {
                transform: rotate(45deg) translateY(-100px);
            }
            &.dot-3 {
                transform: rotate(90deg) translateY(-100px);
            }
            &.dot-4 {
                transform: rotate(135deg) translateY(-100px);
            }
            &.dot-5 {
                transform: rotate(180deg) translateY(-100px);
            }
            &.dot-6 {
                transform: rotate(225deg) translateY(-100px);
            }
            &.dot-7 {
                transform: rotate(270deg) translateY(-100px);
            }
            &.dot-8 {
                transform: rotate(305deg) translateY(-100px);
            }
        }
    }
}

@keyframes blink {
    10% {
        transform: scale(0.42);
        background: #8815b7;
    }
    100% {
        background: #e01f4f;
    }
}

@keyframes fly-1 {
    25% {
        margin: -100px 0 0 100px;
    }
    75% {
        margin: 100px 0 0 -100px;
        z-index: 5
    }
    100% {
        z-index: 11
    }
}

@keyframes fly-2 {
    25% {
        margin: -100px 0 0 -100px;
    }
    75% {
        margin: 100px 0 0 100px;
        z-index: 5
    }
    100% {
        z-index: 11
    }
}

              
            
!

JS

              
                document.body.onkeypress = function(){document.body.classList.toggle('liked')}
              
            
!
999px

Console