Fantastic work with some really creative CSS Cascading Splitting text effects animations when scrolling. Great Text effect done using both Splitting.js and ScrollOut plugins
HTML Snippet
<div class="page">
<div class="text">Scroll for cascading text effects!</div>
<div class="text text--random" data-scroll="out" data-splitting="">Random</div>
<div class="text text--enter" data-scroll="out" data-splitting="">Enter</div>
<div class="text text--swapsies" data-scroll="out" data-splitting="">Swapsies</div>
<div class="text text--fading" data-scroll="out" data-splitting="">Fading</div>
<div class="text text--flipping" data-scroll="out" data-splitting="">Flipping</div>
<div class="text text--slide" data-scroll="out" data-splitting="">Slide</div>
<div class="text text--karaoke" data-scroll="out" data-splitting="">Karaoke</div>
<div class="text text--spinning" data-scroll="out" data-splitting="">Spinning</div>
<div class="text text--filling" data-scroll="out" data-splitting="">Filling</div>
<div class="text text--blocks" data-scroll="out" data-splitting="">Blocks</div>
<div class="text text--scaling" data-scroll="out" data-splitting="">Scaling</div>
<div class="text text--turning" data-scroll="out" data-splitting="">Turning</div>
<div class="text text--folding" data-scroll="out" data-splitting="">Folding</div>
<div class="text text--bulge" data-scroll="out" data-splitting="">Bulge</div>
<div class="text text--tumbling" data-scroll="out" data-splitting="">Tumbling</div>
<div class="text text--rolling" data-scroll="out" data-splitting="">Rolling</div>
<div class="text text--perspective" data-scroll="out" data-splitting="">Perspective</div>
<div class="text text--zipping" data-scroll="out" data-splitting="">Zipping</div>
<div class="text text--swinging" data-scroll="out" data-splitting="">Swinging</div>
<div class="text text--bubbling" data-scroll="out" data-splitting="">Bubbling</div>
<div class="text text--blowing" data-scroll="out" data-splitting="">Blowing</div>
<div class="text text--meeting" data-scroll="out" data-splitting="">Meeting</div>
<div class="text text--conveyor" data-scroll="out" data-splitting="">Conveyor</div>
</div>
CSS Code
@import url("https://fonts.googleapis.com/css?family=Lato:700");
* {
box-sizing: border-box;
}
body {
font-family: 'Lato', sans-serif;
margin: 0;
padding: 0;
}
.page {
height: 100vh;
overflow: auto;
}
.text {
align-items: center;
color: #fff;
display: flex;
font-size: 3rem;
height: 100vh;
justify-content: center;
overflow: hidden;
text-align: center;
width: 100vw;
}
@media (min-width: 768px) {
.text {
font-size: 5rem;
}
}
.text:nth-child(n) {
background: #7e05d7;
}
.text:nth-child(2n) {
background: #f21e56;
}
.text:nth-child(3n) {
background: #bd04a9;
}
.text .char {
display: inline-block;
-webkit-animation-delay: calc(0.25s + var(--char-index) * 0.1s);
animation-delay: calc(0.25s + var(--char-index) * 0.1s);
transition: all 0.25s calc(0.25s + var(--char-index) * 0.1s);
}
.text--enter [data-scroll='out'] .char {
opacity: 0;
-webkit-transform: translate(0, -150%);
transform: translate(0, -150%);
}
.text--enter .char {
opacity: 1;
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
.text--random [data-scroll='out'] .char:nth-of-type(1) {
-webkit-transform: translateX(-41%) translateY(126%);
transform: translateX(-41%) translateY(126%);
}
.text--random [data-scroll='out'] .char:nth-of-type(2) {
-webkit-transform: translateX(236%) translateY(-83%);
transform: translateX(236%) translateY(-83%);
}
.text--random [data-scroll='out'] .char:nth-of-type(3) {
-webkit-transform: translateX(120%) translateY(-137%);
transform: translateX(120%) translateY(-137%);
}
.text--random [data-scroll='out'] .char:nth-of-type(4) {
-webkit-transform: translateX(230%) translateY(192%);
transform: translateX(230%) translateY(192%);
}
.text--random [data-scroll='out'] .char:nth-of-type(5) {
-webkit-transform: translateX(-99%) translateY(-31%);
transform: translateX(-99%) translateY(-31%);
}
.text--random [data-scroll='out'] .char:nth-of-type(6) {
-webkit-transform: translateX(-197%) translateY(94%);
transform: translateX(-197%) translateY(94%);
}
.text--swapsies [data-scroll='in'] .char:nth-of-type(odd),
.text--swapsies [data-scroll='out'] .char:nth-of-type(odd) {
-webkit-transform: translateX(100%);
transform: translateX(100%);
}
.text--swapsies [data-scroll='in'] .char:nth-of-type(even),
.text--swapsies [data-scroll='out'] .char:nth-of-type(even) {
-webkit-transform: translateX(-100%);
transform: translateX(-100%);
}
.text--swapsies [data-scroll='in'] .char {
-webkit-animation-duration: 0.5s;
animation-duration: 0.5s;
-webkit-animation-fill-mode: forwards;
animation-fill-mode: forwards;
}
.text--swapsies [data-scroll='in'] .char:nth-of-type(odd) {
-webkit-animation-name: swap-left;
animation-name: swap-left;
}
.text--swapsies [data-scroll='in'] .char:nth-of-type(even) {
-webkit-animation-name: swap-right;
animation-name: swap-right;
}
@-webkit-keyframes swap-right {
25% {
-webkit-transform: translateX(-100%) translateY(-100%);
transform: translateX(-100%) translateY(-100%);
}
75% {
-webkit-transform: translateX(0) translateY(-100%);
transform: translateX(0) translateY(-100%);
}
100% {
-webkit-transform: translateX(0) translateY(0);
transform: translateX(0) translateY(0);
}
}
@keyframes swap-right {
25% {
-webkit-transform: translateX(-100%) translateY(-100%);
transform: translateX(-100%) translateY(-100%);
}
75% {
-webkit-transform: translateX(0) translateY(-100%);
transform: translateX(0) translateY(-100%);
}
100% {
-webkit-transform: translateX(0) translateY(0);
transform: translateX(0) translateY(0);
}
}
@-webkit-keyframes swap-left {
25% {
-webkit-transform: translateX(100%) translateY(100%);
transform: translateX(100%) translateY(100%);
}
75% {
-webkit-transform: translateX(0) translateY(100%);
transform: translateX(0) translateY(100%);
}
100% {
-webkit-transform: translateX(0) translateY(0);
transform: translateX(0) translateY(0);
}
}
@keyframes swap-left {
25% {
-webkit-transform: translateX(100%) translateY(100%);
transform: translateX(100%) translateY(100%);
}
75% {
-webkit-transform: translateX(0) translateY(100%);
transform: translateX(0) translateY(100%);
}
100% {
-webkit-transform: translateX(0) translateY(0);
transform: translateX(0) translateY(0);
}
}
.text--fading [data-scroll='out'] .char {
opacity: 0;
}
.text--flipping [data-scroll='out'] .char {
-webkit-transform: rotateY(180deg);
transform: rotateY(180deg);
}
.text--slide .char {
transition-delay: calc((var(--char-total) - var(--char-index)) * 0.1s);
}
.text--slide [data-scroll='out'] .char {
opacity: 0;
-webkit-transform: translate(-300%, 0) skewX(20deg);
transform: translate(-300%, 0) skewX(20deg);
}
.text--karaoke .char {
color: rgba(255,255,255,0.15);
transition-duration: 0.1s;
}
.text--karaoke .char:after {
color: #fff;
visibility: visible;
}
.text--karaoke [data-scroll='in'] .char:after {
-webkit-clip-path: inset(0 0 0 0);
clip-path: inset(0 0 0 0);
}
.text--karaoke [data-scroll='out'] .char:after {
-webkit-clip-path: inset(0 100% 0 0);
clip-path: inset(0 100% 0 0);
}
.text--filling .char {
color: rgba(255,255,255,0.15);
}
.text--filling .char:after {
color: #fff;
visibility: visible;
}
.text--filling [data-scroll='in'] .char:after {
-webkit-clip-path: inset(0 0 0 0);
clip-path: inset(0 0 0 0);
}
.text--filling [data-scroll='out'] .char:after {
-webkit-clip-path: inset(100% 0 0 0);
clip-path: inset(100% 0 0 0);
}
.text--blocks [data-scroll='out'] .char {
visibility: hidden;
}
.text--blocks [data-scroll='in'] {
overflow: hidden;
position: relative;
}
.text--blocks [data-scroll='in'] .char {
transition-delay: 0.5s;
}
.text--blocks [data-scroll='in']:after {
content: '';
height: 100%;
width: 100%;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: #fff;
-webkit-animation: block 0.5s 0.25s both;
animation: block 0.5s 0.25s both;
}
@-webkit-keyframes block {
0% {
-webkit-transform: translate(-110%, 0);
transform: translate(-110%, 0);
}
45%, 55% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
100% {
-webkit-transform: translate(110%, 0);
transform: translate(110%, 0);
}
}
@keyframes block {
0% {
-webkit-transform: translate(-110%, 0);
transform: translate(-110%, 0);
}
45%, 55% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
100% {
-webkit-transform: translate(110%, 0);
transform: translate(110%, 0);
}
}
.text--scaling [data-scroll='out'] .char {
-webkit-transform: scale(0);
transform: scale(0);
}
.text--turning [data-scroll='out'] .char {
-webkit-transform: rotateY(90deg);
transform: rotateY(90deg);
}
.text--folding [data-scroll='out'] .char {
-webkit-transform: rotateX(90deg);
transform: rotateX(90deg);
-webkit-transform-origin: bottom;
transform-origin: bottom;
}
.text--bulge [data-scroll='in'] .char {
-webkit-animation-name: bulge;
animation-name: bulge;
-webkit-animation-duration: 0.25s;
animation-duration: 0.25s;
}
@-webkit-keyframes bulge {
50% {
-webkit-transform: scale(1.5);
transform: scale(1.5);
}
}
@keyframes bulge {
50% {
-webkit-transform: scale(1.5);
transform: scale(1.5);
}
}
.text--perspective {
-webkit-perspective: 1000px;
perspective: 1000px;
}
.text--perspective .char {
transition: opacity 0.05s calc(0.25s + var(--char-index) * 0.1s), -webkit-transform 0.25s calc(0.25s + var(--char-index) * 0.1s);
transition: transform 0.25s calc(0.25s + var(--char-index) * 0.1s), opacity 0.05s calc(0.25s + var(--char-index) * 0.1s);
transition: transform 0.25s calc(0.25s + var(--char-index) * 0.1s), opacity 0.05s calc(0.25s + var(--char-index) * 0.1s), -webkit-transform 0.25s calc(0.25s + var(--char-index) * 0.1s);
}
.text--perspective [data-scroll='out'] .char {
opacity: 0;
-webkit-transform: translate3d(-25px, -20px, -800px);
transform: translate3d(-25px, -20px, -800px);
}
.text--zipping .char {
transition: opacity 0.05s calc(0.25s + var(--char-index) * 0.1s), -webkit-transform 0.25s calc(0.25s + var(--char-index) * 0.1s);
transition: transform 0.25s calc(0.25s + var(--char-index) * 0.1s), opacity 0.05s calc(0.25s + var(--char-index) * 0.1s);
transition: transform 0.25s calc(0.25s + var(--char-index) * 0.1s), opacity 0.05s calc(0.25s + var(--char-index) * 0.1s), -webkit-transform 0.25s calc(0.25s + var(--char-index) * 0.1s);
}
.text--zipping [data-scroll='out'] .char {
opacity: 0;
}
.text--zipping [data-scroll='out'] .char:nth-of-type(odd) {
-webkit-transform: translate(0, -100%);
transform: translate(0, -100%);
}
.text--zipping [data-scroll='out'] .char:nth-of-type(even) {
-webkit-transform: translate(0, 100%);
transform: translate(0, 100%);
}
.text--spinning [data-scroll='out'] .char {
-webkit-transform: rotateY(-360deg);
transform: rotateY(-360deg);
}
.text--tumbling .char {
transition-delay: calc((var(--char-total) - var(--char-index)) * 0.1s);
}
.text--tumbling [data-scroll='out'] .char {
opacity: 0;
-webkit-transform: translate(-300%, -50%) rotate(1080deg) scale(0);
transform: translate(-300%, -50%) rotate(1080deg) scale(0);
}
.text--bubbling .char {
transition-timing-function: cubic-bezier(0.75, -2, 0.75, 2);
}
.text--bubbling .char:nth-of-type(1) {
transition-delay: 0.7s;
}
.text--bubbling .char:nth-of-type(2) {
transition-delay: 0.3s;
}
.text--bubbling .char:nth-of-type(3) {
transition-delay: 0.2s;
}
.text--bubbling .char:nth-of-type(4) {
transition-delay: 0.5s;
}
.text--bubbling .char:nth-of-type(5) {
transition-delay: 0.6s;
}
.text--bubbling .char:nth-of-type(6) {
transition-delay: 0.7s;
}
.text--bubbling .char:nth-of-type(7) {
transition-delay: 0.6s;
}
.text--bubbling .char:nth-of-type(8) {
transition-delay: 0.6s;
}
.text--bubbling [data-scroll='out'] .char {
-webkit-transform: scale(0.5);
transform: scale(0.5);
}
.text--swinging .char {
-webkit-transform-origin: calc((var(--char-total) - var(--char-index)) * 100%) -100%;
transform-origin: calc((var(--char-total) - var(--char-index)) * 100%) -100%;
transition-delay: calc((var(--char-total) - var(--char-index)) * 0.1s);
}
.text--swinging [data-scroll='out'] .char {
opacity: 0;
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
}
.text--rolling .char {
transition: opacity 0.2s, -webkit-transform 1s;
transition: transform 1s, opacity 0.2s;
transition: transform 1s, opacity 0.2s, -webkit-transform 1s;
transition-delay: calc((var(--char-total) - var(--char-index)) * 0.1s);
}
.text--rolling [data-scroll='out'] .char {
opacity: 0;
-webkit-transform: translate(-500%, 0) scale(0) rotate(-1440deg);
transform: translate(-500%, 0) scale(0) rotate(-1440deg);
}
.text--blowing .char {
-webkit-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
-webkit-transform-origin: left bottom;
transform-origin: left bottom;
-webkit-animation-delay: calc(var(--char-index) * 0.025s);
animation-delay: calc(var(--char-index) * 0.025s);
}
.text--blowing [data-scroll='in'] .char {
-webkit-animation-name: blowing;
animation-name: blowing;
}
@-webkit-keyframes blowing {
50%, 60%, 70% {
-webkit-transform: skewX(-35deg);
transform: skewX(-35deg);
}
55%, 65%, 75% {
-webkit-transform: skewX(-40deg);
transform: skewX(-40deg);
}
}
@keyframes blowing {
50%, 60%, 70% {
-webkit-transform: skewX(-35deg);
transform: skewX(-35deg);
}
55%, 65%, 75% {
-webkit-transform: skewX(-40deg);
transform: skewX(-40deg);
}
}
.text--meeting .char {
transition-delay: calc((var(--char-total) - var(--char-index)) * 0.1s);
}
.text--meeting .char:nth-of-type(even) {
-webkit-transform-origin: top right;
transform-origin: top right;
}
.text--meeting .char:nth-of-type(odd) {
-webkit-transform-origin: bottom left;
transform-origin: bottom left;
}
.text--meeting [data-scroll='out'] .char {
-webkit-transform: rotate(180deg);
transform: rotate(180deg);
}
.text--conveyor [data-scroll='in'] .char {
-webkit-transform-origin: left bottom;
transform-origin: left bottom;
-webkit-animation: convey 1s both linear;
animation: convey 1s both linear;
-webkit-animation-delay: calc((var(--char-total) - var(--char-index)) * 0.15s);
animation-delay: calc((var(--char-total) - var(--char-index)) * 0.15s);
transition: none;
}
@-webkit-keyframes convey {
0% {
-webkit-transform: translate(calc((var(--char-total) - (var(--char-total) - var(--char-index))) * -100%), 0) rotate(-180deg) translate(calc((var(--char-total) - var(--char-index)) * -100%), 0);
transform: translate(calc((var(--char-total) - (var(--char-total) - var(--char-index))) * -100%), 0) rotate(-180deg) translate(calc((var(--char-total) - var(--char-index)) * -100%), 0);
}
40% {
-webkit-transform: translate(calc((var(--char-total) - (var(--char-total) - var(--char-index))) * -100%), 0) rotate(-180deg) translate(0, 0);
transform: translate(calc((var(--char-total) - (var(--char-total) - var(--char-index))) * -100%), 0) rotate(-180deg) translate(0, 0);
}
50% {
-webkit-transform: translate(calc((var(--char-total) - (var(--char-total) - var(--char-index))) * -100%), 0) rotate(0deg) translate(0, 0);
transform: translate(calc((var(--char-total) - (var(--char-total) - var(--char-index))) * -100%), 0) rotate(0deg) translate(0, 0);
}
100% {
-webkit-transform: translate(0, 0) rotate(0deg) translate(0, 0);
transform: translate(0, 0) rotate(0deg) translate(0, 0);
}
}
@keyframes convey {
0% {
-webkit-transform: translate(calc((var(--char-total) - (var(--char-total) - var(--char-index))) * -100%), 0) rotate(-180deg) translate(calc((var(--char-total) - var(--char-index)) * -100%), 0);
transform: translate(calc((var(--char-total) - (var(--char-total) - var(--char-index))) * -100%), 0) rotate(-180deg) translate(calc((var(--char-total) - var(--char-index)) * -100%), 0);
}
40% {
-webkit-transform: translate(calc((var(--char-total) - (var(--char-total) - var(--char-index))) * -100%), 0) rotate(-180deg) translate(0, 0);
transform: translate(calc((var(--char-total) - (var(--char-total) - var(--char-index))) * -100%), 0) rotate(-180deg) translate(0, 0);
}
50% {
-webkit-transform: translate(calc((var(--char-total) - (var(--char-total) - var(--char-index))) * -100%), 0) rotate(0deg) translate(0, 0);
transform: translate(calc((var(--char-total) - (var(--char-total) - var(--char-index))) * -100%), 0) rotate(0deg) translate(0, 0);
}
100% {
-webkit-transform: translate(0, 0) rotate(0deg) translate(0, 0);
transform: translate(0, 0) rotate(0deg) translate(0, 0);
}
}
JavaScript Snippet
var _window = window,Splitting = _window.Splitting,ScrollOut = _window.ScrollOut;
Splitting();
ScrollOut({
targets: '.word',
scrollingElement: '.page' });
Leave a Reply