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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

            
              #ilu.container
  svg(version='1.1', xmlns='http://www.w3.org/2000/svg', xmlns:xlink='http://www.w3.org/1999/xlink', x='0px', y='0px', viewbox='-55 80 400 400', style='enable-background:new 0 0 288 560;', xml:space='preserve')
    g#heart
      path.st1(d='M131.8,310.1v-53.6c0,0-8-10.8-20.5-11s-24,10.2-24.5,26.7s13.3,36.3,45,53v-5.4\
      C131.8,316.6,131.8,313.3,131.8,310.1z')
      path.st2(d='M131.8,325.2c0,0,45.2-21.7,45.2-53c0,0,0.8-25.4-22.6-26.7c0,0-13.3-1.2-22.6,11')
    g#magnesium
      path.st5(d='M229,241h-16.2v24c5.4,0,10.8,0,16.2,0V241z')
      path.st6(d='M281,241h-16.3v24c5.4,0,10.9,0,16.3,0V241z')
      path.st7(d='M229,298.3V265c-5.4,0-10.8,0-16.2,0v36c0,0,2.5,24,33.2,23.7c0-5.2,0-10.3,0-15.5\
      C229.2,309.5,229,298.3,229,298.3z')
      path.st8(d='M264.7,265v33.7c0,0-1.8,10.2-18.7,10.5c0,5.2,0,10.3,0,15.5c0.3,0,0.6,0,0.9,0c31.6-0.8,34.1-23.3,34.1-23.3\
      V265C275.6,265,270.1,265,264.7,265z')
    g#clip
      path.st10(d='M31.3,297.7v-37.2c0,0-0.3-0.8-1.3-0.8c-0.9,0-1.2,0.8-1.2,0.8l0.2,37.8c0,0,0.7,6.6,8.1,6.7\
      c0-0.7,0-1.5,0-2.2C31.3,302.3,31.3,297.7,31.3,297.7z')
      path.st11(d='M47.1,249.9c0,0-0.6-7.6-10.1-8.1c0,0.7,0,1.4,0,2.1c5.9,0.4,7.7,5.7,7.7,5.7s-0.1,44.8-0.2,47.9\
      c0,0,0.5,5.5-7.1,5.3c-0.1,0-0.3,0-0.4,0c0,0.7,0,1.5,0,2.2c0.1,0,0.1,0,0.2,0c9.9,0.2,9.7-7,9.7-7L47.1,249.9z')
      path.st10(d='M36.7,241.8c-10.5-0.3-11.5,8.1-11.5,8.1l0.2,64.8c0,0,1.1,9.9,11.6,10.1c0-0.8,0-1.6,0-2.4\
      c-8.3-0.1-9.1-8.1-9.1-8.1s-0.1-62.9-0.2-64.4c-0.2-1.5,2.8-5.8,8.6-5.9c0.3,0,0.5,0,0.8,0c0-0.7,0-1.5,0-2.1\
      C36.9,241.9,36.8,241.8,36.7,241.8z')
      path.st11(d='M50.5,260.4c0,0-0.4-0.8-1.2-0.8c-0.9,0-1.3,0.8-1.3,0.8l0,53.7c0,0,0.2,8.4-10.8,8.3c0,0-0.1,0-0.1,0\
      c0,0.8,0,1.6,0,2.4c0.1,0,0.2,0,0.3,0c12.7,0,13.1-10,13.1-10C50.3,315.1,50.5,260.4,50.5,260.4z')
            
          
!
            
              body
  background-color: #6dbdc4
  display: flex
  align-items: center
  justify-content: center

.container
  position: relative

#ilu
  width: 400px
  height: 400px
  overflow: hidden

.st1
  fill: #EC7964

.st2
  fill: #DF725E

.st3
  fill: #67B2B8

.st5
  fill: #EEF1F6

.st6
  fill: #E0E3E8

.st7
  fill: #4A4F52

.st8
  fill: #464A4D

.st10
  fill: #F7F5FA

.st11
  fill: #E7E6EA

#heart
  cursor: pointer
            
          
!
            
              var heart = document.getElementById('heart');
var magnesium = document.getElementById('magnesium');
var clip = document.getElementById('clip');
var transitionFinished = false;
var tl = new TimelineMax({});

onStarted();

function onStarted() {
  transitionFinished = false;
  tl.set([heart], {
      scaleX: 1,
      scaleY: 1,
    })
    .to([heart], .5, {
      scaleX: .95,
      scaleY: .95,
      ease: Linear.easeNone,
      repeat: -1,
      yoyo: true,
    }, '-=1.9');
  heart.addEventListener("click", bothConnect);
}

function bothConnect() {
  heart.removeEventListener("click", bothConnect);

  if (transitionFinished === true) {
    TweenLite.to("#heart", 0, {
      scale: 1
    });
    tl.set([heart], {
        scaleX: 1.1,
        scaleY: 1.1
      })
      .to([heart], .5, {
        scaleX: 1,
        scaleY: 1,
        ease: Elastic.easeOut.config(1, 0.5),
      })
      .to([clip], .75, {
        rotation: 20,
        x: 170,
        ease: Elastic.easeOut.config(3, 0.3),
      })
      .to([clip], .5, {
        rotation: 0,
        rotation: 0,
        x: 0,
        ease: Elastic.easeOut.config(.1, 0.3),
      })
      .to([magnesium], .5, {
        rotation: 0,
        y: 0,
        onComplete: onStarted
      });
  } else {
    TweenLite.to("#heart", 0, {
      scale: 1
    });
    tl.set([heart], {
        scale: 1.1
      })
      .to([heart], .5, {
        scaleX: 1,
        scaleY: 1,
        ease: Elastic.easeOut.config(1, 0.5),
      })
      .to([magnesium], .5, {
        rotation: -90,
        y: 80
      })
      .to([clip], .75, {
        rotation: -20,
        ease: Elastic.easeOut.config(3, 0.3),
      })
      .to([clip], .25, {
        rotation: 0,
        rotation: 0,
        x: 165,
        ease: Elastic.easeOut.config(.1, 0.3),
        onComplete: onFinished
      });
  }
}

function onFinished() {
  mayItBeat();
  transitionFinished = true;
  heart.addEventListener("click", bothConnect);
}

function mayItBeat() {
  tl.set([heart], {
      scale: .95,
    })
    .to([heart], .5, {
      scaleX: 1,
      scaleY: 1,
      ease: Elastic.easeOut.config(1, 0.3),
      repeat: -1,
      yoyo: true,
    }, '-=1.9');
}
            
          
!
999px
Loading ..................

Console