Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

svg css animation infinite

I am trying to make a similar example like https://css-tricks.com/svg-line-animation-works but I would like it to rotate infinite.

#path1 {
  stroke-dasharray: 170;
  -webkit-animation: animate1 5s infinite; /* Chrome, Safari, Opera */ 
  animation: animate1 5s infinite;
}
@keyframes animate1 {
 to {
       stroke-dashoffset: 1000;
 }
}

@-webkit-keyframes animate1 {
 to {
       stroke-dashoffset: 1000;
  }
}

I made an example http://jsfiddle.net/46cmu71t/. I put the code to do this infinite but it slow down and then start again. Is there any way to make it rotate without losing speed?

like image 399
DMande Avatar asked Nov 04 '25 23:11

DMande


1 Answers

Very easy to do, add the linear method to the transition line:

#path1 {
  stroke-dasharray: 170;
  -webkit-animation: animate1 5s infinite linear; /* Chrome, Safari, Opera */ 
  animation: animate1 5s infinite linear;
} 

More about CSS transition timing
More about CSS transitions

JSFiddle Demo

like image 108
Jacob Gray Avatar answered Nov 07 '25 16:11

Jacob Gray