Cool Waves Animation Using HTML CSS T he Animation is a very important part of any website until 2020, as it enhances the user experience and makes it visually appealing. Therefore, consider this importance
I wanted to animated waves for the background of a page. Initially, I tried a staggered loop animation in Javascript , but some mobile devices struggled
Watch Video And Try Coding Yourself with your own customizations
VIDEO
Html File Source code 1. ➤ Add-in <body></body> Tag element :-
:root {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
-o-box-sizing: border-box;
box-sizing: border-box;
cursor: default;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
*,
:before,
:after {
-webkit-box-sizing: inherit;
-moz-box-sizing: inherit;
-ms-box-sizing: inherit;
-o-box-sizing: inherit;
box-sizing: inherit;
}
html,
body {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: block;
width: 100%;
height: 100%;
}
html {
overflow: hidden;
}
body {
margin: 0;
overflow: auto;
overflow-x: hidden;
overflow-y: scroll;
-webkit-overflow-scrolling: touch;
-moz-overflow-scrolling: touch;
-ms-overflow-scrolling: touch;
-o-overflow-scrolling: touch;
overflow-scrolling: touch;
-ms-overflow-style: ms-autohiding-scrollbar;
}
#page-wrap {
position: relative;
display: block;
clear: both;
background: none;
color: #000;
text-decoration: none;
padding: 3rem 0;
width: 100%;
height: 100%;
}
#inner-wrap {
position: absolute;
top: 3rem;
left: 0;
right: 0;
bottom: 3rem;
display: table;
width: 100%;
height: 100%;
min-height: 322px;
overflow: visible;
}
.logo {
position: absolute;
z-index: 1;
top: 3rem;
left: 2rem;
display: block;
width: 9vmax;
height: 9vmax;
min-width: 50px;
min-height: 50px;
}
.waves {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: block;
min-width: 100%;
min-height: 70%;
margin: auto 0;
}
.text {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: block;
width: 83%;
height: 100%;
margin: auto;
}
img,
svg {
display: block;
overflow: visible;
pointer-events: none;
}
.group:before,
.group:after {
content: "";
display: table;
clear: both;
}
.group {
zoom: 1;
}
.waves>path {
-webkit-animation: a 17390ms ease-in-out infinite alternate-reverse both;
-moz-animation: a 17390ms ease-in-out infinite alternate-reverse both;
-ms-animation: a 17390ms ease-in-out infinite alternate-reverse both;
-o-animation: a 17390ms ease-in-out infinite alternate-reverse both;
animation: a 17390ms ease-in-out infinite alternate-reverse both;
-webkit-animation-timing-function: cubic-bezier(.25, 0, .75, 1);
-moz-animation-timing-function: cubic-bezier(.25, 0, .75, 1);
-ms-animation-timing-function: cubic-bezier(.25, 0, .75, 1);
-o-animation-timing-function: cubic-bezier(.25, 0, .75, 1);
animation-timing-function: cubic-bezier(.25, 0, .75, 1);
-webkit-will-change: transform;
-moz-will-change: transform;
-ms-will-change: transform;
-o-will-change: transform;
will-change: transform
}
.waves>path:nth-of-type(1) {
-webkit-animation-duration: 20580ms;
-moz-animation-duration: 20580ms;
-ms-animation-duration: 20580ms;
-o-animation-duration: 20580ms;
animation-duration: 20580ms
}
.waves>path:nth-of-type(2) {
-webkit-animation-delay: -2690ms;
-moz-animation-delay: -2690ms;
-ms-animation-delay: -2690ms;
-o-animation-delay: -2690ms;
animation-delay: -2690ms;
-webkit-animation-duration: 13580ms;
-moz-animation-duration: 13580ms;
-ms-animation-duration: 13580ms;
-o-animation-duration: 13580ms;
animation-duration: 13580ms
}
g>path:nth-of-type(1) {
-webkit-animation-delay: -820ms;
-moz-animation-delay: -820ms;
-ms-animation-delay: -820ms;
-o-animation-delay: -820ms;
animation-delay: -820ms;
-webkit-animation-duration: 10730ms;
-moz-animation-duration: 10730ms;
-ms-animation-duration: 10730ms;
-o-animation-duration: 10730ms;
animation-duration: 10730ms
}
.waves>path:nth-of-type(1),
g>path:nth-of-type(2) {
-webkit-animation-direction: alternate;
-moz-animation-direction: alternate;
-ms-animation-direction: alternate;
-o-animation-direction: alternate;
animation-direction: alternate
}
@-webkit-keyframes a {
0% {
-webkit-transform: translateX(-750px);
transform: translateX(-750px)
}
100% {
-webkit-transform: translateX(-20px);
transform: translateX(-20px)
}
}
@-moz-keyframes a {
0% {
-moz-transform: translateX(-750px);
transform: translateX(-750px)
}
100% {
-moz-transform: translateX(-20px);
transform: translateX(-20px)
}
}
@-ms-keyframes a {
0% {
-ms-transform: translateX(-750px);
transform: translateX(-750px)
}
100% {
-ms-transform: translateX(-20px);
transform: translateX(-20px)
}
}
@-o-keyframes a {
0% {
-o-transform: translateX(-750px);
transform: translateX(-750px)
}
100% {
-o-transform: translateX(-20px);
transform: translateX(-20px)
}
}
@keyframes a {
0% {
-webkit-transform: translateX(-750px);
-moz-transform: translateX(-750px);
-ms-transform: translateX(-750px);
-o-transform: translateX(-750px);
transform: translateX(-750px)
}
100% {
-webkit-transform: translateX(-20px);
-moz-transform: translateX(-20px);
-ms-transform: translateX(-20px);
-o-transform: translateX(-20px);
transform: translateX(-20px)
}
}
If you like this content
please comment down below
If you have any questions related to coding problems ask us
any suggestions tell us
Thanks for reading this article # Coding Hindi