Loading animations
Just some ideas for how to handle element loading feedback using animations. Each animation has only 1 or 2 elements, and most have no javascript. This is absolutely a work in progress.
-
Inline - Simple
-
<div class="loading"></div>@keyframes left-right { from {left: 0} to {left: calc(100% - 12px)} } .loading { width: 100%; height: 1px; border-bottom: 1px solid #C95B36; position: relative; } .loading::before { content:''; width: 12px; height: 12px; border-radius: 6px; background: #C95B36; position: absolute; left: 0; bottom: -7px; animation: linear alternate infinite 3s; } -
Inline with "spark"
-
<div class="loading"></div>@keyframes left-right { from {left: 0} to {left: calc(100% - 12px)} } .loading { width: 100%; height: 1px; border-bottom: 1px solid #C95B36; position: relative; } .loading::before { content:''; width: 4px; height: 4px; border-radius: 8px; background: white; position: absolute; left: 0; bottom: -3px; animation: left-right alternate infinite 3s; box-shadow: 0 0 10px 2px #C95B36; } -
Inline with "spark" on dark background.
-
<div class="loading"></div>@keyframes left-right { from {left: 0} to {left: calc(100% - 12px)} } .loading { width: 100%; height: 1px; border-bottom: 1px solid #B3F0F5; position: relative; } .loading::before { content:''; width: 4px; height: 4px; border-radius: 8px; background: white; position: absolute; left: 0; bottom: -3px; animation: left-right alternate infinite 3s; box-shadow: 0 0 10px 2px #B3F0F5; } Inline - Dots 1
-
<div class="dots"><div class="dots inner"></div></div>@keyframes sprite { 0% { left: 0; transform: scale(.15); opacity: 0; } 30% { opacity: 1; } 75% { left: calc(100% - 40px); transform: scale(1); opacity: 1; } 100% { left: 50%; transform: scale(3); opacity: 0; } } .dots { height: 20px; width: 100%; max-width: 300px; position: relative; } .dots.inner { margin: 0; width: 100%; } .dots::before, .dots::after { content:''; width: 40px; height: 40px; border-radius: 20px; position: absolute; left: 0; top: -10px; opacity: 0; background: #C95B36; animation: sprite 4s ease-in infinite; } .dots::after {animation-delay: .5s} .dots.inner::before {animation-delay: 1s;} .dots.inner::after {animation-delay: 1.5s} Circular - dial 1
-
<div class="dial1"></div>@keyframes rotator { from {transform: rotate(0deg)} to {transform: rotate(360deg)} } .dial1 { position: relative; width: 3rem; height: 3rem; background: var(--sienna); border-radius: 1.5rem; border-top-left-radius: 0; animation: rotator 3s infinite linear; } .dial1::after { content:''; position: absolute; top: -12px; left: -12px;; background: #C95B36; width: 8px; height: 8px; border-radius: 4px; } Circular - dial 2
-
<div class="dial2"><div class="dial2-inner"></div></div>@keyframes rotator { from {transform: rotate(0deg)} to {transform: rotate(360deg)} } .dial2 { position: relative; width: 3rem; height: 3rem; background: #C95B36; animation: rotator 3s infinite linear; border-radius: 2rem; border-top-left-radius: 0; } .dial2-inner { position: relative; left: -1.5rem; top: -1.5rem; width: 6rem; height: 6rem; border-radius: 4rem; animation: rotator 1.5s infinite linear reverse; } .dial2-inner::after { content: ''; width: .6rem; height: .6rem; background: #C95B36; position: absolute; left: 0; top: 0; border-radius: 1rem; } Circular - dial 3
-
<div class="dial3"></div>@keyframes rotator { from {transform: rotate(0deg)} to {transform: rotate(360deg)} } .dial3 { position: relative; width: 3rem; height: 3rem; } .dial3::before, .dial3::after { content: ''; width: 3rem; height: 3rem; border: 1rem solid #C95B36; border-radius: 1.5rem; border-top-left-radius: 0; position: absolute; left: -1rem; top: -1rem; animation: rotator 5s infinite linear; } .dial3::after { animation: rotator 3s infinite linear reverse; } Circular - squares 1
-
<div class="square1"><div class="square1-inner"></div></div>@keyframes rotator { from {transform: rotate(0deg)} to {transform: rotate(360deg)} } .square1 { border: 1px solid #C95B36; width: 3rem; height: 3rem; position: relative; animation: rotator 3s infinite linear; } .square1-inner { border: 1px solid #C95B36; width: 6rem; height: 6rem; position: relative; left: -1.6rem; top: -1.6rem; animation: rotator 8s infinite linear reverse; } .square1-inner::before, .square1-inner::after { content: ''; width: 100%; height: 100%; position: absolute; left: 0; top: 0; border: 1px solid #C95B36; animation: rotator 3s infinite linear reverse; } .square1-inner::after { border-color: #C95B36; animation: rotator 6s infinite linear; }