A Pen by Amit Sheen on CodePen.
Created
July 29, 2021 11:10
-
-
Save Joseph-Reece/ef7ae44e5f13f82e7f2beb4184544c50 to your computer and use it in GitHub Desktop.
CSS morphing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="morphing"> | |
<div class="word">Word</div> | |
<div class="word">morphing</div> | |
<div class="word">with</div> | |
<div class="word">pure</div> | |
<div class="word">CSS</div> | |
<div class="word">is</div> | |
<div class="word">great!</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://assets.codepen.io/1948355/twitterButton-2.1.0.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import url('https://fonts.googleapis.com/css2?family=Roboto+Slab&display=swap'); | |
*, *::before, *::after { | |
padding: 0; | |
margin: 0 auto; | |
box-sizing: border-box; | |
} | |
body { | |
font-family: 'Roboto Slab', serif; | |
} | |
$speed: 16s; | |
$wordCount: 7; | |
.morphing { | |
position: relative; | |
font-size: 120px; | |
background-color: #000; | |
color: #fff; | |
min-height: 100vh; | |
filter: contrast(25) blur(1px); | |
} | |
.word { | |
position: absolute; | |
top: 50%; left: 50%; | |
transform: translate(-50%, -50%); | |
animation: word $speed infinite ease-in-out; | |
@for $i from 0 to $wordCount { | |
&:nth-child(#{$i + 1}) { | |
animation-delay: ($speed / ($wordCount + 1) * $i) - $speed; | |
} | |
} | |
@keyframes word { | |
0%, 5%, 100% { filter: blur(0px); opacity: 1; } | |
20%, 80% { filter: blur(1em); opacity: 0; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment