cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

            
              <div class="pinata-container"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" x="0px" y="0px" viewBox="0 0 174.3 330" xml:space="preserve" id="pinata"><style type="text/css">
	.st0{fill:none;stroke:#D4D9DD;stroke-width:2;stroke-miterlimit:10;}
	.st1{fill:#FED36E;}
	.st2{fill:#438BBD;}
	.st3{fill:#8365B0;}
	.st4{fill:#40ADCF;}
	.st5{fill:#FD9E34;}
	.st6{fill:#A085C6;}
	.st7{fill:#FC5E8A;}
	.st8{fill:#384047;}
	.st9{fill:#FFFFFF;}
	.st10{fill:#505C66;}
	.st11{fill:#E5BB52;}
</style><g id="pinata-body"><path class="st0" d="M116.6 237.9c0 0-15-0.4-12.6-5.4 2.2-4.6 12.8 5.4 12.8 5.4"/><path class="st0" d="M117.9 237.9c0 0 12.5-3.2 9.4-6.9 -4-4.8-9.5 6.9-9.5 6.9"/><path class="st1" d="M36.8 244.7c-0.5-3.5-3.8-6.5-7.3-6.7l-24.7-1.6c-2.7-0.2-4.8-2.5-4.8-5.1v-10.4c0-2.6 1.9-5.8 4.2-7.1L34 197.7c2.3-1.3 4.1-4.4 3.9-7l-1.1-17.5c-0.1-1.8 1.2-3.2 3-3.2h9.6c0.9 0 1.9 0.6 2.4 1.4 0 0 18.7 32.6 22 38.2s6.9 5.5 7.5 6.5c0.7 1.2-4-0.5-3.2 1 4.3 7.4 9.9 17.2 9.9 17.2 1.3 2.3 4.5 4.1 7.2 4.1 0 0 33 0.1 39.2 0s9.4-2.8 10.9-2.8 -2.5 2.8-0.3 2.8c6.3 0.1 8.8 0 8.8 0 2.6 0 6 1.7 7.4 3.9 0 0 3.2 3.5 4 11.3 0.9 8.1 9.1 70 9.1 70 0.5 3.5-2 6.3-5.5 6.3h-15.9c-2.6 0-5.1-2.1-5.6-4.7l-4-23.2c-0.4-2.6-2.9-4.7-5.6-4.7H77.2c-2.6 0-4.4 2.1-4 4.7l4 23.2c0.4 2.6-1.3 4.7-4 4.7H55.7c-3.5 0-6.8-2.8-7.3-6.3L36.8 244.7z"/><path class="st2" d="M143.4 302.1c-0.4-2.6-2.9-4.7-5.6-4.7h-2.2l-2.6 7.2c1.6-0.5 3.1-0.9 4.4-1.1 0.6-0.1 1.2-0.1 1.8-0.1 4.7 0-4.2 4 0.7 4l0 0h0.1c0.3 0 0.6 0 1 0l0 0c1-0.1 2.1-0.3 3.2-0.6L143.4 302.1z"/><path class="st3" d="M144.2 306.7c-1.2 0.3-2.3 0.5-3.2 0.6l0 0c-0.3 0-0.7 0-1 0h-0.1l0 0c-4.8 0 4-4-0.7-4 -0.5 0-1.1 0.1-1.8 0.1 -1.3 0.2-2.8 0.6-4.4 1.1l-4.5 12.2c-0.9 2.5 0.5 4.5 3.1 4.5h14.3c0.2 0 0.4 0 0.7-0.1L144.2 306.7z"/><path class="st4" d="M85 229c-2-3.5-4.6-8-6.9-11.9 -0.9-1.5 3.9 0.2 3.2-1 -0.6-1-4.2-0.9-7.5-6.5 -1.1-1.9-4-6.8-7.3-12.6H35c-0.3 0.3-0.7 0.5-1 0.7L4.2 213.9c-2.3 1.2-4.2 4.4-4.2 7v8.1L85 229 85 229z"/><path class="st4" d="M169.1 283.8l-126.6 0L47 314h28.3l-2-11.9c-0.4-2.6 1.3-4.7 4-4.7h60.5c2.6 0 5.1 2.1 5.6 4.7l2 11.9H173C172 306.1 170.5 294.6 169.1 283.8z"/><path class="st5" d="M162.3 288.3c2 0 4.7 0.8 7.6 1.7 -1.1-8.4-2.2-16.9-3.1-23.6 -4.8 1.1-10.6 3.3-14.2 3.3 -4.9 0 4.1-4-0.7-4 -4.9 0-13.9 4-18.7 4 -4.9 0 4.1-4-0.7-4 -4.9 0-13.9 4-18.7 4 -4.9 0 4.1-4-0.7-4 -4.9 0-13.9 4-18.7 4 -4.9 0 4.1-4-0.7-4 -4.9 0-13.9 4-18.7 4 -4.9 0 4.1-4-0.7-4 -4.9 0-13.9 4-18.7 4 -4.9 0 4.1-4-0.7-4 -3.6 0-9.8 2.2-14.5 3.3l3.4 23.3c0.3 0 1.1 0 1.4 0 4.9 0-4.1-4 0.7-4 4.9 0 13.9 4 18.7 4 4.9 0-4.1-4 0.7-4 4.9 0 13.9 4 18.7 4 4.9 0-4.1-4 0.7-4 4.9 0 13.9 4 18.7 4 4.9 0-4.1-4 0.7-4 4.9 0 13.9 4 18.7 4 4.9 0-4.1-4 0.7-4 4.9 0 13.9 4 18.7 4 4.9 0-4.1-4 0.7-4 4.9 0 13.9 4 18.7 4C166.4 292.3 157.4 288.3 162.3 288.3z"/><path class="st6" d="M37 201c4.9 0 13.9 4 18.7 4 4.9 0-4.1-4 0.7-4 3.6 0 9.5 2.2 14.3 3.3 -3.8-6.5-9.7-16.8-14-24.2 -3.7 1.1-7.5 2.2-10.1 2.2 -4.9 0 4.1-4-0.7-4 -2.3 0-5.4 0.9-8.7 1.8l0.7 10.6c0.2 2.6-1.6 5.8-3.9 7l-8.8 4.8c4 1.1 8.2 2.5 11 2.5C41.1 205 32.1 201 37 201z"/><path class="st6" d="M172.7 311.3L172.7 311.3c-5 0-14-4-18.9-4s4.1 4-0.7 4c-2.2 0-5.4-0.8-8.5-1.8l2.7 15.7c0.4 2.6 2.9 4.7 5.6 4.7h15.9c3.5 0 6-2.8 5.5-6.3C174.3 323.7 173.7 318.7 172.7 311.3z"/><path class="st6" d="M77.2 325.3l-2.4-14c-5-0.2-13.6-4-18.3-4 -4.9 0 4.1 4-0.7 4 -2.5 0-6-1-9.5-2l2.1 14.4c0.5 3.5 3.8 6.3 7.3 6.3h17.5C75.9 330 77.6 327.9 77.2 325.3z"/><path class="st7" d="M153.8 238.4c0 0-2.5 0.1-8.8 0 -2.2 0 1.8-2.8 0.3-2.8s-4.7 2.7-10.9 2.8c-6.2 0.1-39.2 0-39.2 0 -2.6 0-5.8-1.9-7.2-4.1 0 0-2.3-4.1-5-8.8 -0.2 0.1-0.6 0.2-1 0.2 -4.9 0-13.9-4-18.7-4 -4.9 0 4.1 4-0.7 4 -4.9 0-13.9-4-18.7-4 -4.9 0 4.1 4-0.7 4 -4.9 0-13.9-4-18.7-4 -4.9 0 4.1 4-0.7 4 -4.9 0-13.9-4-18.7-4 -4.9 0 4.1 4-0.7 4 -1.2 0-2.9-0.3-4.4-0.7v6.2c-0.1 2.8 2.4 5 5.1 5.2l24.4 1.5c3.5 0.2 6.8 3.2 7.3 6.7l0.5 3.2c5-1 11.6-3.6 15.5-3.6 4.9 0-4.1 4 0.7 4 4.9 0 13.9-4 18.7-4 4.9 0-4.1 4 0.7 4 4.9 0 13.9-4 18.7-4 4.9 0-4.1 4 0.7 4h0.1c4.8 0.6 13.9-3.9 18.8-4 4.5 0.1-4.2 4 0.6 4h0.1 0.1c0.5 0 1 0 1.5-0.1 5-0.6 12.4-3.2 16.7-3.9l0 0c0.2 0 0.3 0 0.5 0 4.9 0-4.1 4 0.7 4 4.9 0 13.9-4 18.7-4 4.9 0-4.1 4 0.7 4 3.1 0 8-1.7 12.2-2.9C162 242.3 158.7 238.6 153.8 238.4z"/><path class="st8" d="M7.2 222.9c0-1.1 0.9-2 2-2s2 0.9 2 2v2.7c0 0.9-0.7 1.6-1.6 1.6H8.8c-0.9 0-1.6-0.7-1.6-1.6V222.9z"/><circle class="st9" cx="45.8" cy="217.5" r="11.5"/><path class="st10 pinata-eye" d="M41.9 206.7c-4.4 1.6-7.6 5.8-7.6 10.8 0 3.5 1.6 6.7 4.1 8.8 4.9-1 8.6-5.3 8.6-10.5C47 212 44.9 208.6 41.9 206.7z"/><path class="st11" d="M32.5 186.4c4.9 0-4.1-4 0.7-4 1.2 0 2.6 0.4 4.2 0.7l-0.6-9.8 -6.5-0.1c-2.6 0-4.6 2.1-4.4 4.8l0.5 7.3C28.7 186 30.8 186.4 32.5 186.4z"/><path class="st3" d="M32.4 186.3c-1.6 0-3.8-0.5-6-1.1l1.2 15.8c0 0.1 0 0.1 0 0.2l6.5-3.5c2.3-1.3 4.1-4.4 3.9-7l-0.6-7.7c-1.6-0.4-3.1-0.6-4.3-0.6C28.2 182.3 37.2 186.3 32.4 186.3z"/><path class="st3" d="M46 306.9c-1.2 0.3-2.3 0.4-3.3 0.4 -4.9 0 4.2-3.8-0.8-4 -1.9-0.1-4.5 0.6-7.2 1.4l-4.2 12.8c-0.8 2.5 0.6 4.5 3.3 4.5H48c0.1 0 0.1 0 0.2 0L46 306.9z"/><path class="st2" d="M42.2 281.6l-7.6 23.2c2.7-0.8 5.3-1.4 7.2-1.4 4.9 0-4.1 4 0.7 4 1 0 2.2-0.2 3.5-0.4L42.2 281.6z"/></g><line class="st0" x1="117" y1="238" x2="117" y2="0"/></svg></div>
            
          
!
            
              @keyframes drop
  0%
    transform: translateY(-100%)
  100%
    transform: translateY(0)
@keyframes swing
  0%
    transform: rotate(0deg)
  25%
    transform: rotate(5deg)
  50%
    transform: rotate(0deg)
  75%
    transform: rotate(-5deg)
  100%
    transform: rotate(0deg)
@keyframes roll
  0%
    transform: rotate(0deg)
    transform-origin: 90% 55%
  50%
    transform: rotate(360deg)
    transform-origin: 90% 55%
  100%
    transform: rotate(720deg)
    transform-origin: 90% 55%
.animate-eye
  .pinata-eye
    animation: roll 1s linear
.pinata-container
  display: block
  height: 300px
  width: 100%
#pinata
  overflow: visible
  position: absolute
  left: 50%
  top: -25px
  width: 150px
  margin-left: -75px
  transform-origin: top center
  animation: swing 1.5s cubic-bezier(0.310, 0.200, 0.670, 0.785) infinite
            
          
!
            
              var pinata = $("#pinata");

$('.pinata-container').click(function(e){
  var pinataTop = (($('#pinata-body').offset().top) - e.pageY + 83),    
      pinataLeft = (($('#pinata-body').offset().left) - e.pageX + 83);

  // eye roll
  $(this).bind("animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd", function(){
     $(this).removeClass('animate-eye');
  }).addClass('animate-eye');
  
  // move
  $('#pinata').css({
      'animation': 'none',
      'transform': 'rotate(5deg)',
      'transform-origin': '0% 50%',
      'transition': '0.3s ease all'
  });
});
// var $pinata = $('#pinata-body'),
//     pinataLeft,
//     pinataTop,
//     tween = TweenMax.from('#pinata', 3, {
//       y: -50,
//       ease: Elastic.easeOut
//     }),
//     tl = new TimelineMax({repeat: -1}),
//     tweenEye = TweenMax.to('.pinata-eye', 10, {
//       rotation: 720,
//       transformOrigin: '90% 55%',
//       ease: Elastic.easeOut,
//       paused: true
//     });

// tl.to('#pinata', 0.5, {
//     transformOrigin: 'center top',
//     rotation: 3,
//     repeat: 1,
//     yoyo: true,
//     ease: Sine.easeOut
//   })
//   .to('#pinata', 0.5, {
//     transformOrigin: 'center top',
//     rotation: -3,
//     repeat: 1,
//     yoyo: true,
//     ease: Sine.easeOut
//   })
  

// // Pushing
// $('.pinata-container').click(function(e){
//   tl.pause();
//   function restartswing(){
//     tl.restart() ? tweenEye.restart() : tl.restart();
//   }
//   tweenEye.restart() ? tweenEye.play() : tweenEye.restart();

//   var pinataTop = (($pinata.offset().top) - e.pageY + 83),
//       pinataLeft = (($pinata.offset().left) - e.pageX + 83),
//       tlswing = TweenMax.to('#pinata', 0.5, {
//         rotation: (pinataTop - pinataLeft)/3,
//         repeat: 1,
//         yoyo: true,
//         ease: Circ.easeOut,
//         paused: true,
//         onComplete: restartswing
//       });
  
//   tlswing.play();
  
// });

// // Falling

// // Exploding

            
          
!
999px
Loading ..................

Console