A Pen by Joseph Fusco on CodePen.
Last active
January 25, 2022 20:36
-
-
Save josephfusco/901898d7f180b93ea05b to your computer and use it in GitHub Desktop.
iMessage Typing Indicator
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
.typing-indicator { | |
background-color: #E6E7ED; | |
width: auto; | |
border-radius: 50px; | |
padding: 20px; | |
display: table; | |
margin: 0 auto; | |
position: relative; | |
-webkit-animation: 2s bulge infinite ease-out; | |
animation: 2s bulge infinite ease-out; | |
} | |
.typing-indicator:before, .typing-indicator:after { | |
content: ''; | |
position: absolute; | |
bottom: -2px; | |
left: -2px; | |
height: 20px; | |
width: 20px; | |
border-radius: 50%; | |
background-color: #E6E7ED; | |
} | |
.typing-indicator:after { | |
height: 10px; | |
width: 10px; | |
left: -10px; | |
bottom: -10px; | |
} | |
.typing-indicator span { | |
height: 15px; | |
width: 15px; | |
float: left; | |
margin: 0 1px; | |
background-color: #9E9EA1; | |
display: block; | |
border-radius: 50%; | |
opacity: 0.4; | |
} | |
.typing-indicator span:nth-of-type(1) { | |
-webkit-animation: 1s blink infinite 0.3333s; | |
animation: 1s blink infinite 0.3333s; | |
} | |
.typing-indicator span:nth-of-type(2) { | |
-webkit-animation: 1s blink infinite 0.6666s; | |
animation: 1s blink infinite 0.6666s; | |
} | |
.typing-indicator span:nth-of-type(3) { | |
-webkit-animation: 1s blink infinite 0.9999s; | |
animation: 1s blink infinite 0.9999s; | |
} | |
@-webkit-keyframes blink { | |
50% { | |
opacity: 1; | |
} | |
} | |
@keyframes blink { | |
50% { | |
opacity: 1; | |
} | |
} | |
@-webkit-keyframes bulge { | |
50% { | |
-webkit-transform: scale(1.05); | |
transform: scale(1.05); | |
} | |
} | |
@keyframes bulge { | |
50% { | |
-webkit-transform: scale(1.05); | |
transform: scale(1.05); | |
} | |
} | |
html { | |
display: table; | |
height: 100%; | |
width: 100%; | |
} | |
body { | |
display: table-cell; | |
vertical-align: middle; | |
} |
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="typing-indicator"> | |
<span></span> | |
<span></span> | |
<span></span> | |
</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
.typing-indicator { | |
$ti-color-bg: #E6E7ED; | |
background-color: $ti-color-bg; | |
width: auto; | |
border-radius: 50px; | |
padding: 20px; | |
display: table; | |
margin: 0 auto; | |
position: relative; | |
animation: 2s bulge infinite ease-out; | |
&:before, &:after { | |
content: ''; | |
position: absolute; | |
bottom: -2px; | |
left: -2px; | |
height: 20px; | |
width: 20px; | |
border-radius: 50%; | |
background-color: $ti-color-bg; | |
} | |
&:after { | |
height: 10px; | |
width: 10px; | |
left: -10px; | |
bottom: -10px; | |
} | |
span { | |
height: 15px; | |
width: 15px; | |
float: left; | |
margin: 0 1px; | |
background-color: #9E9EA1; | |
display: block; | |
border-radius: 50%; | |
opacity: 0.4; | |
@for $i from 1 through 3 { | |
&:nth-of-type(#{$i}){ | |
animation: 1s blink infinite ($i * .3333s); | |
} | |
} | |
} | |
} | |
@keyframes blink{ | |
50% { | |
opacity: 1; | |
} | |
} | |
@keyframes bulge{ | |
50% { | |
transform: scale(1.05); | |
} | |
} | |
// vertically center demo | |
html { | |
display: table; | |
height: 100%; | |
width: 100%; | |
} | |
body { | |
display: table-cell; | |
vertical-align: middle; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment