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

              
                <?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<div>
<canvas id="canvas" width="300" height="150" ></canvas>
</div>
<svg version="1.1" id="Layer_1" xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;"
	 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 200 200"
	 style="enable-background:new 0 0 200 200;" xml:space="preserve">
  <filter id="inset-shadow" x="-10%" y="-10%" width="200%" height="300%">
    <feComponentTransfer in=SourceAlpha>
      <feFuncA type="table" tableValues="1 0" />
    </feComponentTransfer>
    <feGaussianBlur stdDeviation="3"/>
    <feOffset dx="5" dy="5" result="offsetblur"/>
    <feFlood flood-color="rgb(20, 0, 0)" result="color"/>
    <feComposite in2="offsetblur" operator="in"/>
    <feComposite in2="SourceAlpha" operator="in" />
    <feMerge>
      <feMergeNode in="SourceGraphic" />
      <feMergeNode />
    </feMerge>
  </filter> 
<style type="text/css">
	.st0{fill:#FFEC55;stroke:#231F20;stroke-linecap:round;stroke-miterlimit:10;}
	.st1{fill:#E6E7E8;stroke:#231F20;stroke-width:0.5;stroke-linecap:round;stroke-miterlimit:10;}
	.st2{fill:#FFCE00;stroke:#231F20;stroke-linecap:round;stroke-miterlimit:10;}
	.st3{fill:none;stroke:#231F20;stroke-linecap:round;stroke-miterlimit:10;}
	.st4{stroke:#231F20;stroke-width:0.5;stroke-linecap:round;stroke-miterlimit:10;}
</style>

	<foreignObject requiredExtensions="&ns_ai;" x="0" y="0" width="1" height="1">
		<i:pgfRef  xlink:href="#adobe_illustrator_pgf">
		</i:pgfRef>
	</foreignObject>


	<g i:extraneous="self" id="total">
		<path id="head" filter="url(#light)" class="st0" d="M67.3,49.2c1.3-11,12.5-32.9,34-32.6c21.2,0.3,31.9,21.9,33.1,33.1c0.3,2.5,0.8,8-2.6,11.1
			c-3.8,3.5-10.2,2-10.6,1.9c-4.9-1.2-5.3-4.2-9-4.2c-4.4,0-5.6,4.1-9.4,3.5c-3.4-0.5-3.3-4.1-6.8-4.8c-4.3-0.9-6.6,4.3-10.6,3.2
			c-3-0.8-2.7-4-5.8-4.8c-4.2-1.2-7.7,4.1-10.3,2.9C66.4,57.2,67.2,49.9,67.3,49.2z"/>
    <defs>
    <filter id="light" x="-50%" y="-50%" width="300%" height="300%">
            <feGaussianBlur stdDeviation="20" result="blur"/>
            <feMerge>
                <feMergeNode in="blur"/>
                <feMergeNode in="SourceGraphic"/>
            </feMerge>
        </filter>
  </defs>
    

		<g class="foot" id="top-sec-right">
			<rect x="105.9" y="63.2" transform="matrix(0.9928 -0.1199 0.1199 0.9928 -8.1761 13.4926)" class="st2" width="4.3" height="23"/>
		<line class="st3" x1="106.4" y1="63.3" x2="109.7" y2="86.1"/>
    </g>
    <g class="foot" id="bottom-sec-right">
			<rect x="109.4" y="88.3" transform="matrix(-0.9864 0.1644 -0.1644 -0.9864 237.8707 179.9581)" class="st2" width="4.3" height="23"/>
		
		<line class="st3" x1="108.9" y1="88.4" x2="113.1" y2="110.5"/>
    
			<polygon class="st4" points="114.5,116 111.5,112.8 116,112.4 			"/>
			<path class="st1" d="M115.6,110.3l0.5,2.2l-4.6,0.4l-0.5-2.2c0.2,0.1,0.5,0.2,0.8,0.2c0.7-0.1,0.7-0.8,1.3-0.8
				c0.5,0,0.8,0.5,1.5,0.6C115,110.6,115.3,110.4,115.6,110.3z"/>
		</g>
		<g class="foot" id="top-first-left">
			<rect x="74.3" y="59.3" transform="matrix(0.9653 0.2613 -0.2613 0.9653 20.9808 -17.5089)" class="st2" width="4" height="21.6"/>
		<line class="st3" x1="78.9" y1="59.7" x2="73.7" y2="80.6"/>
    </g>
    <g class="foot" id="bottom-first-left">
			<rect x="73.2" y="82.9" transform="matrix(-0.9809 0.1947 -0.1947 -0.9809 167.1482 170.9575)" class="st2" width="4" height="21.6"/>
		
		<line class="st3" x1="73" y1="83" x2="77.6" y2="103.5"/>

			<polygon class="st4" points="78,108.4 75.1,105.5 79.4,105.1 			"/>
			<path class="st1" d="M78.9,103l0.5,2l-4.3,0.5l-0.5-2c0.2,0.1,0.4,0.2,0.7,0.2c0.6-0.1,0.6-0.7,1.2-0.8c0.5-0.1,0.8,0.5,1.4,0.5
				C78.3,103.4,78.7,103.2,78.9,103z"/>
		</g>
		<g class="foot" id="top-sec-left">
			<rect x="83.5" y="61.8" transform="matrix(0.9993 3.770993e-02 -3.770993e-02 0.9993 2.8009 -3.1717)" class="st2" width="4" height="21.8"/>
		<line class="st3" x1="85.7" y1="61.8" x2="85.3" y2="83.6"/>
    </g>
    <g class="foot" id="bottom-sec-left">
			<rect x="83.9" y="85.5" transform="matrix(-0.9989 4.749858e-02 -4.749858e-02 -0.9989 176.2316 188.6049)" class="st2" width="4" height="21.8"/>

		<line class="st3" x1="85.3" y1="85.4" x2="86.8" y2="106.6"/>
	
			<polygon class="st4" points="86.9,111.9 84.4,108.6 88.8,108.7 			"/>
			<path class="st1" d="M88.5,106.7l0.2,2.1l-4.3-0.2l-0.2-2.1c0.2,0.1,0.4,0.3,0.7,0.3c0.6,0,0.8-0.6,1.3-0.6
				c0.5,0,0.7,0.6,1.4,0.7C88,106.9,88.3,106.8,88.5,106.7z"/>
		</g>
		<g class="foot" id="top-middle">
			<rect x="96.1" y="63.6" transform="matrix(0.9996 -2.840213e-02 2.840213e-02 0.9996 -2.0834 2.8172)" class="st2" width="4.1" height="22.3"/>
		<line class="st3" x1="97.6" y1="63.6" x2="98.7" y2="85.9"/>
    </g>
    <g class="foot" id="bottom-middle">
			<rect x="97.1" y="87.9" transform="matrix(-0.9979 6.407817e-02 -6.407817e-02 -0.9979 204.4163 191.6196)" class="st2" width="4.1" height="22.3"/>
		
		<line class="st3" x1="97.7" y1="87.8" x2="99.7" y2="109.5"/>
			<polygon class="st4" points="100.4,115 97.8,111.6 102.3,111.7 			"/>
			<path class="st1" d="M102,109.6l0.2,2.1l-4.5-0.1l-0.2-2.1c0.2,0.1,0.4,0.3,0.7,0.3c0.6,0,0.8-0.7,1.3-0.7c0.5,0,0.7,0.6,1.4,0.7
				C101.5,109.8,101.8,109.7,102,109.6z"/>
		</g>
    <g class="foot" id="top-first-right">
		
			<rect x="119.9" y="64.3" transform="matrix(0.9389 -0.3442 0.3442 0.9389 -18.6351 46.6181)" class="st2" width="4.3" height="23"/>
		<line class="st3" x1="117.8" y1="65.1" x2="126.2" y2="86.5"/>
    </g>
    <g class="foot" id="bottom-first-right">
			<rect x="124.4" y="89.5" transform="matrix(-0.9989 4.780569e-02 -4.780569e-02 -0.9989 257.6786 195.8497)" class="st2" width="4.3" height="23"/>
		
		<line class="st3" x1="125.2" y1="89.4" x2="126.9" y2="111.8"/>

			<polygon class="st4" points="127.6,117.4 125,113.9 129.5,114.1 			"/>
			<path class="st1" d="M129.3,111.9l0.2,2.2l-4.6-0.2l-0.2-2.2c0.2,0.1,0.4,0.3,0.7,0.3c0.7,0,0.8-0.7,1.4-0.7
				c0.5,0,0.7,0.6,1.4,0.8C128.7,112.1,129.1,112,129.3,111.9z"/>
		</g>
      
	</g>


</svg>


              
            
!

CSS

              
                body {
  background: linear-gradient(
      rgba(0, 0, 0,.85), 
      rgba(0, 0, 0,.85)
    ), url("http://bgfons.com/upload/sky_texture1969.jpg");
  background-size: cover no-repeat;
}

div {
  top:250px;
  left:300px;
  z-index:0;
  background-color: #fff;
  width: 350px;
  height: 300px;
  position: relative;
}

svg {
  position: relative;
  top: 0;
  left: 0;
}

#canvas {
  position:absolute;
  top:0;
  left:0;
  z-index:0;
  background-color: #fff;
  width: 350px;
  height: 300px;
  border-top: 10px solid brown;
  border-bottom: 10px solid brown;
}
svg {
  position:absolute;
/*   width: 100%;
  height: 400px; */
}

div::after {
      content: "";
    position: absolute;
    height: 1em;
    width: 150px;
    background: #FAE80C;
    border-radius: 0.5em;
    top: 375px;
    z-index: -1;
  transform-origin: 100% 0;
  -ms-transform: rotate(30deg); /* IE 9 */
    -webkit-transform: rotate(30deg); /* Chrome, Safari, Opera */
    transform: rotate(30deg);
    right:0;
    border-left: 0.1em solid #333;
    border-top: 0.1em solid #333;
    border-bottom: 0.1em solid #333;
    box-shadow: -0.05em 0.05em 0.05em 0.05em rgba(51, 51, 51, 0.5);
}

div::before{
      content: "";
    position: absolute;
    height: 1em;
    width: 150px;
    background: #FAE80C;
    border-radius: 0.5em;
    top: 300px;
    z-index: -1;
  -ms-transform: rotate(-30deg); /* IE 9 */
  transform-origin: 100% 0;
    -webkit-transform: rotate(-30deg); /* Chrome, Safari, Opera */
    transform: rotate(-30deg);
    left:0;
    border-left: 0.1em solid #333;
    border-top: 0.1em solid #333;
    border-bottom: 0.1em solid #333;
    box-shadow: -0.05em 0.05em 0.05em 0.05em rgba(51, 51, 51, 0.5);
}

              
            
!

JS

              
                var total = $('#total'),
    head = $('#head'),
    top_first_left = $('#top-first-left'), bottom_first_left = $('#bottom-first-left'),
    top_sec_left = $('#top-sec-left'),
    bottom_sec_left = $('#bottom-sec-left'),
    top_middle = $('#top-middle'),
    bottom_middle = $('#bottom-middle'),
    top_sec_right = $('#top-sec-right'),
    bottom_sec_right = $('#bottom-sec-right'),
    top_first_right = $('#top-first-right'),
    bottom_first_right = $('#bottom-first-right'),
    feet = $('.foot');

//repeat
var tl = new TimelineMax({repeat:-1, yoyo:true
});

var master = new TimelineMax({repeat:-1, yoyo:true
});

var tlAll = new TimelineMax({repeat:-1, yoyo:true
});

var feetLeftTl =  new TimelineMax({repeat:-1, yoyo:true
});

var feetMdTl =  new TimelineMax({repeat:-1, yoyo:true
});

var feetRightTl =  new TimelineMax({repeat:-1, yoyo:true
});


TweenMax.set('#total', {scale:.2});
tlAll
  .to(total, 30, 

          {
            y: -20,
            x: -50,
            ease:Power2.easeInOut
            }
)
  .to(total, 30, {
            y: -20,
            x: 100,
            ease:Power2.easeInOut
 
            }
)

tl
  .fromTo(head, 3, 
          {scale: 1, y: 0},
          {scaleX:.8,
  scaleY:1.2, autoAlpha: .8,  ease:SlowMo.config(20)}
          );

 feetLeftTl
   .to([top_first_left,
bottom_first_left,
top_sec_left,
bottom_sec_left], 3, {y: 10, scaleX: 0.8, rotation: -10, ease:Sine.easeInOut});

feetMdTl
.to([top_middle,
bottom_middle], 3, {y: 10, scaleX: 0.8});

 feetRightTl
   .to([top_sec_right,
bottom_sec_right,
top_first_right], 3, {y: 10, scaleX: 0.8, rotation: 10, ease:Sine.easeInOut})
 .to(bottom_first_right, 3, {x: -4, y: 10, scaleX: 0.8, rotation: -10, ease:Sine.easeInOut}, 0);

  
TweenMax.to("#light feGaussianBlur",3,{attr:{stdDeviation:5},repeat:-1,yoyo:true})
;

function random(min,max)
{
    return Math.floor(Math.random()*(max-min+1)+min);
}


//dragging effect
Draggable.create("#total", {type:"x,y", edgeResistance:0.65, bounds:"svg", 
                
 throwProps:true,    
                            autoScroll:true,
                           onPress:function() {
  
    startX = this.x;
    startY = this.y;
  },
                            
 onDrag:function () {
   var xChange = this.x - startX;
   var yChange = this.y - startY;
   if(xChange < 0) {
     //to the left
     TweenMax.to(head, 1, {rotation:5});
       TweenMax.staggerTo(feet, .6, {y: 15, rotation:-10});
   }
   //to the right
   else {
     TweenMax.to(head, 1, {rotation:-5});
        TweenMax.to(feet, 1, {y: 10,rotation:15, ease:SlowMo.easeInOut});
   }
 
  },
                            onThrowComplete: function () {
     TweenMax.to(head, 1, {rotation:0,ease:SlowMo.easeInOut});
        TweenMax.to(feet, 1.5,  {rotation:0, y:10, ease:SlowMo.easeInOut});
   },
                            
                        
                            
                           });



              
            
!
999px

Console