<div class="has-animation animation-ltr" data-delay="10">
<p class="bigger">
MAQE Animation
</p>
</div>
<br>
<br>
<div class="has-animation animation-ltr" data-delay="1">
<img src="https://antoni.de/wp-content/uploads/2017/08/intro_image5.jpg" class="" alt="">
</div>
$color-main: #0066ff;
$black: #202020;
body {
font-family: 'Montserrat', sans-serif;
text-align: center;
}
div {
display: inline-block;
}
.bigger {
margin: 0;
font-size: 60px;
font-weight: 800;
padding: 50px;
text-transform: uppercase;
color: $black;
display: inline-block;
position: relative;
}
.text {
max-width: 600px;
width: 100%;
line-height: 24px;
text-align: center;
color: #404040;
padding: 20px;
&.txt-center {
text-align: center;
}
a {
color: $color-main;
}
}
.has-animation {
position: relative;
p, img {
opacity: 0;
}
&.animate-in {
p, img {
animation: textHidden 0.1s 1.1s forwards;
}
&:before, &:after {
content: '';
position: absolute;
top: 0;
right: 0;
height: 100%;
z-index: 10;
}
&:before {
background-color: $color-main;
}
&:after {
background-color: $black;
animation-delay: .5s;
}
}
&.animation-ltr.animate-in {
&:before {
animation: revealLTR 1.8s ease;
}
&:after {
animation: revealLTR 1s .6s ease;
}
}
&.animation-rtl.animate-in {
&:before {
animation: revealRTL 1.8s ease;
}
&:after {
animation: revealRTL 1s .6s ease;
}
}
}
@keyframes revealLTR {
0% {
width: 0;
left: 0;
}
50% {
width: 100%;
left: 0;
}
100% {
width: 0;
left: 100%;
}
}
@keyframes revealRTL {
0% {
width: 0;
right: 0;
}
65% {
width: 100%;
right: 0;
}
100% {
width: 0;
right: 100%;
}
}
@keyframes textHidden {
0%{
opacity: 0;
}
50% {
opacity: 0.5;
}
100% {
opacity: 1;
}
}
View Compiled
$(document).ready(function() {
$('.has-animation').each(function(index) {
$(this).delay($(this).data('delay')).queue(function(){
$(this).addClass('animate-in');
});
});
});
This Pen doesn't use any external CSS resources.