Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Animated border unwanted delay

Tags:

css

I'm trying to create an infinite animation that sequentially changes colors of border sides (travelling around). I cant figure out the unwanted delays / jumps at the beginning of the each repetition.

#neki {
  
    padding:10px;
    border: 6px solid #dcdcdc;
    animation: example 1s infinite;
  
}

@keyframes example {
  
  0% {
    border-color: #dcdcdc;
  }
  25% {
    border-left-color: red;
  }
  50% {
    border-top-color: red;
  }
  75% {
    border-right-color: red;
  }
  100% {
    border-bottom-color: red;
  }
  
}
<br>
<span id="neki">awdawdawdwdawda</span>
like image 828
mr.work Avatar asked Sep 20 '19 11:09

mr.work


1 Answers

#neki {
  padding: 10px;
  border: 6px solid #dcdcdc;
  animation: example 1s infinite;
}

@keyframes example {
  0%,
  100% {
    border-top-color: red;
    border-right-color: #dcdcdc;
  }
  25% {
    border-right-color: red;
    border-bottom-color: #dcdcdc;
  }
  50% {
    border-bottom-color: red;
    border-left-color: #dcdcdc;
  }
  75% {
    border-left-color: red;
    border-top-color: #dcdcdc;
  }
}
<br />
<span id="neki">awdawdawdwdawda</span>
like image 194
ankitkanojia Avatar answered Sep 19 '22 07:09

ankitkanojia