Skip to main content

Moon and well fish animation using html and css


 

HTML CODE:

<!DOCTYPE html>
<html>
<head>
  <link rel="stylesheet" href="css/subm.css">
</head>
<body>
  <div class="scene">
    <div class="upper">
      <div class="moon">
        <div class="crater1"></div>
        <div class="crater2"></div>
      </div>
      <div class="star1"></div>
      <div class="star2"></div>
      <div class="star3"></div>
      <div class="cloud1">
        <div class="circle"></div>
        <div class="filler"></div>
      </div>
      <div class="cloud2">
        <div class="circle"></div>
        <div class="filler"></div>
      </div>
      <div class="tail">
        <div class="left"></div>
        <div class="right"></div>
        <div class="body"></div>
      </div>
      <div class="drop"></div>
    </div>
    <div class="lower">
      <div class="whale">
        <div class="eye"></div>
        <div class="detail1">
          <div class="detail2"></div>
        </div>
      </div>
      <div class="fin"></div>
    </div>
  </div>
</body>
</html>

CSS CODE:

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  background: #A0BDFF;
}

.scene {
  width: 500px;
  height: 500px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
}

.upper {
  width: 100%;
  height: 300px;
  position: absolute;
  top: 0;
  left: 0;
  box-sizing: border-box;
}

.moon {
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background-color: deeppink;
  position: absolute;
  bottom: -150px;
  left: 50px;
  border: 5px solid #333;
  box-sizing: border-box;
  box-shadow: inset 0 -160px mediumvioletred;
  opacity: 0.9;
}

.crater1 {
  width: 20px;
  height: 20px;
  border-radius: 50% ;
  position: absolute;
  top: 20px;
  right: 150px;
  background-color: mediumvioletred;
  opacity: 0.2;
  border: 1px solid #333;
}

.crater2 {
  width: 50px;
  height: 50px;
  border-radius: 50% ;
  position: absolute;
  top: 70px;
  right: 180px;
  background-color: mediumvioletred;
  opacity: 0.2;
  border: 1px solid #333;
}

.cloud1 {
  width: 200px;
  height: 150px;
  position: absolute;
  top: 100px;
  right: -50px;
  animation: float2 4s ease-in-out infinite alternate;
}

.cloud2 {
  width: 200px;
  height: 150px;
  position: absolute;
  top: 0;
  left: 0;
  animation: float1 4s ease-in-out infinite alternate;
}

@keyframes float1 {
  from {transform: translateX(-50px);}
  to {transform: translateX(50px);}
}

@keyframes float2 {
  from {transform: translateX(50px);}
  to {transform: translateX(-50px);}
}

.circle {
  width: 80px;
  height: 80px;
  position: absolute;
  top: 0;
  left: 60px;
  border-radius: 50%;
  background-color: fuchsia;
}

.circle::before {
  content: "";
  width: 80px;
  height: 80px;
  position: absolute;
  top: 30px;
  left: -40px;
  border-radius: 50%;
  background-color: fuchsia;
}

.circle::after {
  content: "";
  width: 80px;
  height: 80px;
  position: absolute;
  top: 30px;
  left: 40px;
  border-radius: 50%;
  background-color: fuchsia;
}

.filler {
  width: 145px;
  height: 40px;
  border-radius: 17px;
  position: absolute;
  top: 70px;
  left: 28px;
  background-color: fuchsia;
  box-shadow: inset 0 -5px purple;
}

.star1 {
  width: 20px;
  height: 5px;
  border-radius: 5px;
  background-color: purple;
  position: absolute;
  top: 20px;
  right: 0;
  animation: twinkle 0.5s 0.2s linear infinite alternate;
}

.star1::after {
  content: "";
  width: 5px;
  height: 20px;
  border-radius: 5px;
  background-color: purple;
  position: absolute;
  top: -7px;
  right: 8px;
  animation: twinkle 0.5s  0.2s linear infinite alternate;
}

.star2 {
  width: 20px;
  height: 5px;
  border-radius: 5px;
  background-color: purple;
  position: absolute;
  top: -20px;
  right: 200px;
  animation: twinkle 0.5s 0.3s linear infinite alternate;
}

.star2::after {
  content: "";
  width: 5px;
  height: 20px;
  border-radius: 5px;
  background-color: purple;
  position: absolute;
  top: -7px;
  right: 8px;
  animation: twinkle 0.5s 0.3s linear infinite alternate;
}

.star3 {
  width: 20px;
  height: 5px;
  border-radius: 5px;
  background-color: purple;
  position: absolute;
  top: 130px;
  left: -20px;
  animation: twinkle 0.5s linear infinite alternate;
}

.star3::after {
  content: "";
  width: 5px;
  height: 20px;
  border-radius: 5px;
  background-color: purple;
  position: absolute;
  top: -7px;
  left: 8px;
  animation: twinkle 0.5s linear infinite alternate;
}

@keyframes twinkle {
  to {background-color: deeppink;}
}

.tail {
  width: 150px;
  height: 120px;
  position: absolute;
  bottom: -10px;
  left: 2px;
}

.left {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: darkslateblue;
  position: absolute;
  top: 10px;
  left: 20px;
  border: 1px solid #333;
  z-index: 1;
}

.left::before {
  content: "";
  width: 60px;
  height: 20px;
  border-bottom: 60px solid darkslateblue;
  border-radius: 0 0 0 100%;
  position: absolute;
  top: -20px;
  left: -30px;
  animation: excite1 2s infinite alternate linear;
  transform-origin: right;
}

@keyframes excite1 {
  to {transform: rotateZ(-5deg);}
}

.right {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: darkslateblue;
  position: absolute;
  top: 10px;
  right: 20px;
  border: 1px solid #333;
  z-index: 1;
}

.right::after {
  content: "";
  width: 60px;
  height: 20px;
  border-bottom: 60px solid darkslateblue;
  border-radius: 0 0 100% 0;
  position: absolute;
  top: -20px;
  right: -30px;
  animation: excite2 2s linear alternate infinite;
  transform-origin: left;
}

@keyframes excite2 {
  to {transform: rotateZ(5deg);}
}


.body {
  height: 80px;
  width: 58px;
  border-radius: 25px;
  position: absolute;
  bottom: -18px;
  left: 54px;
  background-color: darkslateblue;
  transform: rotateZ(-10deg);
  border: 2px solid #333;
}

.drop {
  height: 13px;
  width: 13px;
  border-radius: 50%;
  background-color: purple;
  position: absolute;
  bottom: -25px;
  right: 180px;
  animation: spray 3s ease-out infinite;
}

.drop::before {
  content: "";
  height: 10px;
  width: 10px;
  border-radius: 50%;
  background-color: purple;
  position: absolute;
  bottom: 0;
  right: 0;
  animation: spray 3s 0.3s ease-out infinite;
}

.drop::after {
  content: "";
  height: 12px;
  width: 12px;
  border-radius: 50%;
  background-color: purple;
  position: absolute;
  bottom: 0;
  right: 0;
  animation: spray 3s 0.7s ease-out infinite;
}

@keyframes spray {
  0% {transform: translateY(0);}
  30% {transform: translateY(-100px);}
  60% {transform: translateY(0);}
}


.lower {
  width: 100%;
  height: 200px;
  position: absolute;
  bottom: 0;
  left: 0;
  border-top: 5px solid #333;
  overflow: hidden;
}

.whale {
  width: 400px;
  height: 400px;
  border-radius: 300px;
  position: absolute;
  top: -250px;
  left: 50px;
  background-color: slateblue;
  box-shadow: inset 0 -10px darkslateblue;
  border: 5px solid #333;
  box-sizing: border-box;
  overflow: hidden;
}

.eye {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  position: absolute;
  bottom: 110px;
  right: 120px;
  background-color: #333;
  animation: blink 2s linear infinite;
}

@keyframes blink {
  0% {transform: scaleY(0.1);}
  5% {transform: scaleY(0.1);}
  5.1% {transform: scaleY(1);}
}

.detail1 {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  position: absolute;
  bottom: 10px;
  right: 0px;
  background-color: lightsteelblue;
  overflow: hidden;
  border: 2px solid #333;
  box-sizing: border-box;
}

.fin {
  width: 50px;
  height: 120px;
  border-radius: 40px;
  position: absolute;
  bottom: 0;
  right: 180px;
  background-color: slateblue;
  border: 5px solid #333;
  border-top: 5px solid transparent;
  transform: rotateZ(15deg);
  box-shadow: inset 0 -10px darkslateblue;
  animation: swim 2s linear infinite alternate;
  transform-origin: top;
}

@keyframes swim {
  to {transform: rotateZ(20deg);}
}

.detail2 {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  position: absolute;
  bottom: 0;
  right: 30px;
  border-bottom: 8px solid #333;
  border-right: 8px solid #333;
  transform: rotateZ(-50deg);
}

.detail2::before {
  content: "";
  width: 200px;
  height: 200px;
  border-radius: 50%;
  position: absolute;
  bottom: 20px;
  right: 10px;
  border-bottom: 8px solid #333;
  border-right: 8px solid #333;
}

.detail2::after {
  content: "";
  width: 200px;
  height: 200px;
  border-radius: 50%;
  position: absolute;
  bottom: 5px;
  right: 0;
  border-bottom: 8px solid #333;
  border-right: 8px solid #333;
}html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  background: #A0BDFF;
}

.scene {
  width: 500px;
  height: 500px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
}

.upper {
  width: 100%;
  height: 300px;
  position: absolute;
  top: 0;
  left: 0;
  box-sizing: border-box;
}

.moon {
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background-color: deeppink;
  position: absolute;
  bottom: -150px;
  left: 50px;
  border: 5px solid #333;
  box-sizing: border-box;
  box-shadow: inset 0 -160px mediumvioletred;
  opacity: 0.9;
}

.crater1 {
  width: 20px;
  height: 20px;
  border-radius: 50% ;
  position: absolute;
  top: 20px;
  right: 150px;
  background-color: mediumvioletred;
  opacity: 0.2;
  border: 1px solid #333;
}

.crater2 {
  width: 50px;
  height: 50px;
  border-radius: 50% ;
  position: absolute;
  top: 70px;
  right: 180px;
  background-color: mediumvioletred;
  opacity: 0.2;
  border: 1px solid #333;
}

.cloud1 {
  width: 200px;
  height: 150px;
  position: absolute;
  top: 100px;
  right: -50px;
  animation: float2 4s ease-in-out infinite alternate;
}

.cloud2 {
  width: 200px;
  height: 150px;
  position: absolute;
  top: 0;
  left: 0;
  animation: float1 4s ease-in-out infinite alternate;
}

@keyframes float1 {
  from {transform: translateX(-50px);}
  to {transform: translateX(50px);}
}

@keyframes float2 {
  from {transform: translateX(50px);}
  to {transform: translateX(-50px);}
}

.circle {
  width: 80px;
  height: 80px;
  position: absolute;
  top: 0;
  left: 60px;
  border-radius: 50%;
  background-color: fuchsia;
}

.circle::before {
  content: "";
  width: 80px;
  height: 80px;
  position: absolute;
  top: 30px;
  left: -40px;
  border-radius: 50%;
  background-color: fuchsia;
}

.circle::after {
  content: "";
  width: 80px;
  height: 80px;
  position: absolute;
  top: 30px;
  left: 40px;
  border-radius: 50%;
  background-color: fuchsia;
}

.filler {
  width: 145px;
  height: 40px;
  border-radius: 17px;
  position: absolute;
  top: 70px;
  left: 28px;
  background-color: fuchsia;
  box-shadow: inset 0 -5px purple;
}

.star1 {
  width: 20px;
  height: 5px;
  border-radius: 5px;
  background-color: purple;
  position: absolute;
  top: 20px;
  right: 0;
  animation: twinkle 0.5s 0.2s linear infinite alternate;
}

.star1::after {
  content: "";
  width: 5px;
  height: 20px;
  border-radius: 5px;
  background-color: purple;
  position: absolute;
  top: -7px;
  right: 8px;
  animation: twinkle 0.5s  0.2s linear infinite alternate;
}

.star2 {
  width: 20px;
  height: 5px;
  border-radius: 5px;
  background-color: purple;
  position: absolute;
  top: -20px;
  right: 200px;
  animation: twinkle 0.5s 0.3s linear infinite alternate;
}

.star2::after {
  content: "";
  width: 5px;
  height: 20px;
  border-radius: 5px;
  background-color: purple;
  position: absolute;
  top: -7px;
  right: 8px;
  animation: twinkle 0.5s 0.3s linear infinite alternate;
}

.star3 {
  width: 20px;
  height: 5px;
  border-radius: 5px;
  background-color: purple;
  position: absolute;
  top: 130px;
  left: -20px;
  animation: twinkle 0.5s linear infinite alternate;
}

.star3::after {
  content: "";
  width: 5px;
  height: 20px;
  border-radius: 5px;
  background-color: purple;
  position: absolute;
  top: -7px;
  left: 8px;
  animation: twinkle 0.5s linear infinite alternate;
}

@keyframes twinkle {
  to {background-color: deeppink;}
}

.tail {
  width: 150px;
  height: 120px;
  position: absolute;
  bottom: -10px;
  left: 2px;
}

.left {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: darkslateblue;
  position: absolute;
  top: 10px;
  left: 20px;
  border: 1px solid #333;
  z-index: 1;
}

.left::before {
  content: "";
  width: 60px;
  height: 20px;
  border-bottom: 60px solid darkslateblue;
  border-radius: 0 0 0 100%;
  position: absolute;
  top: -20px;
  left: -30px;
  animation: excite1 2s infinite alternate linear;
  transform-origin: right;
}

@keyframes excite1 {
  to {transform: rotateZ(-5deg);}
}

.right {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: darkslateblue;
  position: absolute;
  top: 10px;
  right: 20px;
  border: 1px solid #333;
  z-index: 1;
}

.right::after {
  content: "";
  width: 60px;
  height: 20px;
  border-bottom: 60px solid darkslateblue;
  border-radius: 0 0 100% 0;
  position: absolute;
  top: -20px;
  right: -30px;
  animation: excite2 2s linear alternate infinite;
  transform-origin: left;
}

@keyframes excite2 {
  to {transform: rotateZ(5deg);}
}


.body {
  height: 80px;
  width: 58px;
  border-radius: 25px;
  position: absolute;
  bottom: -18px;
  left: 54px;
  background-color: darkslateblue;
  transform: rotateZ(-10deg);
  border: 2px solid #333;
}

.drop {
  height: 13px;
  width: 13px;
  border-radius: 50%;
  background-color: purple;
  position: absolute;
  bottom: -25px;
  right: 180px;
  animation: spray 3s ease-out infinite;
}

.drop::before {
  content: "";
  height: 10px;
  width: 10px;
  border-radius: 50%;
  background-color: purple;
  position: absolute;
  bottom: 0;
  right: 0;
  animation: spray 3s 0.3s ease-out infinite;
}

.drop::after {
  content: "";
  height: 12px;
  width: 12px;
  border-radius: 50%;
  background-color: purple;
  position: absolute;
  bottom: 0;
  right: 0;
  animation: spray 3s 0.7s ease-out infinite;
}

@keyframes spray {
  0% {transform: translateY(0);}
  30% {transform: translateY(-100px);}
  60% {transform: translateY(0);}
}


.lower {
  width: 100%;
  height: 200px;
  position: absolute;
  bottom: 0;
  left: 0;
  border-top: 5px solid #333;
  overflow: hidden;
}

.whale {
  width: 400px;
  height: 400px;
  border-radius: 300px;
  position: absolute;
  top: -250px;
  left: 50px;
  background-color: slateblue;
  box-shadow: inset 0 -10px darkslateblue;
  border: 5px solid #333;
  box-sizing: border-box;
  overflow: hidden;
}

.eye {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  position: absolute;
  bottom: 110px;
  right: 120px;
  background-color: #333;
  animation: blink 2s linear infinite;
}

@keyframes blink {
  0% {transform: scaleY(0.1);}
  5% {transform: scaleY(0.1);}
  5.1% {transform: scaleY(1);}
}

.detail1 {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  position: absolute;
  bottom: 10px;
  right: 0px;
  background-color: lightsteelblue;
  overflow: hidden;
  border: 2px solid #333;
  box-sizing: border-box;
}

.fin {
  width: 50px;
  height: 120px;
  border-radius: 40px;
  position: absolute;
  bottom: 0;
  right: 180px;
  background-color: slateblue;
  border: 5px solid #333;
  border-top: 5px solid transparent;
  transform: rotateZ(15deg);
  box-shadow: inset 0 -10px darkslateblue;
  animation: swim 2s linear infinite alternate;
  transform-origin: top;
}

@keyframes swim {
  to {transform: rotateZ(20deg);}
}

.detail2 {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  position: absolute;
  bottom: 0;
  right: 30px;
  border-bottom: 8px solid #333;
  border-right: 8px solid #333;
  transform: rotateZ(-50deg);
}

.detail2::before {
  content: "";
  width: 200px;
  height: 200px;
  border-radius: 50%;
  position: absolute;
  bottom: 20px;
  right: 10px;
  border-bottom: 8px solid #333;
  border-right: 8px solid #333;
}

.detail2::after {
  content: "";
  width: 200px;
  height: 200px;
  border-radius: 50%;
  position: absolute;
  bottom: 5px;
  right: 0;
  border-bottom: 8px solid #333;
  border-right: 8px solid #333;
}


Comments

Popular posts from this blog

Toggle animation using CSS!!!

HTML CODE: <! DOCTYPE html > < html > < head >     < meta charset = "utf-8" >     < meta name = "viewport" content = "width=device-width, initial-scale=1" >     < title > Toggle </ title >     < link rel = "stylesheet" href = "Toggle.css" > </ head > < body > < input type = "checkbox" id = "day-night" >< label for = "day-night" ></ label > < div class = "content" >         < div class = "moon-sun" ></ div >     < div class = "cuboid floor one" >         < div class = "side" ></ div >         < div class = "side" ></ div >         < div class = "side" ></ div >         < div class = "side" ></ div >         < div class = "side" ></ div >   ...

Animated amongus !!!

HTML CODE: <! DOCTYPE html > < html lang = "en" > < head >     < meta charset = "UTF-8" >     < meta name = "viewport" content = "width=device-width, initial-scale=1.0" >     < title > Among Us </ title >     < link rel = "stylesheet" href = "amongus.css" > </ head > < body >     < div class = "player" >         < div class = "visor" ></ div >         < div class = "backpack" ></ div >         < div class = "leg front" ></ div >         < div class = "leg back" ></ div >         < div class = "shade" ></ div >     </ div > </ body > </ html > CSS CODE: html , body {     height : 100vh ; } body {     display : flex ;     align-items : center ; ...

Mountains and Truck

  HTML CODE: <! DOCTYPE html > < html >   < head >     < title > Message Box </ title >     < link rel = "stylesheet" href = "css/mountain.css" />   </ head > < div class = "loop-wrapper" >   < div class = "mountain" ></ div >   < div class = "hill" ></ div >   < div class = "tree" ></ div >   < div class = "tree" ></ div >   < div class = "tree" ></ div >   < div class = "rock" ></ div >   < div class = "truck" ></ div >   < div class = "wheels" ></ div > </ div > </ html > CSS CODE: body {     background : #136482 ;     overflow : hidden ;     font-family : 'Open Sans' , sans-serif ;   }   .loop-wrapper {     margin : 0 auto ;     position : relative ;     display : block ...