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

              
                <link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@100;200;400&display=swap" rel="stylesheet">

#index
  .bg
    .bg-left
    .bg-right

  .date.date-left
    span F
    span r
    span i
    span d
    span a
    span y
    span ,
    span S
    span e
    span p
    span t
    span
    span 2
    span 4
    span t
    span h
    span ,
    span 2
    span 1
    span :
    span 0
    span 0
    span -
    span 2
    span 3
    span :
    span 0
    span 0
    span ,
  .date.date-right
    span F
    span r
    span i
    span d
    span a
    span y
    span ,
    span S
    span e
    span p
    span t
    span
    span 2
    span 4
    span t
    span h
    span ,
    span 2
    span 1
    span :
    span 0
    span 0
    span -
    span 2
    span 3
    span :
    span 0
    span 0
    span ,
              
            
!

CSS

              
                html {
  font-size: 10px;
  overflow: hidden;
}

html,
body {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
}

body {
  position: relative;
}

::selection {
  background: transparent;
  color: transparent;
}

.tp-dfwv {
  z-index: 9;
  top: 94px;
  user-select: none;
}

.date {
  display: flex;
  z-index: 8;
  position: absolute;
  font-size: 20rem;
  color: #fff;
  letter-spacing: -0.08em;
  line-height: 1.25;
  user-select: none;
  font-family: 'Roboto Mono', monospace;
  font-weight: 400;
  // mix-blend-mode: difference;
  writing-mode: vertical-rl;
  white-space: nowrap;
}

.date span {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
}

.date-left {
  top: 0;
  left: -48px;
  color: #f1faee;
}

.date-right {
  top: 0;
  right: 190px;
  color: #e63946;
}

.bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  
  > div {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
  }
  
  &-left {
    left: 0;
    background-color: #e63946;
  }
  
  &-right {
    right: 0;
    background-color: #f1faee;
  }
}
              
            
!

JS

              
                // based on this code
// https://codepen.io/supah/pen/xxZMdNW

console.clear()

/*--------------------
Vars
--------------------*/
const $menu = document.getElementById('index')
const $items = document.querySelectorAll('.date-left span')
const $items2 = document.querySelectorAll('.date-right span')
let menuHeight = $menu.clientHeight
let itemHeight = $items[0].clientHeight
let wrapHeight = $items.length * itemHeight

let scrollSpeed = 0
let oldScrollY = 0
let scrollY = 0
let y = 0

/*--------------------
Lerp
--------------------*/
const lerp = (v0, v1, t) => {
  return v0 * ( 1 - t ) + v1 * t
}

/*--------------------
Dispose
--------------------*/
const dispose = (scroll) => {
  gsap.set($items, {
    y: (i) => {
      return i * itemHeight + scroll
    },
    modifiers: {
      y: (y) => {
        const s = gsap.utils.wrap(-itemHeight, wrapHeight - itemHeight, parseInt(y))
        return `${s}px`
      }
    }
  })
  gsap.set($items2, {
    y: (i) => {
      return i * itemHeight - scroll
    },
    modifiers: {
      y: (y) => {
        const s = gsap.utils.wrap(-itemHeight, wrapHeight - itemHeight, parseInt(y))
        return `${s}px`
      }
    }
  })
}
dispose(0)

/*--------------------
Wheel
--------------------*/
const handleMouseWheel = (e) => {
  scrollY -= e.deltaY
}

/*--------------------
Listeners
--------------------*/
$menu.addEventListener('mousewheel', handleMouseWheel)
$menu.addEventListener('selectstart', () => { return false })

/*--------------------
Resize
--------------------*/
window.addEventListener('resize', () => {
  menuHeight = $menu.clientHeight
  itemHeight = $items[0].clientHeight
  wrapHeight = $items.length * itemHeight
})

/*--------------------
Render
--------------------*/
const render = () => {
  requestAnimationFrame(render)
  y = lerp(y, scrollY, .1)
  dispose(y)

  scrollSpeed = y - oldScrollY
  oldScrollY = y

  gsap.to($items, {
    scale: 1 - Math.min(100, Math.abs(scrollSpeed)) * .005,
    rotate: scrollSpeed * 0.2,
    skewY: scrollSpeed * 0.8,
    skewX: scrollSpeed * 0.8,
  })

  gsap.to($items2, {
    scale: 1 - Math.min(100, Math.abs(scrollSpeed)) * .005,
    rotate: scrollSpeed * 0.2,
    skewY: scrollSpeed * 0.8,
    skewX: scrollSpeed * 0.8,
  })
}
render()

              
            
!
999px

Console