Animation on firefox doesn't work (css only) - html

I am trying to figure out why this animation on codepen doesn't work
https://codepen.io/cassie-codes/full/zWJxXj/
in which you can find a bubble animation with 2 images. One is a background, the second one is a mask. these random bubbles should move and reveal the mask image. On chrome works, on firefox not. I can't understand if the problem is about the svg properties or something on css. Anyway that's the code
Html:
<div class="bgImage"></div>
<svg class="blobCont">
<image xlink:href="https://images.unsplash.com/photo-1500462918059-b1a0cb512f1d?ixlib=rb-0.3.5&s=e20bc3d490c974d9ea190e05c47962f5&auto=format&fit=crop&w=634&q=80" mask="url(#mask)" width="100%" height="100%" preserveAspectRatio="xMidYMid slice" />
<mask id="mask" x="0" y="0">
<g style="filter: url(#gooey)">
<circle class="blob" cx="10%" cy="10%" r="80" fill="white" stroke="white"/>
<circle class="blob" cx="50%" cy="10%" r="40" fill="white" stroke="white"/>
<circle class="blob" cx="17%" cy="15%" r="70" fill="white" stroke="white"/>
<circle class="blob" cx="90%" cy="20%" r="120" fill="white" stroke="white"/>
<circle class="blob" cx="30%" cy="25%" r="30" fill="white" stroke="white"/>
<circle class="blob" cx="50%" cy="60%" r="80" fill="white" stroke="white"/>
<circle class="blob" cx="70%" cy="90%" r="10" fill="white" stroke="white"/>
<circle class="blob" cx="90%" cy="60%" r="90" fill="white" stroke="white"/>
<circle class="blob" cx="30%" cy="90%" r="80" fill="white" stroke="white"/>
<circle class="blob" cx="10%" cy="10%" r="80" fill="white" stroke="white"/>
<circle class="blob" cx="50%" cy="10%" r="20" fill="white" stroke="white"/>
<circle class="blob" cx="17%" cy="15%" r="70" fill="white" stroke="white"/>
<circle class="blob" cx="40%" cy="20%" r="120" fill="white" stroke="white"/>
<circle class="blob" cx="30%" cy="25%" r="30" fill="white" stroke="white"/>
<circle class="blob" cx="80%" cy="60%" r="80" fill="white" stroke="white"/>
<circle class="blob" cx="17%" cy="10%" r="100" fill="white" stroke="white"/>
<circle class="blob" cx="40%" cy="60%" r="90" fill="white" stroke="white"/>
<circle class="blob" cx="10%" cy="50%" r="80" fill="white" stroke="white"/>
</g>
</mask>
<filter id="gooey" height="130%">
<feGaussianBlur in="SourceGraphic" stdDeviation="15" result="blur" />
<feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 18 -7" result="goo" />
</filter>
</svg>
scss:
body , .bgImage {
margin: 0;
height: 100%;
width: 100%;
overflow: hidden;
}
.bgImage {
position: absolute;
background-image: url(https://images.unsplash.com/photo-1500462918059-b1a0cb512f1d?ixlib=rb-0.3.5&s=e20bc3d490c974d9ea190e05c47962f5&auto=format&fit=crop&w=634&q=80);
background-size: cover;
background-position: top;
-webkit-filter: grayscale(70%); /* Safari 6.0 - 9.0 */
filter: grayscale(70%);
z-index: -1;
}
.blobCont {
position: absolute;
width: 100vw;
height: 100vh;
}
#for $i from 1 through 18 {
$a : #{$i*90};
$b : #{$i*90+360};
.blob:nth-child(#{$i}) {
animation: move#{$i} 20s infinite linear;
}
#keyframes move#{$i} {
from {
transform:rotate(#{$a}deg) translate( 200px ,0.1px) rotate(-#{$a}deg);
}
to {
transform:rotate(#{$b}deg) translate( 200px ,0.1px) rotate(-#{$b}deg);
}
}
}
and if needs, css compiled from scss
body, .bgImage {
margin: 0;
height: 100%;
width: 100%;
overflow: hidden;
}
.bgImage {
position: absolute;
background-image: url(https://images.unsplash.com/photo-1500462918059-b1a0cb512f1d?ixlib=rb-0.3.5&s=e20bc3d490c974d9ea190e05c47962f5&auto=format&fit=crop&w=634&q=80);
background-size: cover;
background-position: top;
-webkit-filter: grayscale(70%);
/* Safari 6.0 - 9.0 */
filter: grayscale(70%);
z-index: -1;
}
.blobCont {
position: absolute;
width: 100vw;
height: 100vh;
}
.blob:nth-child(1) {
animation: move1 20s infinite linear;
}
#keyframes move1 {
from {
transform: rotate(90deg) translate(200px, 0.1px) rotate(-90deg);
}
to {
transform: rotate(450deg) translate(200px, 0.1px) rotate(-450deg);
}
}
.blob:nth-child(2) {
animation: move2 20s infinite linear;
}
#keyframes move2 {
from {
transform: rotate(180deg) translate(200px, 0.1px) rotate(-180deg);
}
to {
transform: rotate(540deg) translate(200px, 0.1px) rotate(-540deg);
}
}
.blob:nth-child(3) {
animation: move3 20s infinite linear;
}
#keyframes move3 {
from {
transform: rotate(270deg) translate(200px, 0.1px) rotate(-270deg);
}
to {
transform: rotate(630deg) translate(200px, 0.1px) rotate(-630deg);
}
}
.blob:nth-child(4) {
animation: move4 20s infinite linear;
}
#keyframes move4 {
from {
transform: rotate(360deg) translate(200px, 0.1px) rotate(-360deg);
}
to {
transform: rotate(720deg) translate(200px, 0.1px) rotate(-720deg);
}
}
.blob:nth-child(5) {
animation: move5 20s infinite linear;
}
#keyframes move5 {
from {
transform: rotate(450deg) translate(200px, 0.1px) rotate(-450deg);
}
to {
transform: rotate(810deg) translate(200px, 0.1px) rotate(-810deg);
}
}
.blob:nth-child(6) {
animation: move6 20s infinite linear;
}
#keyframes move6 {
from {
transform: rotate(540deg) translate(200px, 0.1px) rotate(-540deg);
}
to {
transform: rotate(900deg) translate(200px, 0.1px) rotate(-900deg);
}
}
.blob:nth-child(7) {
animation: move7 20s infinite linear;
}
#keyframes move7 {
from {
transform: rotate(630deg) translate(200px, 0.1px) rotate(-630deg);
}
to {
transform: rotate(990deg) translate(200px, 0.1px) rotate(-990deg);
}
}
.blob:nth-child(8) {
animation: move8 20s infinite linear;
}
#keyframes move8 {
from {
transform: rotate(720deg) translate(200px, 0.1px) rotate(-720deg);
}
to {
transform: rotate(1080deg) translate(200px, 0.1px) rotate(-1080deg);
}
}
.blob:nth-child(9) {
animation: move9 20s infinite linear;
}
#keyframes move9 {
from {
transform: rotate(810deg) translate(200px, 0.1px) rotate(-810deg);
}
to {
transform: rotate(1170deg) translate(200px, 0.1px) rotate(-1170deg);
}
}
.blob:nth-child(10) {
animation: move10 20s infinite linear;
}
#keyframes move10 {
from {
transform: rotate(900deg) translate(200px, 0.1px) rotate(-900deg);
}
to {
transform: rotate(1260deg) translate(200px, 0.1px) rotate(-1260deg);
}
}
.blob:nth-child(11) {
animation: move11 20s infinite linear;
}
#keyframes move11 {
from {
transform: rotate(990deg) translate(200px, 0.1px) rotate(-990deg);
}
to {
transform: rotate(1350deg) translate(200px, 0.1px) rotate(-1350deg);
}
}
.blob:nth-child(12) {
animation: move12 20s infinite linear;
}
#keyframes move12 {
from {
transform: rotate(1080deg) translate(200px, 0.1px) rotate(-1080deg);
}
to {
transform: rotate(1440deg) translate(200px, 0.1px) rotate(-1440deg);
}
}
.blob:nth-child(13) {
animation: move13 20s infinite linear;
}
#keyframes move13 {
from {
transform: rotate(1170deg) translate(200px, 0.1px) rotate(-1170deg);
}
to {
transform: rotate(1530deg) translate(200px, 0.1px) rotate(-1530deg);
}
}
.blob:nth-child(14) {
animation: move14 20s infinite linear;
}
#keyframes move14 {
from {
transform: rotate(1260deg) translate(200px, 0.1px) rotate(-1260deg);
}
to {
transform: rotate(1620deg) translate(200px, 0.1px) rotate(-1620deg);
}
}
.blob:nth-child(15) {
animation: move15 20s infinite linear;
}
#keyframes move15 {
from {
transform: rotate(1350deg) translate(200px, 0.1px) rotate(-1350deg);
}
to {
transform: rotate(1710deg) translate(200px, 0.1px) rotate(-1710deg);
}
}
.blob:nth-child(16) {
animation: move16 20s infinite linear;
}
#keyframes move16 {
from {
transform: rotate(1440deg) translate(200px, 0.1px) rotate(-1440deg);
}
to {
transform: rotate(1800deg) translate(200px, 0.1px) rotate(-1800deg);
}
}
.blob:nth-child(17) {
animation: move17 20s infinite linear;
}
#keyframes move17 {
from {
transform: rotate(1530deg) translate(200px, 0.1px) rotate(-1530deg);
}
to {
transform: rotate(1890deg) translate(200px, 0.1px) rotate(-1890deg);
}
}
.blob:nth-child(18) {
animation: move18 20s infinite linear;
}
#keyframes move18 {
from {
transform: rotate(1620deg) translate(200px, 0.1px) rotate(-1620deg);
}
to {
transform: rotate(1980deg) translate(200px, 0.1px) rotate(-1980deg);
}
}
When I say that it doesn't work, I mean that the bubbles do not move. The animation doesn't work on firefox. But on chrome yes.

From mozilla's developer page regarding CSS transform:
Only elements positioned by the box model can be transformed. As a rule of thumb, an element is positioned by the box model if it has display: block.
Link: https://developer.mozilla.org/en-US/docs/Web/CSS/transform

Related

Make goo effect only when it's in contact with the main shape

I'm using this as a pre-loader and it's working pretty good, but I'd like the "goo" effect to only happen when the moving shapes are actually in contact with the circle in the middle. See how the edges are all blurred up at all times now.
I like that the moving shapes blurs up right when they're in contact with the circle, but when they're at max away from it they should be 100% normal. The way the shape should look like when not in contact with the middle circle:
You can try to comment off the url("#goo") part to see the normal state as well.
.page-preloader-cover {
position: fixed;
z-index: 1200;
top: 0;
left: 0;
display: block;
width: 100%;
height: 100%;
background-color: #fff;
}
.cssload-dots {
width: 200px;
height: 200px;
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
margin: auto;
filter: url("#goo");
-o-filter: url("#goo");
-ms-filter: url("#goo");
-webkit-filter: url("#goo");
-moz-filter: url("#goo");
}
.svg-filter {
position: absolute;
}
.cssload-dot {
width: 0;
height: 0;
position: absolute;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%);
-ms-transform: translate(-50%);
transform: translate(-50%);
}
.cssload-dot:before {
content: "";
width: 48px;
height: 48px;
border-radius: 69px;
background: #9664B4;
position: absolute;
left: 50%;
transform: translateY(0);
-o-transform: translateY(0);
-ms-transform: translateY(0);
-webkit-transform: translateY(0);
-moz-transform: translateY(0);
margin-left: -24.5px;
margin-top: -24.5px;
}
.cssload-dot:nth-child(5):before {
z-index: 100;
width: 62.5px;
height: 62.5px;
margin-left: -31.75px;
margin-top: -31.75px;
animation: cssload-dot-colors 4.6s ease infinite;
-o-animation: cssload-dot-colors 4.6s ease infinite;
-ms-animation: cssload-dot-colors 4.6s ease infinite;
-webkit-animation: cssload-dot-colors 4.6s ease infinite;
-moz-animation: cssload-dot-colors 4.6s ease infinite;
}
.cssload-dot:nth-child(1) {
animation: cssload-dot-rotate-1 4.6s 0s linear infinite;
-o-animation: cssload-dot-rotate-1 4.6s 0s linear infinite;
-ms-animation: cssload-dot-rotate-1 4.6s 0s linear infinite;
-webkit-animation: cssload-dot-rotate-1 4.6s 0s linear infinite;
-moz-animation: cssload-dot-rotate-1 4.6s 0s linear infinite;
}
.cssload-dot:nth-child(1):before {
background-color: transparent;
animation: cssload-dot-move 4.6s 0s ease infinite;
-o-animation: cssload-dot-move 4.6s 0s ease infinite;
-ms-animation: cssload-dot-move 4.6s 0s ease infinite;
-webkit-animation: cssload-dot-move 4.6s 0s ease infinite;
-moz-animation: cssload-dot-move 4.6s 0s ease infinite;
background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 150 150" xmlns="http://www.w3.org/2000/svg"><path style="fill:%2355AF32;" d="M 120 0 L 120 100 A 50 50 0 1 1 20 100 Z"></path></svg>') !important;
}
.cssload-dot:nth-child(2) {
animation: cssload-dot-rotate-2 4.6s 1.15s linear infinite;
-o-animation: cssload-dot-rotate-2 4.6s 1.15s linear infinite;
-ms-animation: cssload-dot-rotate-2 4.6s 1.15s linear infinite;
-webkit-animation: cssload-dot-rotate-2 4.6s 1.15s linear infinite;
-moz-animation: cssload-dot-rotate-2 4.6s 1.15s linear infinite;
}
.cssload-dot:nth-child(2):before {
background-color: transparent;
animation: cssload-dot-move 4.6s 1.15s ease infinite;
-o-animation: cssload-dot-move 4.6s 1.15s ease infinite;
-ms-animation: cssload-dot-move 4.6s 1.15s ease infinite;
-webkit-animation: cssload-dot-move 4.6s 1.15s ease infinite;
-moz-animation: cssload-dot-move 4.6s 1.15s ease infinite;
background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 150 150" xmlns="http://www.w3.org/2000/svg"><path style="fill:%23ff4a49;" d="M 120 0 L 120 100 A 50 50 0 1 1 20 100 Z"></path></svg>') !important;
}
.cssload-dot:nth-child(3) {
animation: cssload-dot-rotate-3 4.6s 2.3s linear infinite;
-o-animation: cssload-dot-rotate-3 4.6s 2.3s linear infinite;
-ms-animation: cssload-dot-rotate-3 4.6s 2.3s linear infinite;
-webkit-animation: cssload-dot-rotate-3 4.6s 2.3s linear infinite;
-moz-animation: cssload-dot-rotate-3 4.6s 2.3s linear infinite;
}
.cssload-dot:nth-child(3):before {
background-color: transparent;
animation: cssload-dot-move 4.6s 2.3s ease infinite;
-o-animation: cssload-dot-move 4.6s 2.3s ease infinite;
-ms-animation: cssload-dot-move 4.6s 2.3s ease infinite;
-webkit-animation: cssload-dot-move 4.6s 2.3s ease infinite;
-moz-animation: cssload-dot-move 4.6s 2.3s ease infinite;
background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 150 150" xmlns="http://www.w3.org/2000/svg"><path style="fill:%230A4B9B;" d="M 120 0 L 120 100 A 50 50 0 1 1 20 100 Z"></path></svg>') !important;
}
.cssload-dot:nth-child(4) {
animation: cssload-dot-rotate-4 4.6s 3.45s linear infinite;
-o-animation: cssload-dot-rotate-4 4.6s 3.45s linear infinite;
-ms-animation: cssload-dot-rotate-4 4.6s 3.45s linear infinite;
-webkit-animation: cssload-dot-rotate-4 4.6s 3.45s linear infinite;
-moz-animation: cssload-dot-rotate-4 4.6s 3.45s linear infinite;
}
.cssload-dot:nth-child(4):before {
background-color: transparent;
animation: cssload-dot-move 4.6s 3.45s ease infinite;
-o-animation: cssload-dot-move 4.6s 3.45s ease infinite;
-ms-animation: cssload-dot-move 4.6s 3.45s ease infinite;
-webkit-animation: cssload-dot-move 4.6s 3.45s ease infinite;
-moz-animation: cssload-dot-move 4.6s 3.45s ease infinite;
background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 150 150" xmlns="http://www.w3.org/2000/svg"><path style="fill:%239664B4;" d="M 120 0 L 120 100 A 50 50 0 1 1 20 100 Z"></path></svg>') !important;
}
#keyframes cssload-dot-move {
0% {
transform: translateY(0);
}
18%, 22% {
transform: translateY(-96px);
}
40%, 100% {
transform: translateY(0);
}
}
#-o-keyframes cssload-dot-move {
0% {
-o-transform: translateY(0);
}
18%, 22% {
-o-transform: translateY(-96px);
}
40%, 100% {
-o-transform: translateY(0);
}
}
#-ms-keyframes cssload-dot-move {
0% {
-ms-transform: translateY(0);
}
18%, 22% {
-ms-transform: translateY(-96px);
}
40%, 100% {
-ms-transform: translateY(0);
}
}
#-webkit-keyframes cssload-dot-move {
0% {
-webkit-transform: translateY(0);
}
18%, 22% {
-webkit-transform: translateY(-96px);
}
40%, 100% {
-webkit-transform: translateY(0);
}
}
#-moz-keyframes cssload-dot-move {
0% {
-moz-transform: translateY(0);
}
18%, 22% {
-moz-transform: translateY(-96px);
}
40%, 100% {
-moz-transform: translateY(0);
}
}
#keyframes cssload-dot-colors {
0% {
background-color: #9664B4; /*#7a6cea*/
}
25% {
background-color: #55AF32; /*#2be1df*/
}
50% {
background-color: #E61423; /*#ff4a4a*/
}
75% {
background-color: #0A4B9B; /*#3b55e6*/
}
100% {
background-color: #9664B4;
}
}
#-o-keyframes cssload-dot-colors {
0% {
background-color: #9664B4;
}
25% {
background-color: #55AF32;
}
50% {
background-color: #ff4a49;
}
75% {
background-color: #0A4B9B;
}
100% {
background-color: #9664B4;
}
}
#-ms-keyframes cssload-dot-colors {
0% {
background-color: #9664B4;
}
25% {
background-color: #55AF32;
}
50% {
background-color: #ff4a49;
}
75% {
background-color: #0A4B9B;
}
100% {
background-color: #9664B4;
}
}
#-webkit-keyframes cssload-dot-colors {
0% {
background-color: #9664B4;
}
25% {
background-color: #55AF32;
}
50% {
background-color: #ff4a49;
}
75% {
background-color: #0A4B9B;
}
100% {
background-color: #9664B4;
}
}
#-moz-keyframes cssload-dot-colors {
0% {
background-color: #9664B4;
}
25% {
background-color: #55AF32;
}
50% {
background-color: #ff4a49;
}
75% {
background-color: #0A4B9B;
}
100% {
background-color: #9664B4;
}
}
#keyframes cssload-dot-rotate-1 {
0% {
transform: rotate(-105deg);
}
100% {
transform: rotate(270deg);
}
}
#-o-keyframes cssload-dot-rotate-1 {
0% {
-o-transform: rotate(-105deg);
}
100% {
-o-transform: rotate(270deg);
}
}
#-ms-keyframes cssload-dot-rotate-1 {
0% {
-ms-transform: rotate(-105deg);
}
100% {
-ms-transform: rotate(270deg);
}
}
#-webkit-keyframes cssload-dot-rotate-1 {
0% {
-webkit-transform: rotate(-105deg);
}
100% {
-webkit-transform: rotate(270deg);
}
}
#-moz-keyframes cssload-dot-rotate-1 {
0% {
-moz-transform: rotate(-105deg);
}
100% {
-moz-transform: rotate(270deg);
}
}
#keyframes cssload-dot-rotate-2 {
0% {
transform: rotate(165deg);
}
100% {
transform: rotate(540deg);
}
}
#-o-keyframes cssload-dot-rotate-2 {
0% {
-o-transform: rotate(165deg);
}
100% {
-o-transform: rotate(540deg);
}
}
#-ms-keyframes cssload-dot-rotate-2 {
0% {
-ms-transform: rotate(165deg);
}
100% {
-ms-transform: rotate(540deg);
}
}
#-webkit-keyframes cssload-dot-rotate-2 {
0% {
-webkit-transform: rotate(165deg);
}
100% {
-webkit-transform: rotate(540deg);
}
}
#-moz-keyframes cssload-dot-rotate-2 {
0% {
-moz-transform: rotate(165deg);
}
100% {
-moz-transform: rotate(540deg);
}
}
#keyframes cssload-dot-rotate-3 {
0% {
transform: rotate(435deg);
}
100% {
transform: rotate(810deg);
}
}
#-o-keyframes cssload-dot-rotate-3 {
0% {
-o-transform: rotate(435deg);
}
100% {
-o-transform: rotate(810deg);
}
}
#-ms-keyframes cssload-dot-rotate-3 {
0% {
-ms-transform: rotate(435deg);
}
100% {
-ms-transform: rotate(810deg);
}
}
#-webkit-keyframes cssload-dot-rotate-3 {
0% {
-webkit-transform: rotate(435deg);
}
100% {
-webkit-transform: rotate(810deg);
}
}
#-moz-keyframes cssload-dot-rotate-3 {
0% {
-moz-transform: rotate(435deg);
}
100% {
-moz-transform: rotate(810deg);
}
}
#keyframes cssload-dot-rotate-4 {
0% {
transform: rotate(705deg);
}
100% {
transform: rotate(1080deg);
}
}
#-o-keyframes cssload-dot-rotate-4 {
0% {
-o-transform: rotate(705deg);
}
100% {
-o-transform: rotate(1080deg);
}
}
#-ms-keyframes cssload-dot-rotate-4 {
0% {
-ms-transform: rotate(705deg);
}
100% {
-ms-transform: rotate(1080deg);
}
}
#-webkit-keyframes cssload-dot-rotate-4 {
0% {
-webkit-transform: rotate(705deg);
}
100% {
-webkit-transform: rotate(1080deg);
}
}
#-moz-keyframes cssload-dot-rotate-4 {
0% {
-moz-transform: rotate(705deg);
}
100% {
-moz-transform: rotate(1080deg);
}
}
<div class="page-preloader-cover">
<div class="cssload-dots">
<div class="cssload-dot"></div>
<div class="cssload-dot"></div>
<div class="cssload-dot"></div>
<div class="cssload-dot"></div>
<div class="cssload-dot"></div>
</div>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" class="svg-filter">
<defs>
<filter id="goo">
<feGaussianBlur in="SourceGraphic" result="blur" stdDeviation="12"></feGaussianBlur>
<feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 18 -7" result="goo" ></feColorMatrix>
</filter>
</defs>
</svg>
</div>
Here's your loader converted to SVG format.
The relevant part related to the blob blur is here:
<feGaussianBlur in="SourceGraphic" result="blur" stdDeviation="12">
<animate attributeName="stdDeviation"
keyTimes="0; 0.5; 0.9; 1.0"
values="12; 0; 0; 12"
dur="1.15s" repeatCount="indefinite"/>
</feGaussianBlur>
What's happening is that the blur reduces to 0 and back to 12 again every 1.15s to coincide with the movement of the shapes. Over that 1.15sec interval, stdDeviation goes:
from 12 at (0 * 1.15s) to 0 at (0.5 * 1.15s), then
from 0 at (0.9 * 1.15s) to 12 at (1 * 1.15s)
IOW, the keyTimes values represent percentages of that 1.15s animation duration. If you wish, you can tweak those keyTimes values to adjust the timing of the blur animation.
.page-preloader-cover {
position: fixed;
z-index: 1200;
top: 0;
left: 0;
display: block;
width: 100%;
height: 100%;
background-color: #fff;
}
.page-preloader-cover svg {
width: 200px;
height: 200px;
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
overflow: visible;
}
<div class="page-preloader-cover">
<svg viewBox="0 0 200 200">
<defs>
<filter id="goo">
<feGaussianBlur in="SourceGraphic" result="blur" stdDeviation="12">
<animate attributeName="stdDeviation"
keyTimes="0; 0.5; 0.9; 1.0"
values="12; 2; 2; 12"
dur="1.15s" repeatCount="indefinite"/>
</feGaussianBlur>
<feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 18 -7" result="goo" ></feColorMatrix>
</filter>
<symbol id="shape" viewBox="0 0 150 150">
<path d="M 120 0 L 120 100 A 50 50 0 1 1 20 100 Z"/>
</symbol>
</defs>
<g transform="translate(100,100)" filter="url(#goo)">
<animate attributeName="filter"
keyTimes="0; 0.4; 0.9; 1.0"
values="url(#goo); none; none; url(#goo)"
dur="1.15s" repeatCount="indefinite"/>
<g>
<use x="-24" y="-24" width="48" height="48" xlink:href="#shape" fill="#55AF32">
<animate attributeName="y" dur="4.6s" repeatCount="indefinite"
calcMode="spline"
keySplines="0.25 0.1 0.25 1.0; 0.25 0.1 0.25 1.0; 0.25 0.1 0.25 1.0; 0.25 0.1 0.25 1.0"
keyTimes="0; 0.18; 0.22; 0.4; 1.0"
values="-24; -120; -120; -24; -24"/>
</use>
<animateTransform attributeName="transform"
type="rotate" from="-105" to="270"
dur="4.6s" repeatCount="indefinite"/>
</g>
<g>
<use x="-24" y="-24" width="48" height="48" xlink:href="#shape" fill="#ff4a49">
<animate attributeName="y" dur="4.6s" repeatCount="indefinite" begin="1.15s"
calcMode="spline"
keySplines="0.25 0.1 0.25 1.0; 0.25 0.1 0.25 1.0; 0.25 0.1 0.25 1.0; 0.25 0.1 0.25 1.0"
keyTimes="0; 0.18; 0.22; 0.4; 1.0"
values="-24; -120; -120; -24; -24"/>
</use>
<animateTransform attributeName="transform"
type="rotate" from="165" to="540"
dur="4.6s" repeatCount="indefinite" begin="1.15s"/>
</g>
<g>
<use x="-24" y="-24" width="48" height="48" xlink:href="#shape" fill="#0A4B9B">
<animate attributeName="y" dur="4.6s" repeatCount="indefinite" begin="2.3s"
calcMode="spline"
keySplines="0.25 0.1 0.25 1.0; 0.25 0.1 0.25 1.0; 0.25 0.1 0.25 1.0; 0.25 0.1 0.25 1.0"
keyTimes="0; 0.18; 0.22; 0.4; 1.0"
values="-24; -120; -120; -24; -24"/>
</use>
<animateTransform attributeName="transform"
type="rotate" from="435" to="810"
dur="4.6s" repeatCount="indefinite" begin="2.35s"/>
</g>
<g>
<use x="-24" y="-24" width="48" height="48" xlink:href="#shape" fill="#9664B4">
<animate attributeName="y" dur="4.6s" repeatCount="indefinite" begin="3.45s"
calcMode="spline"
keySplines="0.25 0.1 0.25 1.0; 0.25 0.1 0.25 1.0; 0.25 0.1 0.25 1.0; 0.25 0.1 0.25 1.0"
keyTimes="0; 0.18; 0.22; 0.4; 1.0"
values="-24; -120; -120; -24; -24"/>
</use>
<animateTransform attributeName="transform"
type="rotate" from="705" to="1080"
dur="4.6s" repeatCount="indefinite" begin="3.45s"/>
</g>
<circle cx="0" cy="0" r="31.25" fill="#9664B4">
<animate attributeName="fill" dur="4.6s" repeatCount="indefinite"
keyTimes="0; 0.25; 0.5; 0.75; 1"
values="#9664B4; #55AF32; #E61423; #0A4B9B; #9664B4"/>
</circle>
</g>
</svg>
</div>

Change HTML <g> size

I want to change the size of Rocket in below source code:
https://jsfiddle.net/umaar/4FMyA/
I have been trying many ways, but still has no effect.
Actually, I want to make the Rocket a bit smaller.
Thanks
/*=============================================
[ Page Setup ]
==============================================*/
body {
background: #34495e
}
#pageWrap {
width: 100%;
overflow: hidden;
}
#rocket {
display: block;
margin: 0 auto;
margin-top: 150px;
}
/*=============================================
[ Inactive State Styles ]
==============================================*/
.rocket_inner {
transform: translateY(15px) translateX(-3px);
-webkit-transition: .3s;
-moz-transition: .3s;
transition: .3s;
}
.icon_circle {
transition: .2s;
fill: #22303e;
}
.large_window_path {
transition: .2s;
fill: #22303e;
}
.small_window_path {
fill: #22303e;
}
.wing_shadow {
fill: #34495e;
}
.rocket_bottom {
fill: #34495e
}
.rocket_base {
fill: #34495e
}
.rocket_shadow {
fill: #34495e
}
.window_grandient {
stop-color: #2DCB73
}
.window_grandient1 {
stop-color: #2AC16D
}
.window_grandient2 {
stop-color: #29B968
}
.window_grandient3 {
stop-color: #28B767
}
.wing_base {
fill: #34495e
}
.fire_path {
fill: #FC0
}
/*=============================================
[ Hover Styles ]
==============================================*/
.rocket_wrap:hover .rocket_base {
fill: #FFFFFF !important;
stroke-width: 0px !important;
}
.rocket_wrap:hover .rocket_shadow {
fill: #EDEDED !important;
stroke-width: 0px !important;
}
.rocket_wrap:hover .icon_circle {
fill: #282e3a !important;
stroke: #fff !important;
stroke-width: 7px !important;
}
.rocket_wrap:hover .small_window_path {
fill: #28B767 !important;
stroke-width: 0px !important;
}
.rocket_wrap:hover .wing_shadow {
display: block !important;
fill: #FC9252 !important;
}
.rocket_wrap:hover .wing_base {
fill: #E16E36 !important;
stroke-width: 0px !important;
}
.rocket_wrap:hover .rocket_bottom {
fill: #2DCB73 !important;
stroke-width: 0px !important;
}
.rocket_wrap:hover .large_window_path {
fill: url(#SVGID_2_) !important;
stroke-width: 0px !important;
}
.rocket_wrap:hover .rocket_inner {
transform: translateY(0px) translateX(-3px) !important;
}
/*=============================================
[ Animation Classes ]
==============================================*/
.fire {
display: none;
animation-delay: 0s;
fill-opacity: 1;
animation-timing-function: ease-in;
stroke-width: 0px;
animation-iteration-count: infinite;
animation-timing-function: linear;
transform-origin: 50% 50%;
animation-direction: normal;
}
.rocket_wrap:hover #fireLeft {
display: block;
animation-delay: 0s;
animation-name: fireLeft, fillOpacity1;
animation-duration: 1.2s;
}
.rocket_wrap:hover #fireMiddle {
display: block;
animation-delay: 0s;
animation-name: fireMiddle, fillOpacity1;
animation-duration: 1s;
}
.rocket_wrap:hover #fireRight {
display: block;
animation-delay: 0s;
animation-name: fireRight, fillOpacity1;
animation-duration: 1.3s;
}
.rocket_wrap:hover #fireSmallLeft {
display: block;
animation-delay: 0s;
animation-name: fireSmall, fillOpacity2;
animation-duration: 1.3s;
transform-origin: bottom;
}
.rocket_wrap:hover #fireSmallRight {
display: block;
animation-delay: 0.3s;
animation-name: fireSmall, fillOpacity3;
animation-duration: 1.6s;
transform-origin: bottom;
}
/*=============================================
[ KeyFrame Animations ]
==============================================*/
#keyframes fireSmall {
10% {
transform: rotate(17deg) translateY(1px)
}
20% {
transform: rotate(-13deg) translateY(2px)
}
30% {
transform: rotate(21deg) translateY(3px)
}
40% {
transform: rotate(-34deg)translateY(4px)
}
50% {
transform: rotate(24deg) translateY(5px)
}
60% {
transform: rotate(-17deg) translateY(6px)
}
70% {
transform: rotate(31deg) translateY(7px)
}
80% {
transform: rotate(-28deg) translateY(8px)
}
90% {
transform: rotate(14deg) translateY(9px)
}
99% {
transform: rotate(0deg) translateY(10px)
}
}
#keyframes fireLeft {
6% {
transform: rotate(25deg)
}
15% {
transform: rotate(-19deg)
}
25% {
transform: rotate(25deg)
}
32% {
transform: rotate(-30deg)
}
46% {
transform: rotate(22deg)
}
54% {
transform: rotate(-29deg)
}
61% {
transform: rotate(32deg)
}
74% {
transform: rotate(-9deg)
}
83% {
transform: rotate(16deg)
}
99% {
transform: rotate(0deg)
}
}
#keyframes fireMiddle {
10% {
transform: rotate(25deg)
}
20% {
transform: rotate(-25deg)
}
30% {
transform: rotate(30deg)
}
40% {
transform: rotate(-22deg)
}
50% {
transform: rotate(29deg)
}
60% {
transform: rotate(-45deg)
}
70% {
transform: rotate(37deg)
}
80% {
transform: rotate(-15deg)
}
90% {
transform: rotate(16deg)
}
99% {
transform: rotate(0deg)
}
}
#keyframes fireRight {
15% {
transform: rotate(17deg)
}
23% {
transform: rotate(-13deg)
}
37% {
transform: rotate(21deg)
}
45% {
transform: rotate(-34deg)
}
54% {
transform: rotate(24deg)
}
67% {
transform: rotate(-17deg)
}
72% {
transform: rotate(31deg)
}
84% {
transform: rotate(-28deg)
}
96% {
transform: rotate(14deg)
}
99% {
transform: rotate(0deg)
}
}
#keyframes fillOpacity1 {
0% {
fill-opacity: 1;
stroke-opacity: 1;
}
50% {
fill-opacity: 1;
stroke-opacity: 1;
}
100% {
fill-opacity: 0;
stroke-opacity: 0;
}
}
#keyframes fillOpacity2 {
0% {
fill-opacity: 1;
stroke-opacity: 1;
}
25% {
fill-opacity: 1;
stroke-opacity: 1;
}
100% {
fill-opacity: 0;
stroke-opacity: 0;
}
}
#keyframes fillOpacity3 {
0% {
fill-opacity: 1;
stroke-opacity: 1;
}
67% {
fill-opacity: 1;
stroke-opacity: 1;
}
100% {
fill-opacity: 0;
stroke-opacity: 0;
}
}
#keyframes rocektMove {
0% {
transform: translateY(0px)
}
100% {
transform: translateY(20px)
}
}
<!-- http://www.pencilscoop.com/2013/11/animate-svg-icons-with-css3-jquery/ -->
<div id="pageWrap">
<svg version="1.1" x="0px" y="0px" width="307px" height="283px" id="rocket">
<g class="rocket_wrap">
<circle cx="147.5" cy="138.6" r="105.5" class="icon_circle"/>
<g class="rocket_inner">
<path class="fire fire_path" id="fireMiddle" d="M148.891,179.906c3.928,0,7.111,3.176,7.111,7.094 c0,7.78-7.111,16-7.111,16s-7.111-8.349-7.111-16C141.78,183.082,144.963,179.906,148.891,179.906z"/>
<path class="fire_path fire" id="fireRight" d="M154.063,181.092c3.577-1.624,7.788-0.048,9.408,3.52 c3.216,7.084,0.139,17.508,0.139,17.508s-9.927-4.662-13.09-11.63C148.9,186.923,150.487,182.715,154.063,181.092z"/>
<path class="fire_path fire" id="fireLeft" d="M143.392,182.519c3.25,2.207,4.098,6.623,1.896,9.864 c-4.372,6.436-14.873,9.238-14.873,9.238s-1.191-10.902,3.108-17.23C135.725,181.149,140.143,180.312,143.392,182.519z"/>
<path class="fire_path fire" id="fireSmallLeft" d="M143.193 187.531c2.226 0.4 3.7 2.6 3.2 4.8 c-0.875 4.407-5.829 8.264-5.829 8.264s-3.09-5.53-2.229-9.865C138.807 188.5 141 187.1 143.2 187.531z"/>
<path class="fire_path fire" id="fireSmallRight" d="M152.089 188.599c2.043-0.985 4.496-0.132 5.5 1.9 c1.952 4 0.3 10.1 0.3 10.107s-5.795-2.56-7.713-6.541C149.186 192 150 189.6 152.1 188.599z"/>
<path class="rocket_bottom" d="M157.069 171.31h-3.292c-1.562-0.048-3.178-0.076-4.846-0.076 s-3.284 0.028-4.846 0.076h-3.292c-7.277-7.938-12.371-26.182-12.371-47.434c0-28.54 9.182-51.676 20.508-51.676 c11.327 0 20.5 23.1 20.5 51.676C169.44 145.1 164.3 163.4 157.1 171.31z"/>
<g id="right_wing_wrap">
<path class="wing_base" d="M166.678 127.161c0 0 17.7 3.3 12.9 48.099l-18.06-14.05 L166.678 127.161z"/>
<path class="wing_shadow" d="M158.225 140.336c10.481-5.584 22.7 22.2 21.4 34.9 l-18.06-14.05C161.542 161.2 156.1 144.3 158.2 140.336z"/>
</g>
<g id="left_wing_wrap">
<path class="wing_base" d="M135.131 161.21l-18.06 14.1 c-4.805-44.793 12.924-48.099 12.924-48.099L135.131 161.21z"/>
<path class="wing_shadow" d="M135.131 161.21l-18.06 14.1 c-1.367-12.746 10.896-40.509 21.377-34.924C140.614 144.3 135.1 161.2 135.1 161.21z"/>
</g>
<g id="rocket_body_wrap">
<path class="rocket_base" d="M162.728 167.358c-3.778-0.623-8.573-0.996-13.796-0.996 s-10.018 0.373-13.795 0.996c-5.033-10.186-8.257-25.808-8.257-43.338c0-30.688 9.873-55.566 22.052-55.566 s22.053 24.9 22.1 55.566C170.984 141.6 167.8 157.2 162.7 167.358z" />
<path class="rocket_shadow" d="M145.464 166.417c19.578-40.575 7.26-85.229 4.112-98.067 c11.88 0.9 21.4 25.4 21.4 55.525c0 17.529-3.225 33.152-8.257 43.337c0 0-3.786-0.472-8.069-0.697 S145.464 166.4 145.5 166.417z"/>
</g>
<g id="large_window_wrap">
<radialgradient id="SVGID_2_" cx="148.9" cy="112.5" r="15.2" fx="139.4853" fy="112.5239" gradientunits="userSpaceOnUse">
<stop offset="0" class="window_grandient"/>
<stop offset="0.5868" class="window_grandient"/>
<stop offset="0.6834" class="window_grandient"/>
<stop offset="0.6845" class="window_grandient1"/>
<stop offset="0.6861" class="window_grandient2"/>
<stop offset="0.6897" class="window_grandient3"/>
</radialgradient>
<circle class="large_window_path" cx="148.9" cy="111.3" r="10.5"/>
</g>
<circle class="small_window_path" cx="148.9" cy="132.4" r="5.2"/>
</g>
</g>
</svg>
</div>
for any suggestion.
You may simply use scale on the most upper g and adjust position by adding a translation if needed:
/*=============================================
[ Page Setup ]
==============================================*/
body {
background: #34495e
}
#pageWrap {
width: 100%;
overflow: hidden;
}
#rocket {
display: block;
margin: 0 auto;
margin-top: 150px;
}
/*=============================================
[ Inactive State Styles ]
==============================================*/
.rocket_inner {
transform: translateY(15px) translateX(-3px);
-webkit-transition: .3s;
-moz-transition: .3s;
transition: .3s;
}
.icon_circle {
transition: .2s;
fill: #22303e;
}
.large_window_path {
transition: .2s;
fill: #22303e;
}
.small_window_path {
fill: #22303e;
}
.wing_shadow {
fill: #34495e;
}
.rocket_bottom {
fill: #34495e
}
.rocket_base {
fill: #34495e
}
.rocket_shadow {
fill: #34495e
}
.window_grandient {
stop-color: #2DCB73
}
.window_grandient1 {
stop-color: #2AC16D
}
.window_grandient2 {
stop-color: #29B968
}
.window_grandient3 {
stop-color: #28B767
}
.wing_base {
fill: #34495e
}
.fire_path {
fill: #FC0
}
/*=============================================
[ Hover Styles ]
==============================================*/
.rocket_wrap:hover .rocket_base {
fill: #FFFFFF !important;
stroke-width: 0px !important;
}
.rocket_wrap:hover .rocket_shadow {
fill: #EDEDED !important;
stroke-width: 0px !important;
}
.rocket_wrap:hover .icon_circle {
fill: #282e3a !important;
stroke: #fff !important;
stroke-width: 7px !important;
}
.rocket_wrap:hover .small_window_path {
fill: #28B767 !important;
stroke-width: 0px !important;
}
.rocket_wrap:hover .wing_shadow {
display: block !important;
fill: #FC9252 !important;
}
.rocket_wrap:hover .wing_base {
fill: #E16E36 !important;
stroke-width: 0px !important;
}
.rocket_wrap:hover .rocket_bottom {
fill: #2DCB73 !important;
stroke-width: 0px !important;
}
.rocket_wrap:hover .large_window_path {
fill: url(#SVGID_2_) !important;
stroke-width: 0px !important;
}
.rocket_wrap:hover .rocket_inner {
transform: translateY(0px) translateX(-3px) !important;
}
/*=============================================
[ Animation Classes ]
==============================================*/
.fire {
display: none;
animation-delay: 0s;
fill-opacity: 1;
animation-timing-function: ease-in;
stroke-width: 0px;
animation-iteration-count: infinite;
animation-timing-function: linear;
transform-origin: 50% 50%;
animation-direction: normal;
}
.rocket_wrap:hover #fireLeft {
display: block;
animation-delay: 0s;
animation-name: fireLeft, fillOpacity1;
animation-duration: 1.2s;
}
.rocket_wrap:hover #fireMiddle {
display: block;
animation-delay: 0s;
animation-name: fireMiddle, fillOpacity1;
animation-duration: 1s;
}
.rocket_wrap:hover #fireRight {
display: block;
animation-delay: 0s;
animation-name: fireRight, fillOpacity1;
animation-duration: 1.3s;
}
.rocket_wrap:hover #fireSmallLeft {
display: block;
animation-delay: 0s;
animation-name: fireSmall, fillOpacity2;
animation-duration: 1.3s;
transform-origin: bottom;
}
.rocket_wrap:hover #fireSmallRight {
display: block;
animation-delay: 0.3s;
animation-name: fireSmall, fillOpacity3;
animation-duration: 1.6s;
transform-origin: bottom;
}
/*=============================================
[ KeyFrame Animations ]
==============================================*/
#keyframes fireSmall {
10% {
transform: rotate(17deg) translateY(1px)
}
20% {
transform: rotate(-13deg) translateY(2px)
}
30% {
transform: rotate(21deg) translateY(3px)
}
40% {
transform: rotate(-34deg)translateY(4px)
}
50% {
transform: rotate(24deg) translateY(5px)
}
60% {
transform: rotate(-17deg) translateY(6px)
}
70% {
transform: rotate(31deg) translateY(7px)
}
80% {
transform: rotate(-28deg) translateY(8px)
}
90% {
transform: rotate(14deg) translateY(9px)
}
99% {
transform: rotate(0deg) translateY(10px)
}
}
#keyframes fireLeft {
6% {
transform: rotate(25deg)
}
15% {
transform: rotate(-19deg)
}
25% {
transform: rotate(25deg)
}
32% {
transform: rotate(-30deg)
}
46% {
transform: rotate(22deg)
}
54% {
transform: rotate(-29deg)
}
61% {
transform: rotate(32deg)
}
74% {
transform: rotate(-9deg)
}
83% {
transform: rotate(16deg)
}
99% {
transform: rotate(0deg)
}
}
#keyframes fireMiddle {
10% {
transform: rotate(25deg)
}
20% {
transform: rotate(-25deg)
}
30% {
transform: rotate(30deg)
}
40% {
transform: rotate(-22deg)
}
50% {
transform: rotate(29deg)
}
60% {
transform: rotate(-45deg)
}
70% {
transform: rotate(37deg)
}
80% {
transform: rotate(-15deg)
}
90% {
transform: rotate(16deg)
}
99% {
transform: rotate(0deg)
}
}
#keyframes fireRight {
15% {
transform: rotate(17deg)
}
23% {
transform: rotate(-13deg)
}
37% {
transform: rotate(21deg)
}
45% {
transform: rotate(-34deg)
}
54% {
transform: rotate(24deg)
}
67% {
transform: rotate(-17deg)
}
72% {
transform: rotate(31deg)
}
84% {
transform: rotate(-28deg)
}
96% {
transform: rotate(14deg)
}
99% {
transform: rotate(0deg)
}
}
#keyframes fillOpacity1 {
0% {
fill-opacity: 1;
stroke-opacity: 1;
}
50% {
fill-opacity: 1;
stroke-opacity: 1;
}
100% {
fill-opacity: 0;
stroke-opacity: 0;
}
}
#keyframes fillOpacity2 {
0% {
fill-opacity: 1;
stroke-opacity: 1;
}
25% {
fill-opacity: 1;
stroke-opacity: 1;
}
100% {
fill-opacity: 0;
stroke-opacity: 0;
}
}
#keyframes fillOpacity3 {
0% {
fill-opacity: 1;
stroke-opacity: 1;
}
67% {
fill-opacity: 1;
stroke-opacity: 1;
}
100% {
fill-opacity: 0;
stroke-opacity: 0;
}
}
#keyframes rocektMove {
0% {
transform: translateY(0px)
}
100% {
transform: translateY(20px)
}
}
<!-- http://www.pencilscoop.com/2013/11/animate-svg-icons-with-css3-jquery/ -->
<div id="pageWrap">
<svg version="1.1" x="0px" y="0px" width="307px" height="283px" id="rocket">
<g class="rocket_wrap" transform="scale(0.5)">
<circle cx="147.5" cy="138.6" r="105.5" class="icon_circle"/>
<g class="rocket_inner">
<path class="fire fire_path" id="fireMiddle" d="M148.891,179.906c3.928,0,7.111,3.176,7.111,7.094 c0,7.78-7.111,16-7.111,16s-7.111-8.349-7.111-16C141.78,183.082,144.963,179.906,148.891,179.906z"/>
<path class="fire_path fire" id="fireRight" d="M154.063,181.092c3.577-1.624,7.788-0.048,9.408,3.52 c3.216,7.084,0.139,17.508,0.139,17.508s-9.927-4.662-13.09-11.63C148.9,186.923,150.487,182.715,154.063,181.092z"/>
<path class="fire_path fire" id="fireLeft" d="M143.392,182.519c3.25,2.207,4.098,6.623,1.896,9.864 c-4.372,6.436-14.873,9.238-14.873,9.238s-1.191-10.902,3.108-17.23C135.725,181.149,140.143,180.312,143.392,182.519z"/>
<path class="fire_path fire" id="fireSmallLeft" d="M143.193 187.531c2.226 0.4 3.7 2.6 3.2 4.8 c-0.875 4.407-5.829 8.264-5.829 8.264s-3.09-5.53-2.229-9.865C138.807 188.5 141 187.1 143.2 187.531z"/>
<path class="fire_path fire" id="fireSmallRight" d="M152.089 188.599c2.043-0.985 4.496-0.132 5.5 1.9 c1.952 4 0.3 10.1 0.3 10.107s-5.795-2.56-7.713-6.541C149.186 192 150 189.6 152.1 188.599z"/>
<path class="rocket_bottom" d="M157.069 171.31h-3.292c-1.562-0.048-3.178-0.076-4.846-0.076 s-3.284 0.028-4.846 0.076h-3.292c-7.277-7.938-12.371-26.182-12.371-47.434c0-28.54 9.182-51.676 20.508-51.676 c11.327 0 20.5 23.1 20.5 51.676C169.44 145.1 164.3 163.4 157.1 171.31z"/>
<g id="right_wing_wrap">
<path class="wing_base" d="M166.678 127.161c0 0 17.7 3.3 12.9 48.099l-18.06-14.05 L166.678 127.161z"/>
<path class="wing_shadow" d="M158.225 140.336c10.481-5.584 22.7 22.2 21.4 34.9 l-18.06-14.05C161.542 161.2 156.1 144.3 158.2 140.336z"/>
</g>
<g id="left_wing_wrap">
<path class="wing_base" d="M135.131 161.21l-18.06 14.1 c-4.805-44.793 12.924-48.099 12.924-48.099L135.131 161.21z"/>
<path class="wing_shadow" d="M135.131 161.21l-18.06 14.1 c-1.367-12.746 10.896-40.509 21.377-34.924C140.614 144.3 135.1 161.2 135.1 161.21z"/>
</g>
<g id="rocket_body_wrap">
<path class="rocket_base" d="M162.728 167.358c-3.778-0.623-8.573-0.996-13.796-0.996 s-10.018 0.373-13.795 0.996c-5.033-10.186-8.257-25.808-8.257-43.338c0-30.688 9.873-55.566 22.052-55.566 s22.053 24.9 22.1 55.566C170.984 141.6 167.8 157.2 162.7 167.358z" />
<path class="rocket_shadow" d="M145.464 166.417c19.578-40.575 7.26-85.229 4.112-98.067 c11.88 0.9 21.4 25.4 21.4 55.525c0 17.529-3.225 33.152-8.257 43.337c0 0-3.786-0.472-8.069-0.697 S145.464 166.4 145.5 166.417z"/>
</g>
<g id="large_window_wrap">
<radialgradient id="SVGID_2_" cx="148.9" cy="112.5" r="15.2" fx="139.4853" fy="112.5239" gradientunits="userSpaceOnUse">
<stop offset="0" class="window_grandient"/>
<stop offset="0.5868" class="window_grandient"/>
<stop offset="0.6834" class="window_grandient"/>
<stop offset="0.6845" class="window_grandient1"/>
<stop offset="0.6861" class="window_grandient2"/>
<stop offset="0.6897" class="window_grandient3"/>
</radialgradient>
<circle class="large_window_path" cx="148.9" cy="111.3" r="10.5"/>
</g>
<circle class="small_window_path" cx="148.9" cy="132.4" r="5.2"/>
</g>
</g>
</svg>
</div>
You cannot add style to an SVG <g> element. Its only purpose is to group children. That means, too, that style attributes you give to it are given down to its children, so a fill="green" on the <g> means an automatic fill="green" on its child <rect> (as long as it has no own fill specification).
Your only option is to add a new <rect> to the SVG and place it accordingly to match the <g> children's dimensions.

SVG width attribute css animation in firefox

SVG width attribute css animation not working in Firefox but in chrome it working perfectly. Please check the below snippet demo.
Does any wrong in my codes? Is there a way to apply the animation over the attribute width?
svg {
display: inline-block;
}
#-moz-keyframes glareAnim1 {
0% {
width: 0;
}
50% {
width: 10px;
}
100% {
width: 0;
}
}
#-webkit-keyframes glareAnim1 {
0% {
width: 0;
}
50% {
width: 10px;
}
100% {
width: 0;
}
}
#keyframes glareAnim1 {
0% {
width: 0;
}
50% {
width: 10px;
}
100% {
width: 0;
}
}
.glare-top {
-moz-animation: glareAnim1 2s linear infinite;
-webkit-animation: glareAnim1 2s linear infinite;
animation: glareAnim1 2s linear infinite;
}
#-moz-keyframes glareAnim2 {
0% {
width: 10px;
}
50% {
width: 0;
}
100% {
width: 10px;
}
}
#-webkit-keyframes glareAnim2 {
0% {
width: 10px;
}
50% {
width: 0;
}
100% {
width: 10px;
}
}
#keyframes glareAnim2 {
0% {
width: 10px;
}
50% {
width: 0;
}
100% {
width: 10px;
}
}
.glare-bottom {
-moz-animation: glareAnim2 2s linear infinite;
-webkit-animation: glareAnim2 2s linear infinite;
animation: glareAnim2 2s linear infinite;
}
#-moz-keyframes translateDoor {
0% {
-moz-transform: translate(-1px, 0);
transform: translate(-1px, 0);
opacity: 1;
width: 1px;
height: 6px;
}
15% {
width: 4px;
}
50% {
-moz-transform: translate(16px, 0);
transform: translate(16px, 0);
opacity: 1;
width: 2px;
}
51% {
opacity: 0;
}
100% {
-moz-transform: translateX(-10px);
transform: translateX(-10px);
opacity: 0;
}
}
#-webkit-keyframes translateDoor {
0% {
-webkit-transform: translate(-1px, 0);
transform: translate(-1px, 0);
opacity: 1;
width: 1px;
height: 6px;
}
15% {
width: 4px;
}
50% {
-webkit-transform: translate(16px, 0);
transform: translate(16px, 0);
opacity: 1;
width: 2px;
}
51% {
opacity: 0;
}
100% {
-webkit-transform: translateX(-10px);
transform: translateX(-10px);
opacity: 0;
}
}
#keyframes translateDoor {
0% {
-moz-transform: translate(-1px, 0);
-ms-transform: translate(-1px, 0);
-webkit-transform: translate(-1px, 0);
transform: translate(-1px, 0);
opacity: 1;
width: 1px;
height: 6px;
}
15% {
width: 4px;
}
50% {
-moz-transform: translate(16px, 0);
-ms-transform: translate(16px, 0);
-webkit-transform: translate(16px, 0);
transform: translate(16px, 0);
opacity: 1;
width: 2px;
}
51% {
opacity: 0;
}
100% {
-moz-transform: translateX(-10px);
-ms-transform: translateX(-10px);
-webkit-transform: translateX(-10px);
transform: translateX(-10px);
opacity: 0;
}
}
.researchDoor {
fill: #464949;
-moz-animation: translateDoor 5s linear infinite;
-webkit-animation: translateDoor 5s linear infinite;
animation: translateDoor 5s linear infinite;
}
.research0 {
fill: #FFFFFF;
stroke: #464949;
stroke-width: 2;
stroke-miterlimit: 10;
}
.research1 {
fill: #FCBD38;
overflow: hidden;
}
.research2 {
fill: #464949;
}
.research3 {
fill: none;
stroke: #464949;
stroke-width: 2;
stroke-linecap: square;
stroke-miterlimit: 10;
}
<svg version="1.1" x="0px" y="0px" viewBox="0 0 100 120" style="enable-background:new 0 0 100 120;" xml:space="preserve">
<path id="XMLID_42_" class="research0" d="M57.9,25.5c-3-6.4-8.3-11.6-8.3-11.6c-5.1,5-8.3,11.5-8.3,11.5v5.8L57.7,32L57.9,25.5z" />
<g id="XMLID_40_">
<rect x="41.4" y="25.9" class="research1" width="16.3" height="11.5" />
<path class="research2" d="M56.7,26.9v9.5H42.4v-9.5H56.7 M58.7,24.9H40.4v13.5h18.3V24.9L58.7,24.9z" />
</g>
<polygon id="XMLID_43_" class="research3" points="33.5,85.2 40.8,37.7 58.8,37.7 66.2,85.2 " />
<!-- door -->
<rect x="41" y="28.9" class="researchDoor" />
<!-- left top wind -->
<rect x="30" class="glare-top" y="28" fill="#464949" width="14" height="2" />
<!-- left bottom wind -->
<rect x="30" class="glare-bottom" y="32" fill="#464949" width="14" height="2" />
<!-- right top wind -->
<rect x="62" y="28" class="glare-top" fill="#464949" width="14" height="2" />
<!-- right bottom wind -->
<rect x="62" y="32" class="glare-bottom" fill="#464949" width="14" height="2" />
<!--
<line id="glareLeftTop" class="research3" x1="36.6" y1="28.7" x2="32.8" y2="28.7"/>
<line id="glareLeftBottom" class="research3" x1="36.6" y1="33.3" x2="23.8" y2="33.3"/>
<line id="glareTopRight" class="research3" x1="62.9" y1="28.7" x2="66.6" y2="28.7"/>
<line id="glareTopBottom" class="research3" x1="62.9" y1="33.3" x2="75.6" y2="33.3"/>
-->
<line id="XMLID_2_" class="research3" x1="76.3" y1="85.3" x2="23.7" y2="85.3" />
<line id="XMLID_64_" class="research3" x1="60.7" y1="37.7" x2="38.8" y2="37.7" />
<line id="XMLID_70_" class="research3" x1="58.7" y1="44.3" x2="40.8" y2="44.3" />
<line id="XMLID_79_" class="research3" x1="60.2" y1="51.7" x2="39.3" y2="51.7" />
<line id="XMLID_80_" class="research3" x1="61.7" y1="61" x2="37.8" y2="61" />
<line id="XMLID_90_" class="research3" x1="63.5" y1="69.3" x2="36.8" y2="69.3" />
<g id="XMLID_49_">
<path class="research2" d="M49.8,76.2c1.5,0,2.8,1.2,2.8,2.8v5.2H47v-5.2C47,77.4,48.2,76.2,49.8,76.2 M49.8,74.2
c-2.6,0-4.8,2.1-4.8,4.8v7.2h9.5v-7.2C54.5,76.3,52.4,74.2,49.8,74.2L49.8,74.2z" />
</g>
</svg>
Consider using lines with a stroke-width equal to the height of the rectangles instead of rectangles in your animation.
The stroke-dasharray lines will be used for animation.
At 0% {stroke-dasharray: 0.10;} for an animated line equal to 10px
the line will be hidden
At 50% {stroke-dasharray: 10,0;} the line will be shown in full
At 100% {stroke-dasharray: 0.10;} the line will be hidden again
.glare-top {
-webkit-animation: glareAnim1 2s linear infinite;
stroke-dasharray:0,10;
animation: glareAnim1 2s linear infinite;
}
#-webkit-keyframes glareAnim1 {
0% {stroke-dasharray:0,10;}
50% {stroke-dasharray:10,10;}
100%{stroke-dasharray:0,10;}
}
.glare-bottom {
-webkit-animation: glareAnim2 2s linear infinite;
stroke-dasharray:0,10;
animation: glareAnim2 2s linear infinite;
}
#-webkit-keyframes glareAnim2 {
0% {stroke-dasharray:10,0;}
50% {stroke-dasharray:0,10;}
100%{stroke-dasharray:10,0;}
}
<svg version="1.1" viewBox="0 0 100 120" >
<!-- left top wind -->
<polyline class="glare-top" points="27,28 37,28" stroke="#464949" stroke-width="2" />
<!-- left bottom wind -->
<polyline class="glare-bottom" points="27,33 37,33" stroke="#464949" stroke-width="2" />
</svg>
I have shortened your code to show the basic animation of the lines and the door.
svg {
display: inline-block;
}
.glare-top {
-webkit-animation: glareAnim1 2s linear infinite;
stroke-dasharray:0,10;
animation: glareAnim1 2s linear infinite;
}
#-webkit-keyframes glareAnim1 {
0% {stroke-dasharray:0,10;}
50% {stroke-dasharray:10,10;}
100%{stroke-dasharray:0,10;}
}
#keyframes glareAnim1 {
0% {stroke-dasharray:0,10;}
50% {stroke-dasharray:10,10;}
100%{stroke-dasharray:0,10;}
}
.glare-bottom {
-moz-animation: glareAnim2 2s linear infinite;
-webkit-animation: glareAnim2 2s linear infinite;
stroke-dasharray:0,10;
animation: glareAnim2 2s linear infinite;
}
#-webkit-keyframes glareAnim2 {
0% {stroke-dasharray:10,0;}
50% {stroke-dasharray:0,10;}
100%{stroke-dasharray:10,0;}
}
#keyframes glareAnim2 {
0% {stroke-dasharray:10,0;}
50% {stroke-dasharray:0,10;}
100%{stroke-dasharray:10,0;}
}
.researchDoor {
fill: #464949;
stroke-dasharray:0,6;
animation: translateDoor 5s linear infinite;
}
#keyframes translateDoor {
0% {
transform: translate(-1px, 0);
opacity: 1;
stroke-dasharray:0,6;
}
15% {
stroke-dasharray:1.4,4.6;
}
50% {
transform: translate(8px, 0);
stroke-dasharray:5,1;
}
70% {
transform: translate(12.8px, 0);
stroke-dasharray:3.5,2.5;
}
100% {
transform: translateX(16px);
stroke-dasharray:0,6;
}
}
.research0 {
fill: #FFFFFF;
stroke: #464949;
stroke-width: 2;
stroke-miterlimit: 10;
}
.research1 {
fill: #FCBD38;
overflow: hidden;
}
.research2 {
fill: #464949;
}
.research3 {
fill: none;
stroke: #464949;
stroke-width: 2;
stroke-linecap: square;
stroke-miterlimit: 10;
}
<svg version="1.1" viewBox="0 0 100 120" >
<path id="XMLID_42_" class="research0" d="M57.9,25.5c-3-6.4-8.3-11.6-8.3-11.6c-5.1,5-8.3,11.5-8.3,11.5v5.8L57.7,32L57.9,25.5z" />
<g id="XMLID_40_">
<rect x="41.4" y="25.9" class="research1" width="16.3" height="11.5" />
<path class="research2" d="M56.7,26.9v9.5H42.4v-9.5H56.7 M58.7,24.9H40.4v13.5h18.3V24.9L58.7,24.9z" />
</g>
<polygon id="XMLID_43_" class="research3" points="33.5,85.2 40.8,37.7 58.8,37.7 66.2,85.2 " />
<!-- door -->
<!-- <rect x="41" y="28.9" class="researchDoor" /> -->
<polyline class="researchDoor" points="41,32 47,32" stroke="#464949" stroke-width="6" />
<!-- left top wind -->
<polyline class="glare-top" points="27,28 37,28" stroke="#464949" stroke-width="2" />
<!-- right top wind -->
<polyline class="glare-top" points=" 62,28 72,28" stroke="#464949" stroke-width="2" />
<!-- left bottom wind -->
<polyline class="glare-bottom" points="27,33 37,33" stroke="#464949" stroke-width="2" />
<!-- right bottom wind -->
<polyline class="glare-bottom" points=" 62,33 72,33" stroke="#464949" stroke-width="2" />
<line id="XMLID_2_" class="research3" x1="76.3" y1="85.3" x2="23.7" y2="85.3" />
<line id="XMLID_64_" class="research3" x1="60.7" y1="37.7" x2="38.8" y2="37.7" />
<line id="XMLID_70_" class="research3" x1="58.7" y1="44.3" x2="40.8" y2="44.3" />
<line id="XMLID_79_" class="research3" x1="60.2" y1="51.7" x2="39.3" y2="51.7" />
<line id="XMLID_80_" class="research3" x1="61.7" y1="61" x2="37.8" y2="61" />
<line id="XMLID_90_" class="research3" x1="63.5" y1="69.3" x2="36.8" y2="69.3" />
<g id="XMLID_49_">
<path class="research2" d="M49.8,76.2c1.5,0,2.8,1.2,2.8,2.8v5.2H47v-5.2C47,77.4,48.2,76.2,49.8,76.2 M49.8,74.2
c-2.6,0-4.8,2.1-4.8,4.8v7.2h9.5v-7.2C54.5,76.3,52.4,74.2,49.8,74.2L49.8,74.2z" />
</g>
</svg>
In SVG 1.1 width is an attribute and cannot be animated with CSS animation.
In the SVG 2 specification width is a CSS property which can therefore be animated with CSS animation.
Chrome has implemented this part of the SVG 2 specification, Firefox had not when this question was first written, but it has now. In fact Firefox has had this functionality for quite a while now.

Scaling SVG with fixed dimensions

I came across this super cool demo of a SVG rocket getting ready to blast off.
http://jsfiddle.net/timrpeterson/4FMyA/22/
first line of the JSFiddle:
<svg version="1.1" x="0px" y="0px" width="307px" height="283px" id="rocket">
I know the point of SVG is to be "scalable" but I just realized I have no idea how this is done. I'd like to shrink the entire rocket and circle surrounding it by 75%, but it looks like everything has defined dimensions.
Is there a simple way to shrink everything the same amount or do I have to manually scale each value?
I would make it like this:
Remove width and height from the svg, add a viewbox with the width/height attributes, add an preserveAspectRatio attribute with "xMinYMin meet" value and then absolute position the svg inside a relative positioned div with width: 100% and max-width that you want the element to be. The last part is the padding-bottom value that serves us as the aspect ratio when we resize the svg element. Long story short this is it.
Change the max-width value of .svg-container to see the svg scale :) Working demo: http://jsfiddle.net/timrpeterson/4FMyA/26/
/*=============================================
[ Page Setup ]
==============================================*/
body {
background: #34495e
}
#pageWrap {
width: 100%;
overflow: hidden;
}
.svg-container {
display: block;
position: relative;
width: 100%;
vertical-align: middle;
overflow: hidden;
max-width: 100px;
margin: 0 auto;
padding-bottom: 64%;
}
#rocket {
display: inline-block;
position: absolute;
top: 0;
left: 0;
}
/*=============================================
[ Inactive State Styles ]
==============================================*/
.rocket_inner {
transform: translateY(15px) translateX(-3px);
-webkit-transition: .3s;
-moz-transition: .3s;
transition: .3s;
}
.icon_circle {
transition: .2s;
fill: #22303e;
}
.large_window_path {
transition: .2s;
fill: #22303e;
}
.small_window_path {
fill: #22303e;
}
.wing_shadow {
fill: #34495e;
}
.rocket_bottom {
fill: #34495e
}
.rocket_base {
fill: #34495e
}
.rocket_shadow {
fill: #34495e
}
.window_grandient {
stop-color: #2DCB73
}
.window_grandient1 {
stop-color: #2AC16D
}
.window_grandient2 {
stop-color: #29B968
}
.window_grandient3 {
stop-color: #28B767
}
.wing_base {
fill: #34495e
}
.fire_path {
fill: #FC0
}
/*=============================================
[ Hover Styles ]
==============================================*/
.rocket_wrap:hover .rocket_base {
fill: #FFFFFF !important;
stroke-width: 0px !important;
}
.rocket_wrap:hover .rocket_shadow {
fill: #EDEDED !important;
stroke-width: 0px !important;
}
.rocket_wrap:hover .icon_circle {
fill: #282e3a !important;
stroke: #fff !important;
stroke-width: 7px !important;
}
.rocket_wrap:hover .small_window_path {
fill: #28B767 !important;
stroke-width: 0px !important;
}
.rocket_wrap:hover .wing_shadow {
display: block !important;
fill: #FC9252 !important;
}
.rocket_wrap:hover .wing_base {
fill: #E16E36 !important;
stroke-width: 0px !important;
}
.rocket_wrap:hover .rocket_bottom {
fill: #2DCB73 !important;
stroke-width: 0px !important;
}
.rocket_wrap:hover .large_window_path {
fill: url(#SVGID_2_) !important;
stroke-width: 0px !important;
}
.rocket_wrap:hover .rocket_inner {
transform: translateY(0px) translateX(-3px) !important;
}
/*=============================================
[ Animation Classes ]
==============================================*/
.fire {
display: none;
animation-delay: 0s;
fill-opacity: 1;
animation-timing-function: ease-in;
stroke-width: 0px;
animation-iteration-count: infinite;
animation-timing-function: linear;
transform-origin: 50% 50%;
animation-direction: normal;
}
.rocket_wrap:hover #fireLeft {
display: block;
animation-delay: 0s;
animation-name: fireLeft, fillOpacity1;
animation-duration: 1.2s;
}
.rocket_wrap:hover #fireMiddle {
display: block;
animation-delay: 0s;
animation-name: fireMiddle, fillOpacity1;
animation-duration: 1s;
}
.rocket_wrap:hover #fireRight {
display: block;
animation-delay: 0s;
animation-name: fireRight, fillOpacity1;
animation-duration: 1.3s;
}
.rocket_wrap:hover #fireSmallLeft {
display: block;
animation-delay: 0s;
animation-name: fireSmall, fillOpacity2;
animation-duration: 1.3s;
transform-origin: bottom;
}
.rocket_wrap:hover #fireSmallRight {
display: block;
animation-delay: 0.3s;
animation-name: fireSmall, fillOpacity3;
animation-duration: 1.6s;
transform-origin: bottom;
}
/*=============================================
[ KeyFrame Animations ]
==============================================*/
#keyframes fireSmall {
10% {
transform: rotate(17deg) translateY(1px)
}
20% {
transform: rotate(-13deg) translateY(2px)
}
30% {
transform: rotate(21deg) translateY(3px)
}
40% {
transform: rotate(-34deg)translateY(4px)
}
50% {
transform: rotate(24deg) translateY(5px)
}
60% {
transform: rotate(-17deg) translateY(6px)
}
70% {
transform: rotate(31deg) translateY(7px)
}
80% {
transform: rotate(-28deg) translateY(8px)
}
90% {
transform: rotate(14deg) translateY(9px)
}
99% {
transform: rotate(0deg) translateY(10px)
}
}
#keyframes fireLeft {
6% {
transform: rotate(25deg)
}
15% {
transform: rotate(-19deg)
}
25% {
transform: rotate(25deg)
}
32% {
transform: rotate(-30deg)
}
46% {
transform: rotate(22deg)
}
54% {
transform: rotate(-29deg)
}
61% {
transform: rotate(32deg)
}
74% {
transform: rotate(-9deg)
}
83% {
transform: rotate(16deg)
}
99% {
transform: rotate(0deg)
}
}
#keyframes fireMiddle {
10% {
transform: rotate(25deg)
}
20% {
transform: rotate(-25deg)
}
30% {
transform: rotate(30deg)
}
40% {
transform: rotate(-22deg)
}
50% {
transform: rotate(29deg)
}
60% {
transform: rotate(-45deg)
}
70% {
transform: rotate(37deg)
}
80% {
transform: rotate(-15deg)
}
90% {
transform: rotate(16deg)
}
99% {
transform: rotate(0deg)
}
}
#keyframes fireRight {
15% {
transform: rotate(17deg)
}
23% {
transform: rotate(-13deg)
}
37% {
transform: rotate(21deg)
}
45% {
transform: rotate(-34deg)
}
54% {
transform: rotate(24deg)
}
67% {
transform: rotate(-17deg)
}
72% {
transform: rotate(31deg)
}
84% {
transform: rotate(-28deg)
}
96% {
transform: rotate(14deg)
}
99% {
transform: rotate(0deg)
}
}
#keyframes fillOpacity1 {
0% {
fill-opacity: 1;
stroke-opacity: 1;
}
50% {
fill-opacity: 1;
stroke-opacity: 1;
}
100% {
fill-opacity: 0;
stroke-opacity: 0;
}
}
#keyframes fillOpacity2 {
0% {
fill-opacity: 1;
stroke-opacity: 1;
}
25% {
fill-opacity: 1;
stroke-opacity: 1;
}
100% {
fill-opacity: 0;
stroke-opacity: 0;
}
}
#keyframes fillOpacity3 {
0% {
fill-opacity: 1;
stroke-opacity: 1;
}
67% {
fill-opacity: 1;
stroke-opacity: 1;
}
100% {
fill-opacity: 0;
stroke-opacity: 0;
}
}
#keyframes rocektMove {
0% {
transform: translateY(0px)
}
100% {
transform: translateY(20px)
}
}
<!-- http://www.pencilscoop.com/2013/11/animate-svg-icons-with-css3-jquery/ -->
<div id="pageWrap">
<div class="svg-container">
<svg version="1.1" x="0px" y="0px" viewBox="0 0 307 283" preserveAspectRatio="xMinYMin meet" id="rocket">
<g class="rocket_wrap">
<circle cx="147.5" cy="138.6" r="105.5" class="icon_circle" />
<g class="rocket_inner">
<path class="fire fire_path" id="fireMiddle" d="M148.891,179.906c3.928,0,7.111,3.176,7.111,7.094 c0,7.78-7.111,16-7.111,16s-7.111-8.349-7.111-16C141.78,183.082,144.963,179.906,148.891,179.906z" />
<path class="fire_path fire" id="fireRight" d="M154.063,181.092c3.577-1.624,7.788-0.048,9.408,3.52 c3.216,7.084,0.139,17.508,0.139,17.508s-9.927-4.662-13.09-11.63C148.9,186.923,150.487,182.715,154.063,181.092z" />
<path class="fire_path fire" id="fireLeft" d="M143.392,182.519c3.25,2.207,4.098,6.623,1.896,9.864 c-4.372,6.436-14.873,9.238-14.873,9.238s-1.191-10.902,3.108-17.23C135.725,181.149,140.143,180.312,143.392,182.519z" />
<path class="fire_path fire" id="fireSmallLeft" d="M143.193 187.531c2.226 0.4 3.7 2.6 3.2 4.8 c-0.875 4.407-5.829 8.264-5.829 8.264s-3.09-5.53-2.229-9.865C138.807 188.5 141 187.1 143.2 187.531z" />
<path class="fire_path fire" id="fireSmallRight" d="M152.089 188.599c2.043-0.985 4.496-0.132 5.5 1.9 c1.952 4 0.3 10.1 0.3 10.107s-5.795-2.56-7.713-6.541C149.186 192 150 189.6 152.1 188.599z" />
<path class="rocket_bottom" d="M157.069 171.31h-3.292c-1.562-0.048-3.178-0.076-4.846-0.076 s-3.284 0.028-4.846 0.076h-3.292c-7.277-7.938-12.371-26.182-12.371-47.434c0-28.54 9.182-51.676 20.508-51.676 c11.327 0 20.5 23.1 20.5 51.676C169.44 145.1 164.3 163.4 157.1 171.31z"
/>
<g id="right_wing_wrap">
<path class="wing_base" d="M166.678 127.161c0 0 17.7 3.3 12.9 48.099l-18.06-14.05 L166.678 127.161z" />
<path class="wing_shadow" d="M158.225 140.336c10.481-5.584 22.7 22.2 21.4 34.9 l-18.06-14.05C161.542 161.2 156.1 144.3 158.2 140.336z" />
</g>
<g id="left_wing_wrap">
<path class="wing_base" d="M135.131 161.21l-18.06 14.1 c-4.805-44.793 12.924-48.099 12.924-48.099L135.131 161.21z" />
<path class="wing_shadow" d="M135.131 161.21l-18.06 14.1 c-1.367-12.746 10.896-40.509 21.377-34.924C140.614 144.3 135.1 161.2 135.1 161.21z" />
</g>
<g id="rocket_body_wrap">
<path class="rocket_base" d="M162.728 167.358c-3.778-0.623-8.573-0.996-13.796-0.996 s-10.018 0.373-13.795 0.996c-5.033-10.186-8.257-25.808-8.257-43.338c0-30.688 9.873-55.566 22.052-55.566 s22.053 24.9 22.1 55.566C170.984 141.6 167.8 157.2 162.7 167.358z"
/>
<path class="rocket_shadow" d="M145.464 166.417c19.578-40.575 7.26-85.229 4.112-98.067 c11.88 0.9 21.4 25.4 21.4 55.525c0 17.529-3.225 33.152-8.257 43.337c0 0-3.786-0.472-8.069-0.697 S145.464 166.4 145.5 166.417z" />
</g>
<g id="large_window_wrap">
<radialgradient id="SVGID_2_" cx="148.9" cy="112.5" r="15.2" fx="139.4853" fy="112.5239" gradientunits="userSpaceOnUse">
<stop offset="0" class="window_grandient" />
<stop offset="0.5868" class="window_grandient" />
<stop offset="0.6834" class="window_grandient" />
<stop offset="0.6845" class="window_grandient1" />
<stop offset="0.6861" class="window_grandient2" />
<stop offset="0.6897" class="window_grandient3" />
</radialgradient>
<circle class="large_window_path" cx="148.9" cy="111.3" r="10.5" />
</g>
<circle class="small_window_path" cx="148.9" cy="132.4" r="5.2" />
</g>
</g>
</svg>
</div>
</div>

I need help rotating an svg element in my logo

I want my initials "CND" to rotate like this:
http://jsfiddle.net/rukC6/1/
HTML:
<head>
</head>
<body>
<div align="center">
<img src="http://t0.gstatic.com/images?q=tbn:ANd9GcRTCKie7zNcXtCeCjnMsE8kyg7D9fC_-Hllk7VaNoXIGHPLxbWP" class="animation-rotate"/>
</div>
</body>
</html>
CSS:
#-webkit-keyframes rotate {
0% { -webkit-transform: rotate(0deg); }
20% { -webkit-transform: rotate(90deg); }
25% { -webkit-transform: rotate(90deg); }
45% { -webkit-transform: rotate(180deg); }
50% { -webkit-transform: rotate(180deg); }
70% { -webkit-transform: rotate(270deg); }
75% { -webkit-transform: rotate(270deg); }
100% { -webkit-transform: rotate(360deg); }
}
.animation-rotate {
-webkit-animation-name: rotate;
-webkit-animation-duration: 4.5s;
-webkit-animation-iteration-count: infinite;
-webkit-transition-timing-function: linear;
}
but my code is making it rotate around a wide circle instead of staying in the center:
http://codepen.io/CaptnChristiana/pen/hCsHn
HTML:
<svg xmlns="http://www.w3.org/2000/svg" width="399" height="378" viewBox="0 0 399 378"><style type="text/css"><![CDATA[
.st1{fill:none;stroke:#15ADBC;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
.st2{fill:#15ADBC;stroke:#15ADBC;stroke-width:4;stroke-miterlimit:10;}
.st3{fill:none;stroke:#1D1E1E;stroke-width:8;stroke-linecap:round;stroke-miterlimit:10;}]]></style>
<path class="st1" d="M99.972 180.794l175.591 58.929-123.703 85.748zM45.64 210.785l59.428-127.262-5.096 97.271-54.332 29.991 106.22 114.686 174.202-31.196M105.385 82.349l128.825.633-134.238 97.812M308.37 154.665l17.692 139.61-50.499-54.552 32.807-85.058-73.179-71.466.12 2.235 40.252 154.289"/>
<circle class="st2" cx="105.385" cy="82.349" r="3.263"/>
<circle class="st2" cx="235.191" cy="83.199" r="3.263"/>
<circle class="st2" cx="308.349" cy="154.892" r="3.263"/>
<path class="st2" d="M329.321 294.1c.097 1.799-1.284 3.336-3.084 3.434-1.8.096-3.336-1.283-3.433-3.082-.098-1.803 1.283-3.338 3.082-3.434 1.801-.098 3.339 1.281 3.435 3.082z"/>
<circle class="st2" cx="151.861" cy="325.471" r="3.263"/>
<circle class="st2" cx="46.478" cy="209.807" r="3.263"/>
<circle class="st2" cx="99.973" cy="180.795" r="3.263"/>
<circle class="st2" cx="275.564" cy="239.723" r="3.264"/>
<g class="initials">
<path class="st3" d="M233.525 239.931c4.9.225 10.302-.09 15.021-1.492 14.457-4.304 24.611-19.246 26.432-33.729 1.84-14.646-6.16-28.656-18.408-36.203-15.918-9.807-31.015-3.852-31.015-3.852l-19.523 97.735-25.52-117.075-19.141 93.81c-15.568 4.092-30.443.303-41.066-12.182-14.854-17.457-6.279-37.685-6.279-37.685 11.439-27.958 38.459-25.105 38.459-25.105"/></g></svg>
CSS:
#-webkit-keyframes rotate {
0% { -webkit-transform: rotate(0deg); }
20% { -webkit-transform: rotate(90deg); }
25% { -webkit-transform: rotate(90deg); }
45% { -webkit-transform: rotate(180deg); }
50% { -webkit-transform: rotate(180deg); }
70% { -webkit-transform: rotate(270deg); }
75% { -webkit-transform: rotate(270deg); }
100% { -webkit-transform: rotate(360deg); }
}
.initials {
-webkit-animation-name: rotate;
-webkit-animation-duration: 4.5s;
-webkit-animation-iteration-count: infinite;
-webkit-transition-timing-function: linear;
}
Set the transform-origin property to 50% 50%:
Updated Example
.st3 {
-webkit-transform-origin: 50% 50%;
-moz-transform-origin: 50% 50%;
transform-origin: 50% 50%;
}
It's worth noting that the initial/default value of the transform-origin property is 50% 50% 0.