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

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

              
                .app
  .container
    .heart
    .eye
      .eye__piece.eye__piece--curved
      .eye__piece.eye__piece--straight
    .mouth
  .cloak
              
            
!

CSS

              
                *
  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)
              
            
!

JS

              
                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

Console