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.

            
              .app
  .container
    .heart
    .eye
      .eye__piece.eye__piece--curved
      .eye__piece.eye__piece--straight
    .mouth
  .cloak
            
          
!
            
              *
  box-sizing border-box


body
  min-height 100vh
  background #111
  margin 0
  padding 0

.app
  position absolute
  top 0
  right 0
  bottom 0
  left 0
  overflow hidden

.cloak
  height 400vh
  width 100vw
  transform translate(0, 100%)
  background linear-gradient(180deg, white, white 50%, #111 50%)
  position absolute
  top 0
  z-index 2

.container
  width 300px
  height 160px
  position absolute
  top 50%
  left 50%
  transform translate(-50%, -50%)
  z-index 2

.mouth
  position absolute
  bottom 0
  height 20px
  width 100%
  background #fff
  transform scaleX(0.5)

.eye
  height 70px
  width 70px
  position absolute
  left 175px

  &__piece
    height 105%
    width 30%
    background #fff
    position absolute
    top 50%
    left 50%
    transform translate(-50%, -50%) rotate(-45deg)

    &--curved
      border-radius 20px
      height 120%
      transform translate(-50%, -50%) rotate(45deg)

.heart
  height 68px
  width 76px
  position absolute
  left 55px

  &:after
  &:before
    content ''
    height 100%
    width 50%
    background #fff
    position absolute
    top 50%
    left 50%
    transform translate(-50%, -50%) rotate(42deg) translate(4px, -8px)
    border-radius 20px 20px 0 0/20px 20px 0 0
    $clip = polygon(0 0, 100% 0, 100% 100%, 0 94%)
    -webkit-clip-path $clip
    clip-path $clip

  &:before
    transform translate(-50%, -50%) rotate(42deg) translate(4px, -8px) rotate(-84deg) rotateY(180deg) translate(13px, -12px)
            
          
!
            
              const { TimelineMax, TweenMax } = window
const heart = document.querySelector('.heart')
const eye = document.querySelector('.eye')
const straight = document.querySelector('.eye__piece--straight')
const curved = document.querySelector('.eye__piece--curved')
const mouth = document.querySelector('.mouth')
const cloak = document.querySelector('.cloak')

const timeline = new TimelineMax({ delay: 1, repeat: -1, repeatDelay: 1 })

const beat = delay =>
  new TimelineMax({ delay })
    .to(heart, 0.1, { scale: 0.85 })
    .to(heart, 0.1, { scale: 0.95 })
    .to(heart, 0.1, { scale: 0.85 })
    .to(heart, 0.1, { scale: 1 })

const rotate = () =>
  new TimelineMax()
    .to(eye, 0.4, { rotation: 45 })
    .to(eye, 0.4, { rotation: 90 })
    .to(eye, 0.4, { rotation: 135 })
    .to(eye, 0.4, { rotation: 180 })

timeline
  .add(TweenMax.from(heart, 0.15, { scale: 0 }))
  .add(beat(), 1.2)
  .add(beat(0.25))
  .add(beat(0), 3.6)
  .add(TweenMax.from(straight, 0.3, { x: -innerWidth, y: -innerWidth }), 0.9)
  .add(TweenMax.from(curved, 0.3, { x: innerWidth, y: -innerWidth }), 1.1)
  .add(rotate(), 2.75)
  .add(TweenMax.from(mouth, 0.3, { scaleX: 1, x: -innerWidth }), 2.75)
  .add(TweenMax.to(mouth, 0.25, { scaleX: 1 }, 3.4))
  .add(TweenMax.to(mouth, 0.25, { height: innerHeight }))
  .add(TweenMax.to(cloak, 0.5, { y: '-50%' }), 4.8)

            
          
!
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.

Console