css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div id="wrapper">
	<div id="svg-wrapper">
		<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 500">
			<path id="water-back" fill="#005AB3" d="M650 433c-27.61 0-43.25 3.71-50 5.09s-22.39 5.09-50 5.09-43.25-3.71-50-5.09-22.39-5.09-50-5.09-43.25 3.71-50 5.09-22.39 5.09-50 5.09-43.25-3.71-50-5.09-22.39-5.09-50-5.09-43.25 3.71-50 5.09-22.39 5.09-50 5.09-43.25-3.71-50-5.09S77.61 433 50 433s-43.25 3.71-50 5.09-22.39 5.09-50 5.09-43.25-3.71-50-5.09-22.39-5.09-50-5.09v80h799.75l.25-80z"/>

			<path id="x-1" fill="none" stroke="#D32F5A" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="10" d="M229.5 270.38l41-40.76"/>
			<path id="x-2" fill="none" stroke="#D32F5A" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="10" d="M270.5 270.38l-41-40.76"/>
			<path id="check" fill="none" stroke="#00BF73" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="10" d="M220 252.25l18.5 18.5 41.5-41.5"/>
			<path id="progress-bg" fill="none" stroke="#B2DAF6" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="10" d="M49 249h400"/>
			<path id="progress" fill="none" stroke="#00BF73" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="10" d="M49 249h400"/>

			<g id="guy">
				<path fill="none" d="M0-500h500V500H0z"/>
				<g id="guy-back">
					<g>
						<path fill="none" stroke="#CDB59E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="10" d="M252 136l1 13"/>
						<path fill="#9B744D" d="M260.26 150.87l1.77 47.98c.06 1.74-.54 3.34-1.58 4.57l-.4.47-28.93 34.01c-3.55 4.18-9.82 4.68-14 1.13s-4.68-9.82-1.13-14c.27-.32.6-.65.89-.92l33.07-29.99-1.98 5.04-.23-48.02c-.02-3.46 2.77-6.28 6.23-6.29 3.39-.03 6.16 2.66 6.29 6.02z"/>
						<circle cx="252" cy="136" r="7" fill="#CDB59E"/>
					</g>
					<g class="leg-back">
						<rect x="155" y="279" fill="none" width="150" height="136"/>
						<path fill="#4D2D0F" d="M240.52 284.47l-4.61 51.87c-.53 5.93-5.76 10.3-11.68 9.78-5.26-.47-9.31-4.65-9.77-9.74l-4.81-51.86c-.79-8.53 5.48-16.08 14.01-16.87 8.53-.79 16.08 5.48 16.87 14.01.07.92.06 1.92-.01 2.81z"/>	
						<g class="leg-lower">
							<path fill="none" stroke="#CDB59E" stroke-miterlimit="10" stroke-width="10" d="M225.76 380.75l-1.28 14.76"/>
							<path fill="#4D2D0F" d="M215.74 379.76l-1.05-43.85c-.14-5.81 4.46-10.63 10.27-10.77 5.81-.14 10.63 4.46 10.77 10.27.01.45-.01.96-.06 1.4l-4.8 43.6c-.46 4.16-4.21 7.17-8.37 6.71-3.83-.42-6.68-3.62-6.76-7.36z"/>
							<path fill="#4D2D0F" d="M215.31 379.74l2.58-43.69.43-7.28 14.34.61-.2 7.29-1.17 43.76-.21 8-16.24-.7z"/>
							<path fill="#38210B" d="M214.81 401.28l1.54-7.46c.25-1.2 1.42-1.97 2.61-1.72l17.1 3.53c5.58 1.15 9.17 6.61 8.02 12.2-.3 1.45-1.72 2.38-3.16 2.08l-23.65-4.88c-1.71-.36-2.82-2.03-2.46-3.75z"/>
							<path fill="#251607" d="M214.77 401.45l29.38 6.07-.06.3c-.3 1.46-1.73 2.39-3.18 2.09l-23.8-4.92c-1.63-.33-2.67-1.92-2.34-3.54z"/>
						</g>
					</g>
					<path fill="#603813" d="M227.5 304c-11.32 0-20.5-9.18-20.5-20.5V279h41v4.5c0 11.32-9.18 20.5-20.5 20.5z"/>
					<linearGradient id="neck-grad" x1="223" x2="223" y1="212.8446" y2="199.9995" gradientUnits="userSpaceOnUse">
						<stop offset="0" stop-color="#cdb59e"/>
						<stop offset="1" stop-color="#bfa993"/>
					</linearGradient>
					<path fill="url(#neck-grad)" d="M214 202h18v20h-18z"/>
				</g>	
				
				<line id="rope-top" fill="none" stroke="#3D2105" stroke-width="5" stroke-miterlimit="10" x1="250" y1="0" x2="250" y2="100.8"/>
				
				<g id="guy-front">
					<line fill="none" stroke="#3D2105" stroke-width="5" stroke-miterlimit="10" x1="250" y1="100.8" x2="250" y2="342"/>
					<g>
						<path fill="#CDB59E" d="M234.41 207h-19.67c-2.62 0-4.74-2.12-4.74-4.74V187c0-8.28 6.72-15 15-15 8.28 0 15 6.72 15 15v14.41c0 3.09-2.5 5.59-5.59 5.59z"/>
						<path fill="#BFA993" d="M210 187h30v3h-30z"/>
						<path fill="#603813" d="M250.5 185h-51c-.55 0-1 .45-1 1s.45 1 1 1h51c.55 0 1-.45 1-1s-.45-1-1-1z"/>
						<path fill="#603813" d="M241 186h-32v-5.79c0-6.75 5.47-12.21 12.21-12.21h7.57c6.75 0 12.21 5.47 12.21 12.21V186z"/>
						<path fill="#5A3412" d="M232.56 178h-15.12c-1.07 0-1.94-.87-1.94-1.94 0-3.35 2.71-6.06 6.06-6.06h6.88c3.35 0 6.06 2.71 6.06 6.06 0 1.07-.87 1.94-1.94 1.94z"/>
						<path fill="#5A3412" d="M209 182h32v3h-32z"/>
					</g>
					<g class="leg-front">
						<rect x="155" y="279" fill="none" width="150" height="136"/>
						<path fill="#603813" d="M244.95 290.9l-4.41 51.89c-.5 5.93-5.72 10.33-11.65 9.82-5.27-.45-9.32-4.62-9.81-9.7l-5.01-51.84c-.82-8.52 5.42-16.1 13.94-16.92 8.52-.82 16.1 5.42 16.92 13.94.09.92.09 1.91.02 2.81z"/>	
						<g class="leg-lower">
							<path fill="none" stroke="#CDB59E" stroke-miterlimit="10" stroke-width="10" d="M231.44 388.31l-.47 14.22"/>
							<path fill="#603813" d="M221.7 386.88l-2.39-44.63c-.31-5.8 4.14-10.76 9.95-11.07 5.8-.31 10.76 4.14 11.07 9.95.02.45.01.95-.02 1.38l-3.47 44.56c-.33 4.18-3.98 7.3-8.15 6.97-3.84-.3-6.79-3.41-6.99-7.16z"/>
							<path fill="#603813" d="M221.27 386.88l1.26-44.59.2-7.29 14.35.18.03 7.29.16 44.6.03 8-16.25-.2z"/>
							<path fill="#46290E" d="M223.03 409.59l.55-7.59c.09-1.22 1.15-2.13 2.37-2.05l17.42 1.27c5.69.42 9.96 5.36 9.54 11.05-.11 1.47-1.39 2.58-2.87 2.48l-24.08-1.76c-1.74-.13-3.05-1.65-2.93-3.4z"/>
							<path fill="#2D1A09" d="M223.02 409.76l29.92 2.19-.02.3c-.11 1.48-1.4 2.6-2.88 2.49l-24.24-1.77c-1.66-.12-2.9-1.55-2.78-3.21z"/>
						</g>
					</g>
					<path fill="#A67C52" d="M248 279h-41v-51.4c0-8.62 6.98-15.6 15.6-15.6 14.03 0 25.4 11.37 25.4 25.4V279z"/>
					<g>
						<path fill="none" stroke="#CDB59E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="10" d="M251 171l6 13"/>
						<path fill="#AC845D" d="M262.6 181.2l18.69 35.66c1.77 3.38.47 7.54-2.91 9.31-.3.16-.62.29-.93.4l-.63.21-40.25 13.79c-5.19 1.78-10.84-.99-12.62-6.18-1.78-5.19.99-10.84 6.18-12.62.41-.14.88-.26 1.3-.35l41.75-8.21-4.47 9.93-17.31-36.34c-1.49-3.12-.16-6.86 2.96-8.35 3.05-1.45 6.68-.21 8.24 2.75z"/>
						<circle cx="251" cy="171" r="7" fill="#CDB59E"/>
					</g>
					<path fill="#CDB59E" d="M253.5 142c3.59 0 6.5-2.91 6.5-6.5s-2.91-6.5-6.5-6.5c-1.93 0-3.5 1.57-3.5 3.5v6c0 1.93 1.57 3.5 3.5 3.5z"/>
				</g>
			</g>

			<g id="gator">
				<path fill="#00A664" d="M-33 446c0-23.2 37.16-42 83-42s83 18.8 83 42"/>
				<g>
					<path fill="#FFF" d="M188.67 449l-8.34 8H197z"/>
					<path fill="#FFF" d="M205.33 449l-8.33 8h16.67z"/>
					<path fill="#FFF" d="M222 449l-8.33 8h16.66z"/>
					<path fill="#FFF" d="M238.67 449l-8.34 8H247z"/>
					<path fill="#FFF" d="M255.33 449l-8.33 8h16.67z"/>
					<path fill="#FFF" d="M272 449l-8.33 8h16.66z"/>
				</g>
				<g id="gator-mouth">
					<g>
						<path fill="#FFF" d="M180.33 465.17l-8.33-8h16.67z"/>
						<path fill="#FFF" d="M197 465.17l-8.33-8h16.66z"/>
						<path fill="#FFF" d="M213.67 465.17l-8.34-8H222z"/>
						<path fill="#FFF" d="M230.33 465.17l-8.33-8h16.67z"/>
						<path fill="#FFF" d="M247 465.17l-8.33-8h16.66z"/>
						<path fill="#FFF" d="M263.67 465.17l-8.34-8H272z"/>
						<path fill="#FFF" d="M280.33 465.17l-8.33-8h16.67z"/>
					</g>
					<ellipse cx="270.45" cy="429.58" fill="#008F57" rx="8.75" ry="8.75" transform="rotate(-49.684 270.4479 429.5785)"/>
					<path fill="#00A664" d="M293 457.17H172v-28h107c9.94 0 18 8.06 18 18v6c0 2.21-1.79 4-4 4z"/>
					<ellipse cx="276.17" cy="429.17" fill="#00A664" rx="9.17" ry="9.17" transform="rotate(-49.684 276.1671 429.1614)"/>
					<circle cx="278.25" cy="428.75" r="4.58" fill="#007B4A"/>
				</g>
				<g>
					<path fill="#00A664" d="M282 477H172v-20h116c1.66 0 3 1.34 3 3v8c0 4.97-4.03 9-9 9z"/>
					<path fill="#008F57" d="M291 462H172v-5h116c1.66 0 3 1.34 3 3v2z"/>
				</g>
				<path fill="#00A664" d="M-33 415h208v62H-33z"/>
				<circle cx="174.5" cy="428.17" r="16.67" fill="#00A664"/>
				<circle cx="174.5" cy="428.17" r="7.5" fill="#FFF"/>
				<circle cx="174.5" cy="428.17" r="5" fill="#4D4D4D"/>
				<path fill="#00A664" d="M165.33 426.5c0-5.06 4.1-9.17 9.17-9.17s9.17 4.1 9.17 9.17"/>
			</g>
			<path id="water-front" fill="#0068CF" d="M750 461c-27.61 0-43.25 3.33-50 4.57-6.75 1.24-22.39 4.57-50 4.57s-43.25-3.33-50-4.57c-6.75-1.24-22.39-4.57-50-4.57s-43.25 3.33-50 4.57c-6.75 1.24-22.39 4.57-50 4.57s-43.25-3.33-50-4.57c-6.75-1.24-22.39-4.57-50-4.57s-43.25 3.33-50 4.57c-6.75 1.24-22.39 4.57-50 4.57s-43.25-3.33-50-4.57c-6.75-1.24-22.39-4.57-50-4.57s-43.25 3.33-50 4.57c-6.75 1.24-22.39 4.57-50 4.57s-43.25-3.33-50-4.57c-6.75-1.24-22.39-4.57-50-4.57v60h799.75l.25-60z"/>
		</svg>
	</div>
</div>
            
          
!
            
              html {width: 100%; height: 100%;}
body {
	width: 100%; height: 100%;
	display: flex; flex-flow: row nowrap; justify-content: center; align-items: center;
}
#wrapper {
	width: 300px; height: 300px; 
	box-sizing: border-box; position: relative;
	overflow: visible;
	#svg-wrapper {
		width: 100%; height: 100%;
		position: absolute; top: 0; left: 0;
		background-color: #dfecf8; border-radius: 50%;
		overflow: hidden;
	}
}
            
          
!
            
              var
	waterFront = document.getElementById('water-front'), waterBack = document.getElementById('water-back'),
    	gator = document.getElementById('gator'), gatorMouth = document.getElementById('gator-mouth'),
    	guy = document.getElementById('guy'), legFront = document.querySelector('#guy .leg-front'), legFrontLower = document.querySelector('#guy .leg-front .leg-lower'), legBack = document.querySelector('#guy .leg-back'), legBackLower = document.querySelector('#guy .leg-back .leg-lower'),
	guyFront = document.getElementById('guy-front'), guyBack = document.getElementById('guy-back'),
    	ropeTop = document.getElementById('rope-top'),
    	progress = document.getElementById('progress'), progressBG = document.getElementById('progress-bg'),
    	check = document.getElementById('check'), x1 = document.getElementById('x-1'), x2 = document.getElementById('x-2'),
    	waterFrontTL, waterBackTL, guyTL, successTL, errorTL, masterTL
;

function initLoader() {
	resetLoader();
	
	waterFrontTL = new TimelineMax({paused: true, repeat: -1});
	waterFrontTL
		.to(waterFront, 3, {x: -200, ease: Linear.easeNone})
	;
	waterFrontTL.play();
				   
	waterBackTL = new TimelineMax({paused: true, repeat: -1});
	waterBackTL
		.to(waterBack, 5, {x: -200, ease: Linear.easeNone})
	;
	waterBackTL.play();
	
	guyTL = new TimelineMax({paused: true, repeat: 0, yoyo: true});
	guyTL
		.to(guy, 1, {x: 120, y: 0, rotation: -55, ease: Linear.easeNone}, "0")
		.to(legFront, 1, {x: 0, rotation: 45, ease: Linear.easeNone}, "0")
		.to(legFrontLower, 1, {rotation: 85, ease: Linear.easeNone, transformOrigin: "12px 11px"}, "0")
		.to(legBack, 1, {x: 0, rotation: -105, ease: Linear.easeNone}, "0")
		.to(legBackLower, 1, {rotation: -5, ease: Linear.easeNone, transformOrigin: "12px 11px"}, "0")
	;
	guyTL.timeScale(.25);
	
	successTL = new TimelineMax({paused: false, delay: 1, repeat: 0, repeatDelay: 2});
	successTL
		.to(gator, .5, {y: -5, ease: Power1.easeOut}, "0")
		.to(gator, .5, {y: 0, ease: Power2.easeInOut}, ".5")
		.to(gatorMouth, .35, {rotation: -45, transformOrigin: "0% 82%", ease: Power2.easeInOut}, "1")
	
		.to(progressBG, .5, {drawSVG: "0% 50%", ease: Quad.easeIn}, "0") 
		.to(progressBG, .7, {drawSVG: "0% 100%", ease: Quad.easeOut}, ".5")
	
		.to(progress, 4, {drawSVG: "0% 100%", ease: Linear.easeNone}, "2")
	
		.to(guyTL, 4, {progress: 1, ease: Linear.easeNone}, "2")
	
		.to(gatorMouth, .35, {rotation: 0, ease: Power2.easeInOut}, "6.25")
		.to(gator, .5, {y: 75, ease: Power1.easeOut}, "6.6")
	
		.to([progress, progressBG], .5, {drawSVG: "100% 100%", ease: Power2.easeInOut}, "6.5")
		.set([progress, progressBG], {drawSVG: "0% 0%", autoAlpha: 0}, "7") 
		.to(check, 1, {drawSVG: "0% 100%", ease: Power2.easeInOut}, "7")

		.to(check, .5, {drawSVG: "0% 0%", ease: Power2.easeIn}, "9")
	
		.addCallback(function() {
			guyTL.progress(0);
			resetLoader();
		}, "9.5")
	;
	
	errorTL = new TimelineMax({paused: false, delay: 1, repeat: 0, repeatDelay: 2});
	errorTL
		.to(gator, .5, {y: -5, ease: Power1.easeOut}, "0")
		.to(gator, .5, {y: 0, ease: Power2.easeInOut}, ".5")
		.to(gatorMouth, .35, {rotation: -45, transformOrigin: "0% 82%", ease: Power2.easeInOut}, "1")

		.to(progressBG, .5, {drawSVG: "0% 50%", ease: Quad.easeIn}, "0") 
		.to(progressBG, .7, {drawSVG: "0% 100%", ease: Quad.easeOut}, ".5")

		.to(progress, 2.6, {drawSVG: "0% 65%", ease: Linear.easeNone}, "2")

		.to(guyTL, 2.6, {progress: .65, ease: Linear.easeNone}, "2")
		.to(legFront, 1, {x: -2, rotation: 0, ease: Linear.easeNone}, "5.5")
		.to(legFrontLower, 1, {rotation: 0, ease: Linear.easeNone}, "5.5")
		.to(legBack, 1, {x: 2, rotation: -5, ease: Linear.easeNone}, "5.5")
		.to(legBackLower, 1, {rotation: -5, ease: Linear.easeNone}, "5.5") 
		.to(ropeTop, .25, {y: -100}, "6")
		
		.to(progress, .3, {stroke: "#d32f5a"}, "5")
		.to([progress, progressBG], .5, {drawSVG: "0% 0%", ease: Power2.easeInOut}, "5.5")
		.to(guyTL, .25, {progress: .5}, "5.5")
		.to([guyFront, guyBack], .5, {y: 380, ease: Linear.easeNone}, "5.75")
	
		.to(gatorMouth, .35, {rotation: 0, ease: Power2.easeInOut}, "6.25")
		.to(gator, .5, {y: 75, ease: Power1.easeOut}, "6.95")
	
		.to([x1,x2], .5, {drawSVG: "0% 100%", ease: Power2.easeInOut}, "5.75")

		.to([x1,x2], .5, {drawSVG: "0% 0%", ease: Power2.easeInOut}, "8")
	
		.addCallback(function() {
			guyTL.progress(0);
			resetLoader();
		}, "9.5")
	;
	
	masterTL = new TimelineMax({paused: true, repeat: -1, repeatDelay: 1});
	masterTL
		.add(successTL)
		.add(errorTL)
	;
	masterTL.play();
}

function resetLoader() {console.log("resetLoader")
	TweenMax.set(gator, {y: 75, x: 550, scaleX: -1});
	TweenMax.set(legFront, {x: 0, transformOrigin: "center 16px", rotation: -85});
	TweenMax.set(legFrontLower, {rotation: 15, transformOrigin: "12px 11px"});
	TweenMax.set(legBack, {x: 0, transformOrigin: "center 17px", rotation: 50});
	TweenMax.set(legBackLower, {rotation: 65, transformOrigin: "12px 11px"});
	TweenMax.set([progress, progressBG], {drawSVG: "0% 0%", autoAlpha: 1});
	TweenMax.set(progress, {stroke: "#00BF73"});
	TweenMax.set([check, x1, x2], {drawSVG: "0% 0%"});
	TweenMax.set([guyFront, guyBack], {y: 0});
	TweenMax.set(ropeTop, {y: 0});
	TweenMax.set(guy, {rotation: 55, x: -120, y: 0, /*svgOrigin: "250px 0"*/ transformOrigin: "250px 500px"});
}

console.clear();
initLoader();
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console