Search This Blog

Welcome to CSS3 HandsOn - Flying Bird- Create a CSS animation to make a flying bird effect as shown in above gif-HackerRank Fresco Play Solution

 

Create a CSS animation to make a flying bird effect as shown in above gif

- Use flex to align divs to your html.
- Use the background image and bird svg given to you in the directory.
- Create a sliding window effect to get the flapping effect of bird.
- fly-cycle animation should make the bird fly across the screen and fly-one-right should make the svg window move right.

Answer:
h1 {
  font-family'comic sans'cursive;
  font-size25px;
}
body,html{
  min-width:100%;
  min-height:100%;
  displayflex;
  align-itemscenter;
  justify-contentcenter;
}
.container {
  min-height30rem;
  min-width:50rem;
  background-sizecover;
  background-positioncenter center;
  overflow:hidden;
  position:relative;
  displayflex;
  align-itemscenter;
  justify-contentcenter;
  background-image:url(.*bg.jpg.*);
}

.bird {
  background-sizeauto 100%;
  width88px;
  height125px;
  animation-timing-functionsteps(10);
  animation-iteration-countinfinite;
  animation-duration1s;
  animation-delay-0.5s;   
  background-image:url(.*bird-cells.svg.*);
  will-change:background-position;
  animation-name:fly-cycle;

}

.bird-container {
  top20%;
  left-10%;
  animation-timing-functionlinear;
  animation-iteration-countinfinite;
  animation-duration15s;
  animation-delay0;
  positionabsolute;
  will-change:transform;
  transform:scale(.*)translateX(.*);
  animation-name:fly-right-one;

}

@keyframes fly-cycle {  
  100% {
    background-position-900px 0;
  }
}

@keyframes fly-right-one {
  
  0% {
    transformscale(0.3translateX(-10vw);
  }
  
  10% {
    transformtranslateY(2vhtranslateX(10vwscale(0.4);
  }
  
  20% {
    transformtranslateY(0vhtranslateX(30vwscale(0.5);
  }
  
  30% {
    transformtranslateY(4vhtranslateX(50vwscale(0.6);
  }
  
  40% {
    transformtranslateY(2vhtranslateX(70vwscale(0.6);
  }
  
  50% {
    transformtranslateY(0vhtranslateX(90vwscale(0.6);
  }
  
  60% {
    transformtranslateY(0vhtranslateX(110vwscale(0.6);
  }
  
  100% {
    transformtranslateY(0vhtranslateX(110vwscale(0.6);
  }
  
}

@keyframes fly-right-two {
  
  0% {
    transformtranslateY(-2vhtranslateX(-10vwscale(0.5);
  }
  
  10% {
    transformtranslateY(0vhtranslateX(10vwscale(0.4);
  }
  
  20% {
    transformtranslateY(-4vhtranslateX(30vwscale(0.6);
  }
  
  30% {
    transformtranslateY(1vhtranslateX(50vwscale(0.45);
  }
  
  40% {
    transformtranslateY(-2.5vhtranslateX(70vwscale(0.5);
  }
  
  50% {
    transformtranslateY(0vhtranslateX(90vwscale(0.45);
  }
  
  51% {
    transformtranslateY(0vhtranslateX(110vwscale(0.45);
  }
  
  100% {
    transformtranslateY(0vhtranslateX(110vwscale(0.45);
  }
  
}



Click on the image for full view:


No comments:

Post a Comment

If you have any doubts, Please let us know.