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

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

              
                <div id="animation"></div> 

<div class="spinner-wrapper">
        <div class="spinner"></div>
</div>
              
            
!

CSS

              
                    #animation {
     width: 100vw;
     height: 90vh;
     padding-top: 4%;
    }

.spinner {
    width: 60px;
    height: 60px;
    background: #fff no-repeat center center;

    position: absolute;
    top: 45%;
    left: 45%;
    /* -webkit-animation: sk-rotateplane 1.2s infinite ease-in-out; */
    /* animation: sk-rotateplane 1.2s infinite ease-in-out; */
  }


.spinner-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #000000;
    z-index: 999999;
    }
              
            
!

JS

              
                

let animation = lottie.loadAnimation({
  container: document.querySelector("#animation"),
  renderer: "svg",
  loop: false,
  autoplay: false,
  path: "https://assets3.lottiefiles.com/packages/lf20_8lwqxf4a.json"
});

animation.addEventListener("DOMLoaded", () => {
  $('.spinner-wrapper').fadeOut('fast');
});


// gsap.registerPlugin(ScrollTrigger)

// LottieScrollTrigger({
//     target: "#animation",
//     path: "https://assets3.lottiefiles.com/packages/lf20_8lwqxf4a.json",
//     speed: "slow",
//     scrub: 2, // seconds it takes for the playhead to "catch up"
//     // you can also add ANY ScrollTrigger values here too, like trigger, start, end, onEnter, onLeave, onUpdate, etc. See https://greensock.com/docs/v3/Plugins/ScrollTrigger
//   onLoad() {
//     $('.spinner-wrapper').fadeOut('fast');
//   }
// });

//    function LottieScrollTrigger(vars) {
// 	let playhead = {frame: 0},
// 		target = gsap.utils.toArray(vars.target)[0],
// 		speeds = {slow: "+=3000", medium: "+=1000", fast: "+=500"},
// 		st = {trigger: target, pin: true, start: "top top", end: speeds[vars.speed] || "+=1000", scrub: 1},
// 		animation = lottie.loadAnimation({
// 			container: target,
// 			renderer: vars.renderer || "svg",
// 			loop: false,
// 			autoplay: false,
// 			path: vars.path
// 		});
// 	for (let p in vars) { // let users override the ScrollTrigger defaults
// 		st[p] = vars[p];
// 	}
// 	animation.addEventListener("DOMLoaded", function() {
// 		gsap.to(playhead, {
// 			frame: animation.totalFrames - 1,
// 			ease: "none",
// 			onUpdate: () => animation.goToAndStop(playhead.frame, true),
// 			scrollTrigger: st
// 		});
//     // in case there are any other ScrollTriggers on the page and the loading of this Lottie asset caused layout changes
//     ScrollTrigger.sort();
//     ScrollTrigger.refresh(); 
    
//     vars.onLoad && vars.onLoad();
// 	});
//   return animation;
// }

// // https://greensock.com/docs/v3/HelperFunctions#lottie

// $(window).load(function() {
//         // $('.spinner-wrapper').fadeOut('fast');
// });
              
            
!
999px

Console