Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                section#mv
  .l-wrapper
    .text 
      | I'am 
      br
      | SUPER HERO 
      br
      | MAIN VISUAL

section#list
  .l-wrapper
    .title SUPER LIST
    ul.list
      li.list-child SUPER CARD
      li.list-child SUPER CARD
      li.list-child SUPER CARD

section#list-asynmmetric
  .l-wrapper
    ul.list
      li.list-child.list-child-type1
        figure.img-area
          img(src="https://assets.codepen.io/256691/1.webp")
        article.text-area
          .title SUPER LIST CHILD title goes here
          p.text SUPER LIST CHILD text goes here, SUPER LIST CHILD text goes here, SUPER LIST CHILD text goes here, SUPER LIST CHILD text goes here.
      li.list-child.list-child-type2
        figure.img-area
          img(src="https://assets.codepen.io/256691/1.webp")
        article.text-area
          .title SUPER LIST CHILD title goes here
          p.text SUPER LIST CHILD text goes here, SUPER LIST CHILD text goes here, SUPER LIST CHILD text goes here, SUPER LIST CHILD text goes here.
          
section#conversion
  .l-wrapper
    a(href="") 
      | SUPER CONVERSION
      br
      | LIKE 
      br
      | METEOR STRIKE
  
footer#footer
  .l-wrapper
    .text SUPER HERO FOOTER
    .copyright &copy; SUPER COPYRIGHT
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@300;400;700&display=swap');

.tp-dfwv {
  position: fixed !important;
}

html {
  font-size: 10px;
}

body {
  font-family: 'Merriweather', serif;
}

section {
  min-height: 100vh;
}

#mv {
  position: relative;
  min-height: 70vh;
  background-color: #ccc;
  
  .text {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    transform: translate(0%, -50%);
    font-weight: 700;
    font-size: 8rem;
    text-align: center;
  }
}

#list {
  display: none;
  background-color: #ccc;
  padding-bottom: 80px;
  box-sizing: border-box;
  
  .title {
    font-size: 3rem;
    text-align: center;
    padding: 80px 0 50px;
  }
  
  .list {
    display: flex;
    justify-content: center;
    width: 70vw;
    margin: 0 auto;
    transform: translateX(-15px);
    
    &-child {
      display: flex;
      justify-content: center;
      align-items: center;
      width: calc(33.3% - 30px);
      margin-left: 30px;
      height: 25vw;
      background-color: #fff;
      font-size: 1.3rem;
    }
  }
}

#list-asynmmetric {
  padding: 100px 0;
  overflow: hidden;
  
  .list {
    max-width: 80vw;
    margin: 0 auto;
    
    &-child {
      position: relative;
      display: flex;
      width: 100%;
      margin-bottom: 150px;
      
      &-type1 {
        .text-area {
          bottom: -60px;
          right: 0;
        }
      }
      
      &-type2 {
        justify-content: flex-end;
        margin-bottom: 600px;
        
        .text-area {
          bottom: -60px;
          left: 0;
        }
      }
      
      .img-area {
        width: 60vw;
        
        img {
          width: 100%;
          height: auto;
        }
      }
      
      .text-area {
        position: absolute;
        width: 30vw;
        
        .title {
          display: inline-block;
          font-weight: 400;
          font-size: 2rem;
          color: #ccc;
          margin-bottom: 30px;
          background-color: #000;
        }
        
        .text {
          display: inline-block;
          font-weight: 100;
          font-size: 1.5rem;
          line-height: 1.5;
          color: #ccc;
          background-color: #000;
          text-align: justify !important;
          text-justify: inter-ideograph !important;
        }
      }
    }
  }
}

#conversion {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80vh;
  background-color: #ccc;
  box-sizing: border-box;
  
  a {
    display: block;
    font-weight: 700;
    font-size: 5rem;
    text-align: center;
    color: #000;
  }
}

#footer {
  height: 200px;
  
  .l-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 80vw;
    margin: 0 auto;
    height: 100%;
  }
  
  .text {
    font-weight: 100;
    font-size: 1.5rem;
    line-height: 1;
    color: #000;
  }
  
  .copyright {
    font-size: 1rem;
    line-height: 1;
  }
}
              
            
!

JS

              
                console.clear()

import {Pane} from "https://cdn.skypack.dev/tweakpane@3.0.5";
import * as EssentialsPlugin from "https://cdn.skypack.dev/@tweakpane/plugin-essentials@0.1.2"


/**
* set tweakpane
*/
const PARAMS = {
  duration: 1.88,
  cubicBezier: true,
  ease: 'Power2.easeOut'
};

const pane = new Pane()
pane.registerPlugin(EssentialsPlugin)

pane.addInput(PARAMS, 'duration', {
  min: 0.2, max: 3.0,
})

pane.addInput(PARAMS, 'cubicBezier')
const cubicBezier = pane.addBlade({
  view: 'cubicbezier',
  value: [0.2, 1.0, 0.25, 1.0],

  expanded: true,
  label: 'cubicBezier',
  picker: 'inline',
})

let ceVal = CustomEase.create("CustomEase", 
      cubicBezier.value.comps_[0] + ',' +
      cubicBezier.value.comps_[1] + ',' +
      cubicBezier.value.comps_[2] + ',' +
      cubicBezier.value.comps_[3] + ','
    )

pane.addInput(PARAMS, 'ease', {
  options: {
    'Strong.easeInOut': 'Strong.easeInOut',
    'Linear.easeNone': 'Linear.easeNone',
    'Power0.easeIn': 'Power0.easeIn',
    'Power1.easeIn': 'Power1.easeIn',
    'Power2.easeIn': 'Power2.easeIn',
    'Power3.easeIn': 'Power3.easeIn',
    'Power4.easeIn': 'Power4.easeIn',
    'Quad.easeIn': 'Quad.easeIn',
    'Cubic.easeIn': 'Cubic.easeIn',
    'Quart.easeIn': 'Quart.easeIn',
    'Quint.easeIn': 'Quint.easeIn',
    'Elastic.easeIn': 'Elastic.easeIn',
    'Back.easeIn': 'Back.easeIn',
    'Bounce.easeIn': 'Bounce.easeIn',
    'SlowMo.easeIn': 'SlowMo.easeIn',
    'SteppedEase.easeIn': 'SteppedEase.easeOut',
    'Circ.easeIn': 'Circ.easeIn',
    'Expo.easeIn': 'Expo.easeIn',
    'Sine.easeIn': 'Sine.easeIn',
    'Power0.easeOut': 'Power0.easeOut',
    'Power1.easeOut': 'Power1.easeOut',
    'Power2.easeOut': 'Power2.easeOut',
    'Power3.easeOut': 'Power3.easeOut',
    'Power4.easeOut': 'Power4.easeOut',
    'Quad.easeOut': 'Quad.easeOut',
    'Cubic.easeOut': 'Cubic.easeOut',
    'Quart.easeOut': 'Quart.easeOut',
    'Quint.easeOut': 'Quint.easeOut',
    'Elastic.easeOut': 'Elastic.easeOut',
    'Back.easeOut': 'Back.easeOut',
    'Bounce.easeOut': 'Bounce.easeOut',
    'SlowMo.easeOut': 'SlowMo.easeOut',
    'SteppedEase.easeOut': 'SteppedEase.easeOut',
    'Circ.easeOut': 'Circ.easeOut',
    'Expo.easeOut': 'Expo.easeOut',
    'Sine.easeOut': 'Sine.easeOut',
    'Power0.easeInOut': 'Power0.easeInOut',
    'Power1.easeInOut': 'Power1.easeInOut',
    'Power2.easeInOut': 'Power2.easeInOut',
    'Power3.easeInOut': 'Power3.easeInOut',
    'Power4.easeInOut': 'Power4.easeInOut',
    'Quad.easeInOut': 'Quad.easeInOut',
    'Cubic.easeInOut': 'Cubic.easeInOut',
    'Quart.easeInOut': 'Quart.easeInOut',
    'Quint.easeInOut': 'Quint.easeInOut',
    'Elastic.easeInOut': 'Elastic.easeInOut',
    'Back.easeInOut': 'Back.easeInOut',
    'Bounce.easeInOut': 'Bounce.easeInOut',
    'SlowMo.easeInOut': 'SlowMo.easeInOut',
    'SteppedEase.easeInOut': 'SteppedEase.easeInOut',
    'Circ.easeInOut': 'Circ.easeInOut',
    'Expo.easeInOut': 'Expo.easeInOut',
    'Sine.easeInOut': 'Sine.easeInOut'
  }}
)

const btn = pane.addButton({
  title: 'Change Ease & Dur'
})

/*
* Scroll
*/
const target1 = document.querySelector('#list-asynmmetric .list-child-type1')
const target2 = document.querySelector('#list-asynmmetric .list-child-type2')
let tl
let tl2

change()
btn.on('click', change)

function change() {
  if(tl && tl2) {
    reset()
  }
  
  ceVal = CustomEase.create("CustomEase", 
      cubicBezier.value.comps_[0] + ',' +
      cubicBezier.value.comps_[1] + ',' +
      cubicBezier.value.comps_[2] + ',' +
      cubicBezier.value.comps_[3] + ','
    )
  const ease = PARAMS.cubicBezier ? ceVal : PARAMS.ease

  // toggleActions: onEnter onLeave onEnterBack onLeaveBack
  // onEnter - scrolling down, start meets scroller-start
  // onLeave - scrolling down, end meets scroller-end
  // onEnterBack - scrolling up, end meets scroller-end
  // onLeaveBack - scrolling up, start meets scroller-start

  tl = gsap.timeline({
    scrollTrigger: {
      trigger: target1,
      start: 'top top',
      markers: true,
      toggleActions: "play none none reverse"
    }
  })
  tl.to(target1, {
    duration: PARAMS.duration,
    x: -(target1.clientWidth) * 1.5,
    y: -(target1.clientHeight) * 1.5,
    ease: ease,
  })

  gsap.set(target2, {
    marginTop: -target2.clientHeight,
  })
  tl2 = gsap.timeline({
    scrollTrigger: {
      trigger: target1,
      start: 'top top',
      markers: true,
      toggleActions: "play none none reverse"
    }
  })
  tl2.set(document.body, {overflow: ""})
  tl2.set(document.body, {overflow: "hidden"})
  tl2.from(target2, {
    duration: PARAMS.duration,
    x: target2.clientWidth * 1.5,
    y: target2.clientHeight * 1.5,
    ease: ease,
  })
  tl2.set(document.body, {overflow: ""})
}

function reset() {
  window.scrollTo(0, 0)
  gsap.set(document.body, {overflow: ""})
  gsap.set(target1, {clearProps: 'all'})
  gsap.set(target2, {clearProps: 'all'})
  
  tl.clear()
  tl2.clear()
}
              
            
!
999px

Console