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

              
                <link href="https://fonts.googleapis.com/css?family=Droid+Sans+Mono" rel="stylesheet">
<link rel="prefetch" href="http://www.iconsdb.com/icons/preview/white/check-mark-xxl.png">
<link rel="prefetch" href="http://www.iconsdb.com/icons/preview/white/x-mark-xxl.png">

<div class="abs-center container">
    <div class="abs-center front">
        <svg viewbox="0 0 80 80" class="abs-center rad-progress">
            <circle class="progress-background" cx="40" cy="40" r="35" />
            <circle class="progress-bar" cx="40" cy="40" r="35" stroke-dasharray="220" stroke-dashoffset="-220" />
            <div class="abs-center progress-label">0%</div>
        </svg>
    </div>
    <div class="abs-center back">
        <svg viewbox="0 0 80 80" class="abs-center alt-state">
            <circle class="icon-background" cx="40" cy="40" r="35" fill="#21cd92" stroke="#21cd92" stroke-width="8" />
            <div class="abs-center icon check"></div>
            <div class="abs-center icon error"></div>
        </svg>
    </div>
</div>
              
            
!

CSS

              
                * { box-sizing: border-box; transition: 0.5s cubic-bezier(0.5,0,0.2,1) }
.abs-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) }
    
.container 
    width 80px
    height @width
    perspective 5000px
    transform-style preserve-3d
    &.flipped { transform: translate(-50%, -50%) rotateY(180deg); }
    &.complete 
        & .icon-background { fill: #21cd92; stroke: #21cd92; }
        & .error { opacity: 0; transition: 0.3s ease }
    &.error
        & .icon-background { fill: #f44336; stroke: #f44336; }
        & .check { opacity: 0; transition: 0.3s ease }

.front, .back { backface-visibility: hidden; }    
.front { z-index: 2; transform: rotateY(0deg); }
.back { transform: rotateY(180deg) }
    
.rad-progress, .alt-state
    height 80px
    width @height
    border-radius 100%
    
.rad-progress {transform: translate(-50%, -50%) rotateZ(-90deg)}
.progress-background { stroke: rgba(0,0,0,0.08); stroke-width: 8; fill: none }
.progress-bar { stroke: #2195cd; stroke-width: 8; fill: none; }
.progress-label { font-family: 'Droid Sans Mono'; font-size: 14px}
    
.icon
    height 30px
    width @height
    transition 0.3s 0.3s ease
    &.check { background: url('https://skytango.com/wp-content/uploads/2016/11/White-Checkmark-icon.png') center no-repeat; background-size: 130%; }
    &.error { background: url('http://aspiredm.com/wp-content/themes/Aspire2016/library/images/menu-cross.png') center no-repeat; background-size: 90%; }
    /*
    background-size cover !important
    &.check { background: url('http://www.iconsdb.com/icons/preview/white/check-mark-xxl.png') center no-repeat }
    &.error { background: url('http://www.iconsdb.com/icons/preview/white/x-mark-xxl.png') center no-repeat }
    */
              
            
!

JS

              
                // https://uimovement.com/ui/3192/crospots-search/
function update_progress(pct) {
    if(!isNaN(pct)) {
        if(pct > 100) {pct = 100}; // Too High
        if(pct < 0) {pct = 0};     // Too Low
        var offset = (( -parseFloat(pct) /100) * 220) - 220; // Getting offset for the SVG
    
        $('.progress-bar').attr('stroke-dashoffset',offset);
        $('.progress-label').text(Number(Math.round(pct+'e2')+'e-2')+'%'); // Rounds to two decimal places
    };
    
    // Check for finish
    (pct === 100)?( complete() ):( incomplete() );
};

// Complete and Error States
function complete() { $('.container').addClass('flipped complete').removeClass('error'); };
function incomplete() { $('.container').removeClass('flipped complete'); };
function error() { $('.container').addClass('flipped error').removeClass('complete');  };
function no_error() { $('.container').removeClass('flipped error'); };

// For testing
function test() {
    $('.progress-bar').css('transition', '0.12s ease');
    for(var i = 0; i <= 100; i++) { timer_thing(i); };
    setTimeout(function(){ $('.progress-bar').css('transition', '0.4s cubic-bezier(0.5,0,0.2,1)'); }, 10100);
};
function timer_thing(i) { setTimeout(function(){ update_progress(i) }, (100 * i)); };

test();
              
            
!
999px

Console