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.

            
              <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	 viewBox="0 0 800 600" enable-background="new 0 0 800 600" xml:space="preserve">
<rect x="0" y="0" fill="#FFB64E" width="800" height="600"/>
<line id="speedLine" fill="none" stroke="#FFFFFF" stroke-width="6" stroke-linecap="round" stroke-miterlimit="10" x1="400" y1="292" x2="400" y2="35"/>
<line id="speedLineDown" fill="none" stroke="#FFFFFF" stroke-width="6" stroke-linecap="round" stroke-miterlimit="10" x1="400" y1="35" x2="400" y2="292"/>
<g id="bottle">
	<path fill="#E79265" d="M440,410.923c0-4.38-0.867-8.718-2.553-12.769l-12.917-31.038c-3.074-7.387-4.656-15.295-4.656-23.281
		v-44.059h-39.245v44.146c0,8.24-1.684,16.396-4.951,23.979l-12.963,30.087c-1.792,4.159-2.715,8.632-2.715,13.151v120.638l0,0
		c0,11.046,17.909,20,40,20c22.091,0,39.999-8.954,40-20h0V410.923z"/>
	<path fill="#C66961" d="M399.761,299.776h20.113v44.059c0,7.986,1.582,15.895,4.656,23.281l12.917,31.038
		c1.686,4.051,2.553,8.389,2.553,12.769v120.854h0c0,11.046-18.147,19.988-40.238,19.988
		C399.762,551.765,399.761,299.196,399.761,299.776z"/>
	<path fill="#C66961" d="M415.29,298.53c0,3.45-6.89,6.624-15.4,6.624c-8.5,0-15.39-3.174-15.39-6.624c0-3.46,6.89-6.25,15.39-6.25
		C408.4,292.28,415.29,295.07,415.29,298.53z"/>
	<path fill="#C66961" d="M415.29,298.53c0,3.45-6.89,6.25-15.4,6.25c-8.5,0-15.39-2.8-15.39-6.25c0-3.46,6.89-6.25,15.39-6.25
		C408.4,292.28,415.29,295.07,415.29,298.53z"/>
	<path fill="#F3A35A" d="M400.25,290.24c-10.91,0-19.75,4.154-19.75,9.272s8.84,9.262,19.75,9.262S420,304.63,420,299.512
		S411.16,290.24,400.25,290.24z M399.89,305.154c-8.5,0-15.39-2.872-15.39-6.411c0-3.549,6.89-6.411,15.39-6.411
		c8.51,0,15.4,2.862,15.4,6.411C415.29,302.282,408.4,305.154,399.89,305.154z"/>
<g id="particleGroup"></g>  
 
	<g id="cork">
		<rect id="corkBodyLeft" x="384.36" y="284.133" fill="#FFE7B2" width="30.92" height="45.473"/>
		<rect id="corkBodyRight" x="399.748" y="284.133" fill="#FED69F" width="15.532" height="45.473"/>
		<g id="corkBun">
			<ellipse id="left" fill="#FFE7B2" cx="399.819" cy="329.606" rx="15.459" ry="4.966"/>
			<path id="right" fill="#FED69F" d="M399.748,334.572c8.577,0,15.53-2.223,15.53-4.966c0-2.743-6.953-4.966-15.53-4.966"/>
		</g>
		<ellipse id="corkTop" fill="#FFFFFF" cx="399.82" cy="284.291" rx="15.46" ry="7.463"/>
		<g id="eyes">
			<ellipse id="lEye" fill="#7E4343" cx="391.082" cy="303.043" rx="1.5" ry="1.5"/>
			<ellipse id="rEye" fill="#7E4343" cx="408.7" cy="303.059" rx="1.5" ry="1.5"/>
		</g>
	</g>
  <g id="smallParticleGroup"></g>  
	<g id="corkBottom">
		<path opacity="0.5" fill="#E79265" d="M399.748,335.771h-19.119c0,0-0.129-37.328-0.129-36.491
			c-0.123,1.918,2.318,9.032,19.248,9.491V335.771z"/>
		<path opacity="0.5" fill="#C66961" d="M419.874,335.771h-20.126v-27C419.973,308.55,420,299.28,420,299.28
			C420.002,302.317,419.874,335.771,419.874,335.771z"/>
	</g>
	<path opacity="0.5" fill="#F3A35A" d="M380.629,298.84c-0.579,6.795,11.127,9.931,19.119,9.931c7.905,0,20.908-2.565,20.185-10.241
		l-4.644,0.079c-0.176,4.194-7.608,6.545-15.399,6.545c-8.479,0-15.391-2.839-15.53-6.624L380.629,298.84z"/>
	<path opacity="0.5" fill="#F3A35A" d="M384.359,293.905c-2.414,1.495-3.859,3.338-3.859,5.332l3.859-0.707l0-2.312
		L384.359,293.905z M415.29,298.622l4.71,0.695c0-2.253-1.75-4.307-4.71-5.887L415.29,298.622z"/>
	<g id="rightArmGroup">
		<defs>
			<rect id="rArmMask" x="415.28" y="278.728" width="14.161" height="45.844"/>
		</defs>
		<clipPath id="rArmMask_1_">
			<use xlink:href="#rArmMask"  overflow="visible"/>
		</clipPath>
		
			<path id="rArmS1" clip-path="url(#rArmMask_1_)" fill="none" stroke="#A64452" stroke-width="2.0011" stroke-linecap="round" stroke-miterlimit="10" d="
			M415.055,292.45c0,0,9.725-13.854,2.35,8.669"/>
		<path id="rArmS2" clip-path="url(#rArmMask_1_)" fill="none" d="M415.055,292.45c0,0,9.725-9.854,2.35,12.669"/>
		<path id="rArmS3" clip-path="url(#rArmMask_1_)" fill="none" d="M415.055,292.45c0,0,9.725-5.853,2.35,16.669"/>
		<path id="rArmS4" clip-path="url(#rArmMask_1_)" fill="none" d="M415.055,292.45c0,0,9.725-5.853,2.35,16.669"/>
		<path id="rArmS5" clip-path="url(#rArmMask_1_)" fill="none" d="M415.055,292.45c0,0,9.725,6.147,2.35,28.67"/>
		<path id="rArmS6" clip-path="url(#rArmMask_1_)" fill="none" d="M417.412,313.119c0,0,14.424-6.346,6.569-26.363"/>
		<path id="rArmS7" clip-path="url(#rArmMask_1_)" fill="none" d="M417.412,313.119c5.747,0.146,17.39-15.489-2.132-14.869"/>
		<path id="rArmS8" clip-path="url(#rArmMask_1_)" fill="none" d="M415.29,302.311c5.26-7.906,5.374-16.12-0.561-3.915"/>
	</g>
	<g id="leftArmGroup">
		<defs>
			<rect id="lArmMask" x="370.215" y="278.728" width="14.145" height="45.844"/>
		</defs>
		<clipPath id="lArmMask_1_">
			<use xlink:href="#lArmMask"  overflow="visible"/>
		</clipPath>
		
			<path id="lArmS1" clip-path="url(#lArmMask_1_)" fill="none" stroke="#A64452" stroke-width="2" stroke-linecap="round" stroke-miterlimit="10" d="
			M385.342,292.806c0,0-10.069-13.25-2.473,8.459"/>
		<path id="lArmS2" clip-path="url(#lArmMask_1_)" fill="none" d="M385.342,292.806c0,0-10.069-9.25-2.473,12.459"/>
		<path id="lArmS3" clip-path="url(#lArmMask_1_)" fill="none" d="M385.342,292.806c0,0-10.069-5.249-2.473,16.459"/>
		<path id="lArmS4" clip-path="url(#lArmMask_1_)" fill="none" d="M385.342,292.806c0,0-10.069-4.249-2.473,17.459"/>
		<path id="lArmS5" clip-path="url(#lArmMask_1_)" fill="none" d="M385.342,292.806c0,0-10.069,6.751-2.473,28.46"/>
		<path id="lArmS6" clip-path="url(#lArmMask_1_)" fill="none" d="M382.868,313.24c0,0-14.368-6.467-6.562-26.363"/>
		<path id="lArmS7" clip-path="url(#lArmMask_1_)" fill="none" d="M382.878,313.266c-5.545,0-17.37-15.489,2.13-14.869"/>
		<path id="lArmS8" clip-path="url(#lArmMask_1_)" fill="none" d="M384.415,302.206c-5.26-7.906-5.374-16.12,0.561-3.915"/>
	</g>
	<path fill="#C33424" d="M399.748,334.572c-15.282-0.343-15.445-4.979-15.445-4.979l0.005,20.852c0,7.05-3.494,16.042-6.394,22.529
		L366.41,400.7c-1.59,3.558-2.41,7.385-2.41,11.252v116.815h35.751L399.748,334.572z"/>
	<ellipse fill="#BA2824" cx="399.5" cy="528.776" rx="35.5" ry="18.5"/>
	<path fill="#B82424" d="M399.748,334.572c15.561-0.317,15.56-4.969,15.56-4.969l-0.039,20.768c0,6.832,3.433,15.613,6.184,21.933
		l11.561,28.54c1.509,3.466,2.286,7.177,2.286,10.925v116.999h-35.55L399.748,334.572z"/>
	<path fill="#B21C24" d="M399.754,510.276c19.49,0,35.246,8.326,35.246,18.5c0,10.173-15.757,18.428-35.246,18.5
		C399.754,547.275,399.743,510.276,399.754,510.276z"/>
	<path opacity="0.6" fill="#C33424" d="M399.793,324.572c-8.54,0-15.463,2.239-15.463,5c0,2.761,6.923,5,15.463,5"/>
	<path opacity="0.6" fill="#B82424" d="M399.793,334.572c0.011,0,0.022,0,0.033,0c8.554-0.006,15.483-2.242,15.483-5
		c0-2.757-6.926-4.993-15.478-5c-0.013,0-0.025,0-0.038,0"/>
	<path fill="none" stroke="#FFFFFF" stroke-width="2.5" stroke-linecap="round" stroke-miterlimit="10" d="M402.018,306.819
		c0,0-7.608,0.951-15.215-2.671"/>
	<path fill="none" stroke="#FFFFFF" stroke-width="2.5" stroke-linecap="round" stroke-miterlimit="10" d="M372.622,409.715
		c0,0-0.652-8.882,6.784-25.201c2.67-5.859,4.461-9.854,5.66-12.568c1.905-4.311,3.176-8.868,3.713-13.551
		c0.305-2.655,0.542-5.811,0.542-9.203"/>
	
		<line fill="none" stroke="#FFFFFF" stroke-width="2.5" stroke-linecap="round" stroke-miterlimit="10" x1="372.854" y1="419.524" x2="372.854" y2="416.007"/>
</g>
<ellipse id="shadow" opacity="0.1" cx="411.357" cy="530.609" rx="51.467" ry="24.171"/>
<linearGradient id="smoke_1_" gradientUnits="userSpaceOnUse" x1="306.6523" y1="170.3528" x2="472.3333" y2="170.3528">
	<stop  offset="0" style="stop-color:#FFFFFF;stop-opacity:0.1"/>
	<stop  offset="0.4332" style="stop-color:#FFFFFF;stop-opacity:0.1"/>
	<stop  offset="1" style="stop-color:#FFFFFF;stop-opacity:0.7"/>
</linearGradient>
<path id="smoke" fill="none" stroke="url(#smoke_1_)" stroke-width="26" stroke-linecap="round" stroke-miterlimit="10" d="
	M399.927,302.206l0.044-2.136c0,0,2.401-25.069-30.535-50.652S320.325,201,319.663,170s30.671-62.729,74.004-82.531
	s65-40.135,65.667-48.969"/>
</svg>
            
          
!
            
              html,body{
  height:100%;
}
body {
  display:flex;
  align-items:center;
  justify-content:center;
  background:#FFB64E;
  width:100%;
  margin:0;
}
svg {
  margin:auto;
  height:100%;
  width:100%;
  overflow:hidden;
  visibility:hidden;
}
            
          
!
            
              TweenMax.set("svg", { visibility: "visible" });
TweenMax.set("#smoke", { drawSVG: "0% 0%", x: 9 });
TweenMax.set("#eyes", { y: 0 });
TweenMax.set("#speedLine", { drawSVG: "0% 0%", x: 6 });
TweenMax.set("#speedLineDown", { drawSVG: "0% 0%", x: 4, opacity: 0 });

function bottleMove() {
  let moveBottle = new TimelineMax({});
  moveBottle
    .to("#bottle", 0.35, {
      rotation: 1,
      scaleY: 1.01,
      scaleX: 0.99,
      transformOrigin: "bottom center",
      ease: Linear.easeNone
    })
    .to("#bottle", 0.3, {
      rotation: -0.25,
      scaleY: 1,
      scaleX: 1,
      ease: Linear.easeNone
    })
    .to("#bottle", 0.2, {
      rotation: 0,
      ease: Linear.easeNone
    })
    .to("#bottle", 0.3, {
      rotation: -1,
      scaleY: 1.02,
      scaleX: 0.98,
      ease: Linear.easeNone
    })
    .to("#bottle", 0.3, {
      rotation: 0,
      scaleY: 1,
      scaleX: 1,
      ease: Linear.easeNone
    })
    .to(
      "#bottle",
      1,
      { scaleY: 1.05, scaleX: 0.92, ease: Power1.easeInOut },
      "label"
    )
    .to("#bottle", 1, { rotation: 2 }, "label+=0.5")
    .to(
      "#bottle",
      0.15,
      { scaleY: 0.95, scaleX: 1.05, rotation: 1 },
      "label+=2"
    )
    .to("#bottle", 0.15, { scale: 1, rotation: 0 })
    .to("#bottle", 0.15, { scaleY: 0.95, scaleX: 1.05, rotation: 0 })
    .to("#bottle", 0.6, {
      scale: 1,
      rotation: 0,
      ease: Back.easeOut.config(1)
    });
  return moveBottle;
}

function bottleOut() {
  let tl = new TimelineMax();
  tl
    .to("#bottle", 0.15, { scaleX: 1.1, scaleY: 0.9 })
    .to("#bottle", 0.15, { scale: 1 })
    .to("#bottle", 0.15, { scaleX: 1.05, scaleY: 0.98 })
    .to("#bottle", 0.15, { scale: 1 });
  return tl;
}

function animateSmoke() {
  let smokeTl = new TimelineMax();
  smokeTl
    .to("#smoke", 0.35, { x: 0, ease: Linear.easeNone }, "in")
    .to("#smoke", 0.6, { drawSVG: "0% 50%", ease: Linear.easeNone }, "in")
    .to("#smoke", 0.6, { drawSVG: "0% 100%", ease: Linear.easeOut }, "out")
    .to("#smoke", 0.6, { opacity: 0 }, "out+=0.3");

  return smokeTl;
}

function animateCork() {
  let corkTl = new TimelineMax();
  corkTl
    // Cork first move
    .to("#cork", 0.5, { y: -4 }, "oneUp")
    
    .to("#cork", 0.5, { y: 0 }, "oneDown")
    // Cork Second move(up + rotate left)
    .to("#cork", 0.45, { y: -8, rotation: 1.75 }, "twoUp")
    
    .to("#cork", 0.4, { y: 0 }, "twoDown")
    // rotate right
    .to("#cork", 0.2, { rotation: -1.75 }, "twoDown")
    // center again
    .to("#cork", 0.2, { rotation: 0 }, "twoDown+=0.2")
    // Animating the cork top
    // CorkTop/CorkBun First move
    .to("#corkTop", 0.5, { attr: { ry: 8 } }, "oneUp")
    .to("#corkTop", 0.3, { attr: { ry: 7.463 } }, "oneDown")
    .to("#corkBun ellipse", 0.5, { attr: { ry: 6 } }, "oneUp")
    .to("#corkBun ellipse", 0.3, { attr: { ry: 4.966 } }, "oneDown")
    .to("#corkBun path", 0.5, { scaleY:1.5,y:-4 }, "oneUp")
    .to("#corkBun path", 0.3, { scaleY:1,y:0 }, "oneDown")
    // CorkTop/CorkBun Second move
    .to("#corkTop", 0.45, { attr: { ry: 9 } }, "twoUp")
    .to("#corkTop", 0.3, { attr: { ry: 7.463 } }, "twoDown")
    .to("#corkBun ellipse", 0.45, { attr: { ry: 8 } }, "twoUp")
    .to("#corkBun ellipse", 0.3, { attr: { ry: 4.966 } }, "twoDown")
    .to("#corkBun path", 0.45, { scaleY:1.5,y:-4 }, "twoUp")
    
    .to("#corkBun path", 0.3, { scaleY:1,y:0 }, "twoDown")
    // CorkTop/CorkBun third move
    .to("#corkTop", 0.75, { attr: { ry: 9 } }, "up")
    .to(
      "#corkTop",
      0.75,
      { attr: { ry: 9.5 }, ease: Power4.easeOut },
      "up+=0.75"
    )
    .to("#corkBun ellipse", 0.75, { attr: { ry: 6.5 } }, "up")
    .to("#corkBun ellipse", 0.75, { attr: { ry: 7 } }, "up+=0.75")
    .to("#corkBun ellipse", 0.75, { attr: { ry: 4.966 } }, "corkFlies")
    .to("#corkBun path", 0.75, { scaleY:1.35,y:-2 }, "up")
    .to("#corkBun path", 0.75, { scaleY:1.6,y:-4 }, "up+=0.75")
    .to("#corkBun path", 0.75, { scaleY:1.6,y:-4 }, "corkFlies")
    .to("#corkBun path", 0.1, { scaleY:1,y:0 }, "corkFlies+=0.6")
    // Return to initial ry value when cork starts flying
    .to(
      "#corkTop",
      0.15,
      { attr: { ry: 7.463 }, ease: Power4.easeOut },
      "corkFlies"
    )
    // Cork Third move
    .to("#cork", 0.75, { y: -10, ease: Linear.easeNone }, "up")
    .to(
      "#cork",
      0.75,
      { y: -25, scaleY: 1.08, scaleX: 0.98, ease: Linear.easeNone },
      "up+=0.75"
    )
    
    
    //
    .to("#cork", 0.15, { rotation: -3, ease: Linear.easeNone }, "up+=0.5")
    .to("#cork", 0.15, { rotation: 3, ease: Linear.easeNone }, "up+=0.65")
    .to("#cork", 0.15, { rotation: -4, ease: Linear.easeNone }, "up+=0.8")
    .to("#cork", 0.15, { rotation: 4, ease: Linear.easeNone }, "up+=0.95")
    .to("#cork", 0.15, { rotation: -4, ease: Linear.easeNone }, "up+=1.1")
    .to("#cork", 0.25, { rotation: 2, ease: Power1.easeOut }, "up+=1.25")
    // Cork Flies
    .to("#cork", 0.5, { y: -4000, ease: Power1.easeIn }, "corkFlies")
    
    // Cork comes down
    .to(
      "#cork",
      0.25,
      { y: 0, rotation: 0, ease: Linear.easeNone },
      "corkFlies+=1"
    )

    .to(
      "#cork",
      0.2,
      { scaleY: 0.8, y: 15, ease: Linear.easeNone },
      "finalPosIn"
    )
   
    // Cork -- corkTop back to original position
    .to("#cork", 0.5, { scaleY: 1, y: 0, ease: Power1.easeOut }, "finalPosOut")

    .to(
      "#corkTop",
      0.2,
      { attr: { ry: 6.5 }, ease: Linear.easeNone },
      "finalPosIn"
    )
    .to(
      "#corkTop",
      0.2,
      { attr: { r: 7.463 }, ease: Linear.easeNone },
      "finalPosOut"
    );
  return corkTl;
}
function animateEyes() {
  let eyesTl = new TimelineMax();
  eyesTl
    .to("#eyes", 0.5, { y: -3 })
    .to("#eyes", 0.15, { opacity: 0 }, "blink")
    .to("#eyes", 0.5, { y: 0 }, "blink")
    .to("#eyes", 0.15, { opacity: 1 }, "blink+=0.15")
    .to("#eyes", 0.5, { y: -3, ease: Back.easeOut.config(3) }, 1)
    .to("#eyes", 0.4, { y: 0 })
    // Third move
    .to("#eyes", 0.2, { opacity: 0 }, 1.75)
    .to("#eyes", 0.2, { opacity: 1 })
    .to("#eyes", 1.25, { y: -5 }, "EyesUp")
    // Move eyes seperately on third move
    .to(
      "#lEye",
      0.5,
      { y: -1, x: 0.25, attr: { ry: 1.8, rx: 1.3 } },
      "EyesUp+=0.75"
    )
    .to(
      "#rEye",
      0.5,
      { y: -1, x: -0.25, attr: { ry: 1.8, rx: 1.3 } },
      "EyesUp+=0.75"
    )
    // Cork
    .to("#eyes", 1.5, { y: 0 }, "end")
    .to("#lEye", 0.5, { y: 0, x: 0, attr: { rx: 1.577, ry: 1.577 } }, "end")
    .to("#rEye", 0.5, { y: 0, x: 0, attr: { rx: 1.577, ry: 1.577 } }, "end");
  return eyesTl;
}

function animateArms() {
  let armsTl = new TimelineMax();
  armsTl
    .to("#lArmS1", 0.5, { morphSVG: "#lArmS2" }, "first")
    .to("#rArmS1", 0.5, { morphSVG: "#rArmS2" }, "first")
    .to("#lArmS1", 0.5, { morphSVG: "#lArmS1" }, "firstDown")
    .to("#rArmS1", 0.5, { morphSVG: "#rArmS1" }, "firstDown")
    .to("#lArmS1", 0.45, { morphSVG: "#lArmS3" }, "secondUp")
    .to("#rArmS1", 0.45, { morphSVG: "#rArmS3" }, "secondUp")
    .to("#lArmS1", 0.4, { morphSVG: "#lArmS1" }, "secondDown")
    .to("#rArmS1", 0.4, { morphSVG: "#rArmS1" }, "secondDown")
    .to("#lArmS1", 0.75, { morphSVG: "#lArmS4" }, "thirdUp")
    .to("#rArmS1", 0.75, { morphSVG: "#rArmS4" }, "thirdUp")
    .to("#lArmS1", 0.75, { morphSVG: "#lArmS5" }, "fourthUp")
    .to("#rArmS1", 0.75, { morphSVG: "#rArmS5" }, "fourthUp");
  return armsTl;
}
function animateArmsMask() {
  let tl = new TimelineMax();
  tl.to("#leftArmGroup", 0.5, { y: -4 }, "oneUp")
.to("#leftArmGroup", 0.5, { y: 0 }, "oneDown")
.to("#rightArmGroup", 0.5, { y: -4 }, "oneUp")
.to("#rightArmGroup", 0.5, { y: 0 }, "oneDown")
.to("#leftArmGroup", 0.45, { y: -8 }, "twoUp")
.to("#leftArmGroup", 0.4, { y: 0 }, "twoDown")
.to("#rightArmGroup", 0.45, { y: -8 }, "twoUp")
.to("#rightArmGroup", 0.4, { y: 0 }, "twoDown")  
.to("#leftArmGroup", 0.75, { y: -10, ease: Linear.easeNone }, "up")
.to("#leftArmGroup", 0.75, { y: -25,scaleY:1.08,scaleX:0.98,ease:Linear.easeNone }, "up+=0.75")
.to("#rightArmGroup", 0.75, { y: -10, ease: Linear.easeNone }, "up")
.to("#rightArmGroup", 0.75, { y: -25,scaleY:1.08,scaleX:0.98,ease:Linear.easeNone }, "up+=0.75")
.to("#leftArmGroup", 0.15, { rotation: -3, ease: Linear.easeNone }, "up+=0.5")
.to("#leftArmGroup", 0.15, { rotation: 3, ease: Linear.easeNone }, "up+=0.65")
.to("#leftArmGroup", 0.15, { rotation: -4, ease: Linear.easeNone }, "up+=0.8")
.to("#leftArmGroup", 0.15, { rotation: 4, ease: Linear.easeNone }, "up+=0.95")
.to("#rightArmGroup", 0.15, { rotation: 4, ease: Linear.easeNone }, "up+=1.1")
.to("#rightArmGroup", 0.25, { rotation: 0, ease: Power1.easeOut }, "up+=1.25")
.to("#rightArmGroup", 0.15,{ rotation: -3, ease: Linear.easeNone }, "up+=0.5")
.to("#rightArmGroup", 0.15, { rotation: 3, ease: Linear.easeNone }, "up+=0.65")
.to("#rightArmGroup", 0.15,{ rotation: -4, ease: Linear.easeNone }, "up+=0.8")
.to("#rightArmGroup", 0.15, { rotation: 4, ease: Linear.easeNone }, "up+=0.95")
.to("#leftArmGroup", 0.15, { rotation: -4, ease: Linear.easeNone }, "up+=1.1")
.to("#leftArmGroup", 0.25, { rotation: 0, ease: Power1.easeOut }, "up+=1.25")
.to("#leftArmGroup", 0.5, { rotation:0,y: -4000,ease: Power1.easeIn }, "corkFlies")
.to("#leftArmGroup", 0.25, { y: 0,ease:Linear.easeNone }, "corkFlies+=1")
.to("#rightArmGroup", 0.5, {rotation:0, y: -4000,ease: Power1.easeIn }, "corkFlies")
.to("#rightArmGroup", 0.25, { y: 0,ease:Linear.easeNone }, "corkFlies+=1")
.to("#leftArmGroup", 0.2, { y: 15,ease: Linear.easeNone }, "finalPosIn")
.to("#leftArmGroup", 0.5, { y: 0,scale:1,ease:Power1.easeOut }, "finalPosOut")
.to("#rightArmGroup", 0.2, { y: 15,ease: Linear.easeNone }, "finalPosIn")
.to("#rightArmGroup", 0.5, { y: 0,scale:1,ease:Power1.easeOut }, "finalPosOut")
  return tl;
}
function armsOut() {
  let tl = new TimelineMax();
  tl
    .to(
      "#lArmS1",
      0.05,
      { y: -6, morphSVG: "#lArmS6", ease: Linear.easeNone },
      "one"
    )
    .to(
      "#rArmS1",
      0.05,
      { y: -6, morphSVG: "#rArmS6", ease: Linear.easeNone },
      "one"
    )
    .to(
      "#lArmS1",
      0.15,
      { y: -17, morphSVG: "#lArmS7", ease: Linear.easeOut },
      "two"
    )
    .to(
      "#rArmS1",
      0.15,
      { y: -17, morphSVG: "#rArmS7", ease: Linear.easeOut },
      "two"
    )
    .to(
      "#lArmS1",
      0.1,
      { y: -10, morphSVG: "#lArmS8", ease: Linear.easeOut },
      "three"
    )
    .to(
      "#rArmS1",
      0.1,
      { y: -10, morphSVG: "#rArmS8", ease: Linear.easeOut },
      "three"
    )
    .to(
      "#lArmS1",
      0.2,
      { y: 0, morphSVG: "#lArmS1", ease: Power2.easeOut },
      "four"
    )
    .to(
      "#rArmS1",
      0.2,
      { y: 0, morphSVG: "#rArmS1", ease: Power2.easeOut },
      "four"
    );
  return tl;
}
function animateSpeedLine() {
  let lineTl = new TimelineMax();
  lineTl
    .to("#speedLine", 0.1, { drawSVG: "15% 25%", ease: Linear.easeNone })
    .to("#speedLine", 0.1, { drawSVG: "25% 100%", ease: Linear.easeNone })
    .to("#speedLine", 0.1, { drawSVG: "100% 100%" }, "up")
    .to("#speedLine", 0.05, { opacity: 0 }, "up+=0.05");
  return lineTl;
}
function animateSpeedLineDown() {
  let tl = new TimelineMax();
  tl
    .to("#speedLineDown", 0.1, {
      opacity: 1,
      drawSVG: "5% 75%",
      ease: Linear.easeNone
    })
    .to("#speedLineDown", 0.1, { opacity: 0, drawSVG: "95% 95%" });
  return tl;
}
function finalEyeBlink(){
  let tl = new TimelineMax();
  tl.to("#eyes", 0.15, { opacity: 0 }, "blink")
    .to('#eyes',0.15,{opacity:1})
  return tl;
}
let masterTl = new TimelineMax({ repeat: -1});
masterTl
  .add(bottleMove(), 0)
  .add(animateCork(), 0)
  .add(animateArms(), 0)
  .add(animateArmsMask(),0)
  .add(animateEyes(), 0)
  .add(animateSmoke(), 3.4)
  .add(animateSpeedLine(), 3.35)
  .add(animateSpeedLineDown(), 4.55)
  .add(bottleOut(), 4.6)
  .add(armsOut(), 4.6)
  .add(particlesCorkFlies,3.4)
  .add(particlesFinal,4.6)
  .add(finalEyeBlink(),5.40)

// Add Particles
function particlesCorkFlies(){
  let totalParticles = 5;
  for ( i= 0; i < totalParticles; i++) {
  let xmlns = "http://www.w3.org/2000/svg",
      particles = document.createElementNS(xmlns,'ellipse'),
      particleGroup = document.querySelector("#particleGroup");
      particles.setAttributeNS(null,'rx',RandomMinMax(4,9)),
      particles.setAttributeNS(null,'ry',RandomMinMax(4,9))
      particles.setAttributeNS(null, "cx", 400),
      particles.setAttributeNS(null, "cy", 300),
      particles.setAttributeNS(null, "fill", "#B82424"),
      particles.setAttributeNS(null, "fill-opacity", "0.75"),
      particleGroup.appendChild(particles);
      let tl = new TimelineMax({onComplete:function() {
        particleGroup.removeChild(particles);
      }});  
      tl.to(particles,0.6,{physics2D:{velocity:RandomMinMax(300,600),angle:RandomMinMax(-130,-30),gravity:RandomMinMax(750,1250)},scale:0,alpha: 1})
      }      
}
// Randomize function
function RandomMinMax(min,max) {
  return min + Math.floor(Math.random()* (max-min));
  }


function particlesFinal(){
  let totalParticles = 5;
  for ( i= 0; i < totalParticles; i++) {
  let xmlns = "http://www.w3.org/2000/svg",
      smallParticles = document.createElementNS(xmlns,'ellipse'),
      smallParticleGroup = document.querySelector("#smallParticleGroup");
      smallParticles.setAttributeNS(null,'rx',RandomMinMax(4,8)),
      smallParticles.setAttributeNS(null,'ry',RandomMinMax(4,8))
      smallParticles.setAttributeNS(null, "cx", 400),
      smallParticles.setAttributeNS(null, "cy", 310),
      smallParticles.setAttributeNS(null, "fill", "#B82424"),
      smallParticles.setAttributeNS(null, "fill-opacity", "0.75"),
      smallParticleGroup.appendChild(smallParticles);
      let tl = new TimelineMax({onComplete:function() {
        smallParticleGroup.removeChild(smallParticles);
      }});  
      tl.to(smallParticles,0.4,{physics2D:{velocity:RandomMinMax(150,200),angle:RandomMinMax(-120,-30),gravity:RandomMinMax(400,650)},scale:0,alpha: 1})
      }      
}


//GSDevTools.create();
            
          
!
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