html - SVG animation transform origin propety is not working different browsers -


this question has answer here:

i facing issue transform origin property in firefox , safari. here link have done far : http://jsfiddle.net/hassanpervaiz/alfhfstt/ hers html svg , css code :

.st0{fill:#55b948;}  .st1{fill:none;stroke:#55b948;stroke-miterlimit:10;}  path#small-nid {    -webkit-animation: spin 4s infinite;            animation: spin 4s infinite;    -webkit-transform-origin: 89px 88px 0;        -ms-transform-origin: 89px 88px 0;            transform-origin: 89px 88px 0;    -webkit-animation-timing-function: steps(8);            animation-timing-function: steps(8);  }  path#big-nid {    -webkit-animation: spin 1.5s infinite;            animation: spin 1.5s infinite;    -webkit-transform-origin: 89px 88px 0;        -ms-transform-origin: 89px 88px 0;            transform-origin: 89px 88px 0;    -webkit-animation-timing-function: steps(12);            animation-timing-function: steps(12);  }  @-webkit-keyframes spin {    0% {      -webkit-transform: rotate(0deg);              transform: rotate(0deg);    }    100% {      -webkit-transform: rotate(359deg);              transform: rotate(359deg);    }  }  @keyframes spin {    0% {      -webkit-transform: rotate(0deg);              transform: rotate(0deg);    }    100% {      -webkit-transform: rotate(359deg);              transform: rotate(359deg);    }  }
<svg>   		<svg version="1.1" id="layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"  			 viewbox="0 0 177.667 177.667" style="enable-background:new 0 0 177.667 177.667;" xml:space="preserve">   		   		<g id="circle-border">  			<path class="st0" d="m88.833,177.667c39.851,177.667,0,137.816,0,88.833s39.851,0,88.833,0c48.982,0,88.833,39.851,88.833,88.833  				s137.816,177.667,88.833,177.667z m88.833,1c40.402,1,1,40.402,1,88.833s39.402,87.833,87.833,87.833s87.833-39.402,87.833-87.833  				s137.265,1,88.833,1z"/>  		</g>  		<path id="small-nid" class="st1" d="m88.833,92.333c-1.933,0-3.5-1.567-3.5-3.5l0,0c0-1.933,1.567-3.5,3.5-3.5h35  			c1.933,0,7.313,3.5,9.5,3.5l0,0c0,1.933-7.567,3.5-9.5,3.5h88.833z"/>  		<path id="big-nid" class="st1" d="m92.333,88.833c0,1.933-1.567,3.5-3.5,3.5l0,0c-1.933,0-3.5-1.567-3.5-3.5v-61.75  			c0-1.933,3.5-7.531,3.5-9.5l0,0c1.933,0,3.5,7.567,3.5,9.5v88.833z"/>  		</svg>  	</svg>

svg css animation. there solution great thank :)

edit:

my first try, using translate(x,y) chained rotate() worked firefox...
stated in this answer daviestar solution wrap each of pathes <g>element, , apply transform on those.

but, strangely enough, problem describes isn't same in first answer, maybe because of transform-origin.

anyway, here working code, no transform-origin anymore:

.st0 {      fill:#55b948;  }  .st1 {      fill:none;      stroke:#55b948;      stroke-miterlimit:10;  }  .niddle-wrapper {      transform: translate(-15%);  }  path#small-nid {      -webkit-animation: spin 4s infinite;      animation: spin 4s infinite;      -webkit-transform-origin: 89px 88px 0;      -ms-transform-origin: 89px 88px 0;      transform-origin: 89px 88px 0;      -webkit-animation-timing-function: steps(8);      animation-timing-function: steps(8);  }  path#big-nid {      -webkit-animation: spin 1.5s infinite;      animation: spin 1.5s infinite;      -webkit-transform-origin: 89px 88px 0;      -ms-transform-origin: 89px 88px 0;      transform-origin: 89px 88px 0;      -webkit-animation-timing-function: steps(12);      animation-timing-function: steps(12);  }  @-webkit-keyframes spin {      0% {          -webkit-transform: rotate(0deg);          transform: rotate(0deg);      }      100% {          -webkit-transform: rotate(359deg);          transform: rotate(359deg);      }  }  @keyframes spin {      0% {          -webkit-transform: rotate(0deg);          transform: rotate(0deg);      }      100% {          -webkit-transform: rotate(359deg);          transform: rotate(359deg);      }  }
<svg><svg version="1.1" id="layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewbox="0 0 177.667 177.667" style="enable-background:new 0 0 177.667 177.667;" xml:space="preserve">      <g id="circle-border">          <path class="st0" d="m88.833,177.667c39.851,177.667,0,137.816,0,88.833s39.851,0,88.833,0c48.982,0,88.833,39.851,88.833,88.833  				s137.816,177.667,88.833,177.667z m88.833,1c40.402,1,1,40.402,1,88.833s39.402,87.833,87.833,87.833s87.833-39.402,87.833-87.833  				s137.265,1,88.833,1z" />      </g>      <g class="niddle-wrapper">          <path id="small-nid" class="st1" d="m88.833,92.333c-1.933,0-3.5-1.567-3.5-3.5l0,0c0-1.933,1.567-3.5,3.5-3.5h35  			c1.933,0,7.313,3.5,9.5,3.5l0,0c0,1.933-7.567,3.5-9.5,3.5h88.833z" />      </g>      <g class="niddle-wrapper">          <path id="big-nid" class="st1" d="m92.333,88.833c0,1.933-1.567,3.5-3.5,3.5l0,0c-1.933,0-3.5-1.567-3.5-3.5v-61.75  			c0-1.933,3.5-7.531,3.5-9.5l0,0c1.933,0,3.5,7.567,3.5,9.5v88.833z" />      </g>      </svg></svg>


first answer

you add translate(x, y) transform declaration.

.st0{fill:#55b948;}  .st1{fill:none;stroke:#55b948;stroke-miterlimit:10;}  path#small-nid {    -webkit-animation: spin 4s infinite;            animation: spin 4s infinite;    -webkit-transform-origin: 89px 88px 0;        -ms-transform-origin: 89px 88px 0;            transform-origin: 89px 88px 0;    -webkit-animation-timing-function: steps(8);            animation-timing-function: steps(8);  }  path#big-nid {    -webkit-animation: spin 1.5s infinite;            animation: spin 1.5s infinite;    -webkit-transform-origin: 89px 88px 0;        -ms-transform-origin: 89px 88px 0;            transform-origin: 89px 88px 0;    -webkit-animation-timing-function: steps(12);            animation-timing-function: steps(12);  }  @-webkit-keyframes spin {    0% {      -webkit-transform: translate(-13px,-13px) rotate(0deg);    }    100% {      -webkit-transform: translate(-13px,-13px) rotate(359deg);    }  }  @keyframes spin {    0% {      -webkit-transform: translate(-13px,-13px) rotate(0deg);              transform: translate(-13px,-13px) rotate(0deg);    }    100% {      -webkit-transform: translate(-13px,-13px) rotate(359deg);              transform: translate(-13px,-13px) rotate(359deg);    }  }
<svg>   		<svg version="1.1" id="layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"  			 viewbox="0 0 177.667 177.667" style="enable-background:new 0 0 177.667 177.667;" xml:space="preserve">   		   		<g id="circle-border">  			<path class="st0" d="m88.833,177.667c39.851,177.667,0,137.816,0,88.833s39.851,0,88.833,0c48.982,0,88.833,39.851,88.833,88.833  				s137.816,177.667,88.833,177.667z m88.833,1c40.402,1,1,40.402,1,88.833s39.402,87.833,87.833,87.833s87.833-39.402,87.833-87.833  				s137.265,1,88.833,1z"/>  		</g>  		<path id="small-nid" class="st1" d="m88.833,92.333c-1.933,0-3.5-1.567-3.5-3.5l0,0c0-1.933,1.567-3.5,3.5-3.5h35  			c1.933,0,7.313,3.5,9.5,3.5l0,0c0,1.933-7.567,3.5-9.5,3.5h88.833z"/>  		<path id="big-nid" class="st1" d="m92.333,88.833c0,1.933-1.567,3.5-3.5,3.5l0,0c-1.933,0-3.5-1.567-3.5-3.5v-61.75  			c0-1.933,3.5-7.531,3.5-9.5l0,0c1.933,0,3.5,7.567,3.5,9.5v88.833z"/>  		</svg>  	</svg>


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -