Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make an existing SVG to spin (loading icon)

Tags:

svg

I have a svg icon and I want to make it spin (load). Is this possible? I've found online sites that they can create rotating icons but I haven't found a converter that will make an existing svg icon to spin.

like image 562
user1919 Avatar asked Oct 26 '16 07:10

user1919


Video Answer


1 Answers

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% {  transform: rotate(359deg); }
}
#star {
    animation: spin 2s linear infinite;

}
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" 
  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg id=star width="4cm" height="4cm" viewBox="0 0 700 400" xmlns="http://www.w3.org/2000/svg" version="1.1">
  <polygon fill="red" stroke="red" stroke-width="10" 
            points="350,75  379,161 469,161 397,215
                    423,301 350,250 277,301 303,215
                    231,161 321,161" />
  
</svg>
like image 81
UltrasoundJelly Avatar answered Sep 20 '22 19:09

UltrasoundJelly