Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

107
Views
how to re-execute animation when animation ends

In the project design, 4 coins are supposed to be stacked on top of each other for 2 seconds with a delay of 0.5 seconds. (According to the code mentioned). I want the re-animation to start automatically when the 4-second period is over.Is it possible to do this without JavaScript and using Css?

Thank you in advance for your cooperation

.Coins > img{
    width: auto;
    opacity: 0;
    position: absolute;
    animation:  appear 2s linear infinite backwards;
    -webkit-animation:  appear 2s linear infinite backwards;
}

.Coins > img:nth-child(1){
    top: 50%;
    left: 40%;
    animation-delay: 0.5s;
}

.Coins > img:nth-child(2){
    top: 47%;
    left: 41%;
    animation-delay: 1s;
}

.Coins > img:nth-child(3){
    top: 44%;
    left: 39%;
    animation-delay: 1.5s;
}

.Coins > img:nth-child(4){
    top: 41%;
    left: 40%;
    animation-delay: 2s;
} 


@keyframes appear{
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@-webkit-keyframes appear{
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}
<div class="Coins">
    <img src="coin.png" alt="">
    <img src="coin.png" alt="">
    <img src="coin.png" alt="">
    <img src="coin.png" alt="">
</div>

]1]1

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can do this just using CSS, but notice that the overall time for the animation of a single coin has to be 4seconds, not 2. For 2 of those seconds it is appearing from opacity 0 to opacity 1 and then it disappears to opacity 0 immediately (that is the effect of the backwards parameter in the animation).

So, the animation needs to have 50% of the time increasing the opacity, then 50% with the opacity 0.

.Coins>img {
  width: auto;
  opacity: 0;
  position: absolute;
  animation: appear 4s linear infinite backwards;
  width: 10vmin;
  height: 2vmin;
  background: gold;
}

.Coins>img:nth-child(1) {
  top: 50%;
  left: 40%;
  animation-delay: 0.5s;
}

.Coins>img:nth-child(2) {
  top: 47%;
  left: 41%;
  animation-delay: 1s;
}

.Coins>img:nth-child(3) {
  top: 44%;
  left: 39%;
  animation-delay: 1.5s;
}

.Coins>img:nth-child(4) {
  top: 41%;
  left: 40%;
  animation-delay: 2s;
}

@keyframes appear {
  0%,
  50.001%,
  100% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
}
<div class="Coins">
  <img src="coin.png" alt="">
  <img src="coin.png" alt="">
  <img src="coin.png" alt="">
  <img src="coin.png" alt="">
</div>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!