Monday, January 7, 2019

Bouncing Text Animation Effect using Pure CSS

Bouncing Text Animation Effect

This is a simple tutorial for creating bouncing text animation effect using pure CSS3 and HTML. In this tutorial, I have used CSS3 animation property with value ease to move text (keyframe) towards top and bottom (alternate -- distance -10px) at 1 second rate infinitely (infinite).

Source Code

HTML: index.html
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>Bouncing Text Animation Effect</title>
  <link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
  <div id="title_wrapper">
    <div id="text">
      <i>B</i><i>o</i><i>u</i><i>n</i><i>c</i><i>i</i><i>n</i><i>g</i><i></i>
      <i>T</i><i>e</i><i>x</i><i>t</i><i></i>
      <i>A</i><i>n</i><i>i</i><i>m</i><i>a</i><i>t</i><i>i</i><i>o</i><i>n</i><i></i>
      <i>E</i><i>f</i><i>f</i><i>e</i><i>c</i><i>t</i>
    </div>
  </div>
</body>
</html>


CSS: style.css
#text {
  text-shadow: 3px 6px 3px rgba(0,0,0,.1);
  font-size: 30px;
  font-variant: small-caps;
  font-family: "Times New Roman", Times, serif;
  color: #F3661C;
}

#text i {
  position: relative;
  top: 10px;
  font-style: normal;
  -webkit-animation: bounce 1s ease infinite alternate;
  -moz-animation: bounce 1s ease infinite alternate;
  animation: bounce 1s ease infinite alternate;
}

#text i:nth-child(1) {
  -moz-animation-delay: .2s;
  -webkit-animation-delay: .2s;
  animation-delay: .2s;
  color: #ff0000;
}
#text i:nth-child(2) {
  -moz-animation-delay: .4s;
  -webkit-animation-delay: .4s;
  animation-delay: .4s;
  color: #cc0000;
}
#text i:nth-child(3) {
  -moz-animation-delay: .6s;
  -webkit-animation-delay: .6s;
  animation-delay: .6s;
  color: #cc0066;
}
#text i:nth-child(4) {
  -moz-animation-delay: .8s;
  -webkit-animation-delay: .8s;
  animation-delay: .8s;
  color: #cc6699;
}
#text i:nth-child(5) {
  -moz-animation-delay: 1s;
  -webkit-animation-delay: 1s;
  animation-delay: 1s;
  color: #cc3399;
}
#text i:nth-child(6) {
  -moz-animation-delay: 1.2s;
  -webkit-animation-delay: 1.2s;
  animation-delay: 1.2s;
  color: #cc0099;
}
#text i:nth-child(7) {
  -moz-animation-delay: 1.4s;
  -webkit-animation-delay: 1.4s;
  animation-delay: 1.4s;
  color: #cc00cc;
}
#text i:nth-child(8) {
  -moz-animation-delay: 1.6s;
  -webkit-animation-delay: 1.6s;
  animation-delay: 1.6s;
  color: #cc00ff;
}
#text i:nth-child(9) {
  -moz-animation-delay: 1.8s;
  -webkit-animation-delay: 1.8s;
  animation-delay: 1.8s;
  color: #9933ff;
}
#text i:nth-child(10) {
  -moz-animation-delay: 2s;
  -webkit-animation-delay: 2s;
  animation-delay: 2s;
  color: #6600ff;
}
#text i:nth-child(11) {
  -moz-animation-delay: 2.2s;
  -webkit-animation-delay: 2.2s;
  animation-delay: 2.2s;
  color: #3333cc;
}
#text i:nth-child(12) {
  -moz-animation-delay: 2.4s;
  -webkit-animation-delay: 2.4s;
  animation-delay: 2.4s;
  color: #3333ff;
}
#text i:nth-child(13) {
  -moz-animation-delay: 2.6s;
  -webkit-animation-delay: 2.6s;
  animation-delay: 2.6s;
  color: #0000ff;
}
#text i:nth-child(14) {
  -moz-animation-delay: 2.8s;
  -webkit-animation-delay: 2.8s;
  animation-delay: 2.8s;
  color: #0033cc;
}
#text i:nth-child(15) {
  -moz-animation-delay: 3s;
  -webkit-animation-delay: 3s;
  animation-delay: 3s;
  color: #0066cc;
}
#text i:nth-child(16) {
  -moz-animation-delay: 3.2s;
  -webkit-animation-delay: 3.2s;
  animation-delay: 3.2s;
  color: #0099cc;
}
#text i:nth-child(17) {
  -moz-animation-delay: 3.4s;
  -webkit-animation-delay: 3.4s;
  animation-delay: 3.4s;
  color: #006699;
}
#text i:nth-child(18) {
  -moz-animation-delay: 3.6s;
  -webkit-animation-delay: 3.6s;
  animation-delay: 3.6s;
  color: #009999;
}
#text i:nth-child(19) {
  -moz-animation-delay: 3.8s;
  -webkit-animation-delay: 3.8s;
  animation-delay: 3.8s;
  color: #00cc99;
}
#text i:nth-child(20) {
  -moz-animation-delay: 4s;
  -webkit-animation-delay: 4s;
  animation-delay: 4s;
  color: #00cc66;
}
#text i:nth-child(21) {
  -moz-animation-delay: 4.2s;
  -webkit-animation-delay: 4.2s;
  animation-delay: 4.2s;
  color: #00cc00;
}
#text i:nth-child(22) {
  -moz-animation-delay: 4.4s;
  -webkit-animation-delay: 4.4s;
  animation-delay: 4.4s;
  color: #009933;
}
#text i:nth-child(23) {
  -moz-animation-delay: 4.6s;
  -webkit-animation-delay: 4.6s;
  animation-delay: 4.6s;
  color: #009900;
}
#text i:nth-child(24) {
  -moz-animation-delay: 4.8s;
  -webkit-animation-delay: 4.8s;
  animation-delay: 4.8s;
  color: #669900;
}
#text i:nth-child(25) {
  -moz-animation-delay: 5s;
  -webkit-animation-delay: 5s;
  animation-delay: 5s;
  color: #99cc00;
}
#text i:nth-child(26) {
  -moz-animation-delay: 5.2s;
  -webkit-animation-delay: 5.2s;
  animation-delay: 5.2s;
  color: #cccc00;
}
#text i:nth-child(27) {
  -moz-animation-delay: 5.4s;
  -webkit-animation-delay: 5.4s;
  animation-delay: 5.4s;
  color: #cc9900;
}
#text i:nth-child(28) {
  -moz-animation-delay: 5.6s;
  -webkit-animation-delay: 5.6s;
  animation-delay: 5.6s;
  color: #ff9900;
}
#text i:nth-child(29) {
  -moz-animation-delay: 5.8s;
  -webkit-animation-delay: 5.8s;
  animation-delay: 5.8s;
  color: #cc6600;
}
#text i:nth-child(30) {
  -moz-animation-delay: 6s;
  -webkit-animation-delay: 6s;
  animation-delay: 6s;
  color: #ff3300; }

@keyframes bounce { 100% { top: -10px; } }
@-webkit-keyframes bounce { 100% { top: -10px; } }
@-moz-keyframes bounce { 100% { top: -10px; } }

Live Preview

Bouncing Text Animation Effect

0 comments :

Post a Comment