Scroll · 10 of 34

Skew In

Content slides in with a skew that relaxes to upright, like it is catching up to itself. A skewX plus translateX transition on one element.

HTML · CSS · JavaScript · No dependencies · MIT

HTML

<section class="skew-in-section">
  <h2>Skew In</h2>
</section>

CSS

.skew-in-section {
  min-height: 35vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.skew-in-section h2 {
  font-size: 2.5rem;
  color: #f0f0f5;
  opacity: 0;
  transform: skewX(-15deg);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.skew-in-section.in-view h2 {
  opacity: 1;
  transform: skewX(0);
}

JavaScript

var section = document.querySelector('.skew-in-section');

new IntersectionObserver(function (entries) {
  entries.forEach(function (entry) {
    entry.target.classList.toggle('in-view', entry.isIntersecting);
  });
}, { threshold: 0.25 }).observe(section);