SVG CSS keyframe animation help: Fade between 3 screens infinitely - svg

I'd like to do a simple CSS keyframe animation in an SVG, an infinitely repeating 15-second slideshow-like presentation of three screens (let's call them #red, #yellow, #blue), each displaying for 5 seconds with roughly a 1-second fade between each. I can't quite figure out the technique/timing for this using keyframes and opacity, and I'm not finding anything this simple in reference websites or blog posts. Thank you for any and all help!
Figured it out:
#red{
animation: red-animate 20s ease infinite;
}
#yellow{
animation: yellow-animate 20s ease infinite;
}
#blue{
animation: blue-animate 20s ease infinite;
}
#keyframes red-animate {
0% {opacity: 1;}
28% {opacity: 1;}
33% {opacity: 0;}
94% {opacity: 0;}
100% {opacity: 1;}
}
#keyframes yellow-animate {
0% {opacity: 0;}
28% {opacity: 0;}
33% {opacity: 1;}
61% {opacity: 1;}
66% {opacity: 0;}
100% {opacity: 0}
}
#keyframes blue-animate {
0% {opacity: 0;}
61% {opacity: 0;}
66% {opacity: 1;}
94% {opacity: 1;}
100% {opacity: 0}
}

I would keep it simple, and do everything inside a single keyframe animation.
If I am using a framework like Angular, with a stateful animation, I could have three animations in sequence, however, in pure CSS I would use just one (especially to animate a single SVG since it's what you need).
A simple example, without opacity in between those steps and animating fill color (made it 5 seconds long instead of 60 seconds to avoid wasting people's time):
.rect {
fill: red;
animation: animate-color-and-opacity 5s ease infinite;
}
#keyframes animate-color-and-opacity {
0% {fill: red;}
33% {fill: blue;}
66% {fill: green;}
}
<svg width="400" height="110">
<rect class="rect" width="300" height="100" />
</svg>
If you need the fade effect in between (15 seconds long animation, this time):
.rect {
fill: red;
animation: animate-color-and-opacity 15s ease infinite;
}
#keyframes animate-color-and-opacity {
0% {fill: red; opacity: 1}
19% {opacity: 1}
29% {opacity: 0}
33% {fill: blue; opacity: 1}
52% {opacity: 1}
62% {opacity: 0}
66% {fill: green; opacity: 1}
86% {opacity: 1}
96% {opacity: 0}
}
<svg width="400" height="110">
<rect class="rect" width="300" height="100" />
</svg>
If you don't want the fill transition in between, you could use step-end:
.rect {
fill: red;
animation: animate-color-and-opacity 10s infinite step-end;
// or animation-timing-function: step-end;
}
#keyframes animate-color-and-opacity {
0% {fill: red; opacity: 1}
19% {opacity: 1}
29% {opacity: 0}
33% {fill: blue; opacity: 1}
52% {opacity: 1}
62% {opacity: 0}
66% {fill: green; opacity: 1}
86% {opacity: 1}
96% {opacity: 0}
}
<svg width="400" height="110">
<rect class="rect" width="300" height="100" />
</svg>

Related

Optimize svg filter turbulence to get better performance

I'm using a svg turbulence filter to create a water effect but it is lagging on low-end and mid-end computers so I was wondering if there was any way to optimize the animation or if there were any workarounds to get the same result...
I've heard about requestAnimationFrame but as I am using ReactJS, I didn't figured out how I could use it and if it would solve any performance issues...
Here's my code :
<svg>
<filter
id="turbulence"
x="0"
y="0"
width="100%"
height="100%"
colorInterpolationFilters="sRGB"
>
<feTurbulence
id="sea-filter"
numOctaves="2"
seed="4"
baseFrequency="0.02 0.05"
></feTurbulence>
<feDisplacementMap
scale="25"
numOctaves="3"
in2="turbulence"
in="SourceGraphic"
></feDisplacementMap>
</filter>
<animate
xlinkHref="#sea-filter"
attributeName="baseFrequency"
dur="120s"
keyTimes="0;0.5;1"
values="0.02 0.06;0.04 0.08;0.02 0.06"
repeatCount="indefinite"
/>
</svg>
<div className={styles.sea} style={{ background: `url(${sea})` }}></div>
How I apply it in CSS :
.sea {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
background-image: url("../../../assets/images/Hero/Sea/sea.webp");
background-size: cover;
filter: url("#turbulence");
transform: scale(1.5);
animation: floating 60s ease forwards infinite;
}
#keyframes floating {
0% {
transform: translateY(0) scale(1.5) rotate(0);
}
25% {
transform: translateY(10%) scale(1.5) rotate(2.5deg);
}
50% {
transform: translateY(0) scale(1.5) rotate(0);
}
75% {
transform: translateY(-10%) scale(1.5) rotate(-2.5deg);
}
100% {
transform: translateY(0) scale(1.5) rotate(0);
}
}
Animating baseFrequency can be performance intensive. When I need to animate turbulence, I add a feColorMatrix/hueRotate animation which seems to be better optimized in browsers.
<feColorMatrix in="cloudbase" type="hueRotate" values="0" result="cloud">
<animate attributeName="values" from="0" to="360" dur="20s" repeatCount="indefinite"/>
</feColorMatrix>
Full example at https://codepen.io/mullany/pen/AZqQqB

CSS Spritesheet animation, clockwise and then anticlockwise

I want to animate sprite in clockwise and then anti-clockwise continuously.
I am able to do one at a time using two different button.
How can it be done together?
This is what I tried: Codepen
body{
background: #fff;
width: 291px;
margin: 0 auto;
}
.clockwise, .anticlockwise{
color: #000;
cursor: pointer;
font-size: 40px;
font-weight: bold;
font-family: sans-serif;
}
.clockwise{
float: right;
color: #000;
}
.anticlockwise{
float: left;
color: #000;
}
.rotate{
background: url('http://w3bits.com/wp-content/uploads/sprite.png') 0 0 no-repeat;
width: 399px;
height: 200px;
margin: auto;
float: left;
}
.clockwise:hover ~ .rotate{
animation: rotate-clockwise 3s steps(12);
}
.auto{
margin-top: 40px;
color: #fff;
}
.auto:checked ~ .rotate{
animation: rotate-clockwise 3s steps(12);
}
.anticlockwise:hover ~ .rotate{
animation: rotate-anticlockwise 3s steps(12);
}
.auto{
display: inline-block;
margin-left: 0;
}
.auto-rotate{
color: #333;
font-weight: bold;
font-family: sans-serif;
clear: both;
}
#keyframes rotate-clockwise {
0% {background-position: 0 0; }
100% {background-position: 0 -2393px; }
}
#keyframes rotate-anticlockwise {
0% {background-position: 0 -2393px; }
100% {background-position: 0 0; }
}
<input type="checkbox" class="auto" id="auto" >
<label class="auto-rotate" for="auto">Auto ↻</label><br>
<span class="anticlockwise">← A</span>
<span class="clockwise">→ C</span>
<div class="rotate"></div>
Is it possible using only CSS.
Can I flip sprite horizontally to change the direction of cat (sprite) after clockwise and anticlockwise animation ends and then repeat the same.
Not so sure whether this helps, but can't we add all the animations on a single keyframe animation and repeat it infinitely?
I've forked your Pen here and modified it a little: https://codepen.io/mjzeus/pen/oNbGgmP
#keyframes animate-cat {
0% {
background-position: 0 -2393px;
}
20% {
background-position: 0 0;
}
40% {
background-position: 0 -2393px;
}
59% {
transform: scaleX(1);
}
60% {
transform: scaleX(-1);
}
80% {
background-position: 0 0;
transform: scaleX(-1);
}
100% {
background-position: 0 -2393px;
transform: scaleX(-1);
}
}
This is still pretty raw and can be improved a lot but I suppose you'd get the idea what I'm trying to do here. I've just merged all your animations into a single animation and played it on loop.
I hope this helps.
You can flip the cat by adding another class to the (div class="rotate")
.horizontal {
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
If you want to automate the process, you would need to add and remove class after fixed time, you can achive this using some JavaScript.
Search for "addClass() Jquery"

SVG CSS Animation is inconsistent

I did some simple css animation on an SVG file, but the animations seems to speed up and slow down. Why don't the animations have a consistent speed?
#cs-cloud .gear {
animation-iteration-count: infinite;
transform-origin: 50% 50%;
display: inline-block;
}
#cs-cloud .gear-small {
fill: tan;
animation-name: rotate-clockwise;
animation-duration: 5s;
}
#keyframes rotate-clockwise {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
Here's a fiddle
Try animation-timing-function: linear; in your .gear
#cs-cloud .gear {
animation-iteration-count: infinite;
transform-origin: 50% 50%;
display: inline-block;
animation-timing-function: linear;
}
#cs-cloud .gear-small {
fill: tan;
animation-name: rotate-clockwise;
animation-duration: 5s;
}
#cs-cloud .gear-medium {
fill: green;
animation-name: rotate-counter-clockwise;
animation-duration: 10s;
}
#cs-cloud .gear-large {
fill: pink;
animation-name: rotate-clockwise;
animation-duration: 15s;
}
#cs-cloud .cloud {
fill: blue
}
#keyframes rotate-clockwise {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
#keyframes rotate-counter-clockwise {
0% {
transform: rotate(360deg);
}
100% {
transform: rotate(0deg);
}
}
<svg version="1.1" id="cs-cloud" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="280px" height="200px" viewBox="0 0 280 200" enable-background="new 0 0 280 200" xml:space="preserve">
<path class="gear gear-small" d="M189.905,120.377l2.77,4.017c2.154-0.746,4.127-1.77,5.924-2.997l-1.609-5.298l4.286-3.87l4.722,1.312
c1.127-1.912,2.002-3.94,2.61-6.092l-4.654-3.03l0.775-5.717l4.467-2.014c-0.184-1.06-0.429-2.111-0.75-3.173
c-0.323-1.09-0.725-2.137-1.184-3.133l-5.529,0.636l-3.078-4.878l2.109-4.392c-1.699-1.45-3.56-2.663-5.548-3.62l-3.817,4.05
l-5.511-1.777l-1.228-4.721c-2.172-0.021-4.395,0.24-6.58,0.805l-0.306,5.525l-5.387,2.186l-3.978-2.832
c-1.722,1.397-3.238,3.033-4.521,4.816l3.333,4.439l-2.703,5.101l-4.896,0.384c-0.388,2.129-0.534,4.36-0.356,6.588l5.431,1.266
l1.213,5.642l-3.493,3.391c1.092,1.974,2.448,3.737,3.99,5.3l4.966-2.498l4.57,3.55l-0.473,4.843
c2.062,0.766,4.227,1.283,6.45,1.495l2.205-5.102l5.776-0.204v0.002L189.905,120.377z M173.69,103.873
c-1.834-6.056,1.603-12.435,7.689-14.265c6.061-1.819,12.477,1.603,14.311,7.66c1.836,6.038-1.61,12.428-7.671,14.253
c-6.095,1.827-12.497-1.6-14.329-7.652v0.002V103.873z" />
<path class="gear gear-medium" d="M196.347,178.849l3.16,4.568c2.465-0.851,4.716-2.008,6.76-3.403l-1.832-6.06l4.878-4.404l5.382,1.503
c1.281-2.175,2.295-4.494,2.97-6.942l-5.302-3.457l0.89-6.521l5.09-2.287c-0.206-1.216-0.481-2.416-0.854-3.632
c-0.37-1.233-0.827-2.424-1.353-3.562l-6.31,0.736l-3.5-5.57l2.394-5.003c-1.92-1.646-4.034-3.036-6.31-4.127l-4.358,4.61
l-6.286-2.02l-1.394-5.388c-2.48-0.022-5.005,0.286-7.494,0.926l-0.354,6.296l-6.136,2.494l-4.535-3.229
c-1.97,1.597-3.697,3.452-5.159,5.49l3.81,5.05l-3.1,5.82l-5.57,0.435c-0.442,2.443-0.61,4.977-0.404,7.513l6.187,1.45l1.39,6.427
l-3.988,3.873c1.248,2.232,2.792,4.246,4.544,6.03l5.667-2.846l5.207,4.036l-0.532,5.529c2.346,0.88,4.819,1.456,7.352,1.705
l2.514-5.808l6.58-0.229l-0.003-0.004L196.347,178.849z M177.857,160.029c-2.083-6.894,1.826-14.176,8.772-16.25
c6.912-2.085,14.23,1.815,16.314,8.714c2.092,6.904-1.832,14.174-8.747,16.265c-6.94,2.074-14.247-1.826-16.338-8.73h-0.002V160.029
z" />
<path class="gear gear-large" d="M128.26,186.003l5.195,7.554c4.02-1.393,7.77-3.297,11.126-5.597l-3.03-10.019l8.09-7.247l8.858,2.451
c2.133-3.56,3.77-7.396,4.896-11.415l-8.752-5.717l1.485-10.729l8.367-3.788c-0.33-2.002-0.775-3.997-1.382-5.993
c-0.612-2.036-1.37-3.99-2.24-5.887l-10.397,1.229l-5.772-9.192l3.964-8.248c-3.178-2.71-6.674-5.008-10.444-6.801l-7.181,7.628
l-10.36-3.347l-2.287-8.88c-4.095-0.044-8.248,0.44-12.381,1.51l-0.59,10.41l-10.097,4.068l-7.479-5.336
c-3.259,2.659-6.111,5.71-8.525,9.077l6.279,8.357l-5.09,9.567l-9.185,0.708c-0.778,4.042-1.022,8.189-0.677,12.41l10.201,2.376
l2.277,10.6l-6.574,6.408c2.072,3.688,4.594,7.01,7.486,9.935l9.368-4.704l8.584,6.66l-0.899,9.123
c3.875,1.446,7.959,2.413,12.157,2.824l4.133-9.592l10.878-0.407L128.26,186.003z M97.736,155.005
c-3.442-11.38,3.02-23.378,14.455-26.805c11.429-3.44,23.479,3,26.928,14.375c3.445,11.372-3.018,23.377-14.446,26.81
C113.238,172.817,101.186,166.377,97.736,155.005h-0.002H97.736z" />
<path class="cloud" d="M226.957,78.327c0-0.723,0.127-1.455,0.127-2.189c0-39.068-32.087-71.215-70.977-71.215
c-28.018,0-52.135,16.96-63.438,40.712c-4.927-2.483-10.39-3.883-16.285-3.883c-17.985,0-32.87,14.394-35.792,31.592
c-21.384,7.416-36.814,26.858-36.814,50.92c0,30.266,24.361,55.657,54.441,55.657H77.27l-4.522-9.73H58.7
c-24.853,0-45.08-21.202-45.08-46.237c0-19.386,12.271-35.478,30.504-41.804l5.104-1.817l0.91-5.358
C52.323,61.849,63.559,51.1,76.807,51.1c4.194,0,8.332,0.97,12.094,2.917l8.209,4.129l3.94-8.322
c10.091-21.202,31.667-35.363,54.938-35.363c33.603,0,61.312,26.798,61.312,60.58c0,8.086-0.122,12.337-0.122,12.337l9.234,0.056
c22.302,0.311,39.854,18.525,39.854,40.966c0,22.41-18.103,41.428-40.402,41.547l-1.943,0.243h-6.103
c-1.309,2.293-3.506,5.771-6.678,9.73h15.033C253.52,179.923,276,156.289,276,128.692c0.002-27.699-21.513-50.299-49.04-50.365
H226.957z" />
</svg>

Animate SVG Hamburger menu icon on click and keep it in :active state

I have a SVG hamburger menu icon that is animated when clicked. The goal is to transform it in to a "close" button when you activate the side-push menu. I need some help achieving that:
http://jsfiddle.net/a6ysa9zk/
HTML:
<div class="toggle-menu menu-right push-body">
<svg class="inline-svg" width="42px" height="42px" viewBox="0 0 42 42" enable-background="new 0 0 32 22.5" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
<!-- Generator: Sketch 3.0.4 (8054) - http://www.bohemiancoding.com/sketch -->
<title>Group</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g class="svg-menu-toggle" sketch:type="MSLayerGroup">
<circle class="round" fill="#3B3B41" sketch:type="MSShapeGroup" cx="21" cy="21" r="21"></circle>
<rect class="bar" fill="#F2F2F2" sketch:type="MSShapeGroup" x="12" y="26" width="18" height="4"></rect>
<rect class="bar" fill="#F2F2F2" sketch:type="MSShapeGroup" x="12" y="19" width="18" height="4"></rect>
<rect class="bar" fill="#F2F2F2" sketch:type="MSShapeGroup" x="12" y="12" width="18" height="4"></rect>
</g>
</svg>
</div>
CSS:
.svg-menu-toggle {
fill: #fff;
pointer-events: all;
cursor: pointer;
}
.svg-menu-toggle .round {
transition: fill .4s ease-in-out;
}
.svg-menu-toggle .bar {
-webkit-transform: rotate(0) translateY(0) translateX(0);
transform: rotate(0) translateY(0) translateX(0);
opacity: 1;
-webkit-transform-origin: 20px 10px;
transform-origin: 20px 10px;
-webkit-transition: -webkit-transform 0.4s ease-in-out, opacity 0.2s ease-in-out, fill .4s ease-in-out;
transition: transform 0.4s ease-in-out, opacity 0.2s ease-in-out, fill .4s ease-in-out;
}
.svg-menu-toggle .bar:nth-of-type(1) {
-webkit-transform-origin: 20px 10px;
transform-origin: 20px 10px;
}
.svg-menu-toggle .bar:nth-of-type(3) {
-webkit-transform-origin: 20px 20px;
transform-origin: 20px 20px;
}
.svg-menu-toggle:active .bar:nth-of-type(1) {
-webkit-transform: rotate(-45deg) translateY(-10px) translateX(-8px);
transform: rotate(-45deg) translateY(-10px) translateX(-8px);
fill: #3B3B41;
}
.svg-menu-toggle:active .bar:nth-of-type(2) {
opacity: 0;
}
.svg-menu-toggle:active .bar:nth-of-type(3) {
-webkit-transform: rotate(45deg) translateY(6px) translateX(0px);
transform: rotate(45deg) translateY(6px) translateX(0px);
fill: #3B3B41;
}
.svg-menu-toggle:active .round {
fill: #F2F2F2;
}
Javascript for menu toggle:
jQuery(document).ready(function ($) {
$('.toggle-menu').jPushMenu();
});
Instead of using the :active pseudo-element, its easier to add a class to the group (.svg-menu-toggle).
Unfortunately it isn't possible to use toggleClass from jQuery.
// CSS
.svg-menu-toggle:active become .svg-menu-toggle.active
// JS
$('.toggle-menu').on('click', function(e) {
var $toggle = $(this).find('.svg-menu-toggle');
// toggleClass with addClass & removeClass
});

SVG not working in Chrome

This works in Firefox but not Chrome. Basically the animation works correctly in Firefox with the lightbulb glowing and the leaf growing but for some reason cannot get it to work in Chrome. Thanks for the help here.
jsfiddle here, http://jsfiddle.net/EfLtD/1/
<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 250 250" enable-background="new 0 0 250 250" xml:space="preserve">
<g id="light-bulb-6-icon_1_">
<path fill="#FFFFFF" d="M-314.3,152.1c-2.1,0-2.8-0.6-7.4-5c-0.6-0.6-1.4-1.3-2.2-2h25.6c-0.9,0.8-1.7,1.6-2.4,2.2
c-4.6,4.3-5.3,4.8-7.4,4.8H-314.3z M-326.6,137.7c-1.7,0-3.1-1.4-3.1-3.1s1.4-3.1,3.1-3.1h31.2c1.7,0,3.1,1.4,3.1,3.1
c0,1.7-1.4,3.1-3.1,3.1H-326.6z M-327.4,123.9c-1.7,0-3.1-1.4-3.1-3.1c0-1.7,1.4-3.1,3.1-3.1h32.7c0.9,0,1.7,0.4,2.3,1
c0.5,0.6,0.8,1.3,0.8,2.1c0,1.8-1.4,3.1-3.1,3.1L-327.4,123.9L-327.4,123.9z M-298,109.7c0.3-13.3,6.4-23.6,12.4-33.5
c6-10,11.6-19.4,11.6-31.5c0-16.9-11.6-35.1-37.1-35.1c-25.5,0-37,18.2-37,35.1c0,12.1,5.6,21.4,11.5,31.3
c5.9,9.9,12,20.1,12.6,33.7h-9.1c-0.3-10.3-5.6-19.1-11.2-28.5c-6.4-10.8-13-21.9-13-36.5c0-13.7,5-25.2,14.4-33.2
c8.4-7.2,19.7-11.1,31.9-11.1c12.1,0,23.4,3.9,31.8,11.1c9.4,8,14.4,19.5,14.4,33.2c0,14.6-6.6,25.7-13,36.5
c-5.6,9.4-10.8,18.2-11.2,28.5L-298,109.7L-298,109.7z M-312.8,109.6c-3.3-14.5-1.4-40.1,6.7-54.6l2.4-4.3l-3.9,3.1
c-5.2,4-9.9,14.2-11.6,21.9c-5.4-3.9-7.4-10.6-5.3-18.3c2.9-10.6,14-22,31.7-23.2c-2,1.8-3.6,4.2-4.5,7c-1.9,5.3-1.3,10.1-0.7,14.7
c0.6,4.6,1.1,9-0.8,13.6c-2,4.8-6.1,7.9-11.3,8.4l-0.8,0.1l-0.1,0.8c-1,9.8,0.3,22.7,3.1,30.8L-312.8,109.6L-312.8,109.6z"/>
<path fill="#225650" d="M-311,1.4c11.9,0,23,3.9,31.2,10.9c9.2,7.8,14.1,19.1,14.1,32.5c0,14.3-6.6,25.3-12.9,36
c-5.5,9.2-10.6,17.9-11.3,28h-7c0.6-12.5,6.5-22.4,12.2-32c5.8-9.7,11.8-19.7,11.8-32c0-11.2-4.1-20.5-12-27.1
c-6.9-5.8-16.2-9-26.1-9c-9.9,0-19.2,3.2-26.1,9c-7.8,6.6-12,16-12,27.1c0,12.4,5.7,21.8,11.6,31.9c5.7,9.5,11.5,19.3,12.4,32.1
h-7.1c-0.6-10.1-5.8-18.8-11.3-28c-6.3-10.6-12.9-21.7-12.9-36c0-13.4,4.9-24.6,14.1-32.5C-334,5.2-322.9,1.4-311,1.4L-311,1.4
M-295.4,35.5c-1.2,1.6-2.2,3.4-2.9,5.4c-1.9,5.5-1.3,10.4-0.8,15.2c0.5,4.5,1.1,8.7-0.7,13.1c-1.8,4.5-5.6,7.3-10.4,7.8l-1.6,0.2
l-0.2,1.6c-1,9.4,0.2,21.7,2.7,29.9h-2.7c-3-14.4-1.1-39.1,6.8-53.1l4.9-8.7l-7.8,6.1c-5.1,4-9.6,13.2-11.6,21
c-4.1-3.7-5.5-9.6-3.7-16.2c1.6-5.9,5.5-11.4,11-15.4C-307.7,38.6-301.8,36.3-295.4,35.5 M-294.7,118.7c0.6,0,1.2,0.2,1.6,0.7
c0.2,0.3,0.5,0.7,0.5,1.4l0,0v0c0,1.1-1,2.1-2.1,2.1h-32.7c-1.1,0-2.1-1-2.1-2.1c0-1.1,1-2.1,2.1-2.1L-294.7,118.7 M-295.4,132.5
c1.2,0,2.1,0.9,2.1,2.1c0,1.1-1,2.1-2.1,2.1h-31.2c-1.1,0-2.1-1-2.1-2.1s1-2.1,2.1-2.1H-295.4 M-300.9,146.1
c-0.2,0.2-0.3,0.3-0.5,0.5c-4.6,4.2-5.1,4.5-6.7,4.5h-6.2c-1.6,0-2.1-0.4-6.7-4.7c-0.1-0.1-0.2-0.2-0.3-0.3H-300.9 M-311-0.6
c-23.6,0-47.3,15.1-47.3,45.3c0,28.1,24.2,43.8,24.2,66h11.1c-0.6-28-24.1-41.7-24.1-66c0-22.8,18-34.1,36-34.1S-275,22-275,44.7
c0,24.3-24,38.7-24,66h11c0-22.2,24.2-37.9,24.2-66C-263.8,14.5-287.4-0.6-311-0.6L-311-0.6z M-289.6,33.1
c-33.2,0-46.5,33.8-28.9,44.2c1.5-8.4,6.5-18.9,11.5-22.8c-8.3,14.8-10.3,41.2-6.6,56.1h7.1c-3.1-8-4.5-21.8-3.5-31.7
c5-0.5,9.8-3.4,12.1-9c3.9-9.7-2.1-18.1,1.5-28.4C-295.1,37.7-292.7,34.9-289.6,33.1L-289.6,33.1z M-294.7,116.7h-32.7
c-2.3,0-4.1,1.9-4.1,4.1c0,2.3,1.9,4.1,4.1,4.1h32.7c2.3,0,4.1-1.9,4.1-4.1C-290.5,118.5-292.4,116.7-294.7,116.7L-294.7,116.7z
M-295.4,130.5h-31.2c-2.3,0-4.1,1.9-4.1,4.1c0,2.3,1.9,4.1,4.1,4.1h31.2c2.3,0,4.1-1.9,4.1-4.1
C-291.3,132.3-293.1,130.5-295.4,130.5L-295.4,130.5z M-295.7,144.1h-30.7c8.1,7.5,8.9,9,12.1,9h6.2
C-304.9,153.1-304.2,151.7-295.7,144.1L-295.7,144.1z"/>
</g>
<g>
<path fill="#F9E46E" class="yellow" d="M89.5,93.2c0,24.3,23.5,38,24.1,66h24c0-27.3,24-41.7,24-66C161.6,47.7,89.5,47.7,89.5,93.2z"/>
</g>
<g id="light-bulb-6-icon_37_">
<path fill="#FFFFFF" d="M122.2,200.9c-2.1,0-2.8-0.6-7.4-5c-0.6-0.6-1.4-1.3-2.2-2h25.6c-0.9,0.8-1.7,1.6-2.4,2.2
c-4.6,4.3-5.3,4.8-7.4,4.8H122.2z M109.9,186.5c-1.7,0-3.1-1.4-3.1-3.1s1.4-3.1,3.1-3.1h31.2c1.7,0,3.1,1.4,3.1,3.1
c0,1.7-1.4,3.1-3.1,3.1H109.9z M109.1,172.7c-1.7,0-3.1-1.4-3.1-3.1c0-1.7,1.4-3.1,3.1-3.1h32.7c0.9,0,1.7,0.4,2.3,1
c0.5,0.6,0.8,1.3,0.8,2.1c0,1.8-1.4,3.1-3.1,3.1L109.1,172.7L109.1,172.7z M138.6,158.5c0.3-13.3,6.4-23.6,12.4-33.5
c6-10,11.6-19.4,11.6-31.5c0-16.9-11.6-35.1-37.1-35.1S88.4,76.6,88.4,93.5c0,12.1,5.6,21.4,11.5,31.3c5.9,9.9,12,20.1,12.6,33.7
h-9.1c-0.3-10.3-5.6-19.1-11.2-28.5c-6.4-10.8-13-21.9-13-36.5c0-13.7,5-25.2,14.4-33.2c8.4-7.2,19.7-11.1,31.9-11.1
c12.1,0,23.4,3.9,31.8,11.1c9.4,8,14.4,19.5,14.4,33.2c0,14.6-6.6,25.7-13,36.5c-5.6,9.4-10.8,18.2-11.2,28.5L138.6,158.5
L138.6,158.5z"/>
<path fill="#225650" d="M122.3,201.9h6.2c3.2,0,3.9-1.4,12.4-9h-30.7C118.3,200.4,119,201.9,122.3,201.9z M135.2,195.3
c-4.6,4.2-5.1,4.5-6.7,4.5h-6.2c-1.6,0-2.1-0.4-6.7-4.7c-0.1-0.1-0.2-0.2-0.3-0.3h20.5C135.5,195,135.3,195.2,135.2,195.3z"/>
<path fill="#225650"d="M141.1,179.3h-31.2c-2.3,0-4.1,1.9-4.1,4.1c0,2.3,1.9,4.1,4.1,4.1h31.2c2.3,0,4.1-1.9,4.1-4.1
C145.2,181.1,143.4,179.3,141.1,179.3z M141.1,185.5h-31.2c-1.1,0-2.1-1-2.1-2.1s1-2.1,2.1-2.1h31.2c1.2,0,2.1,0.9,2.1,2.1
C143.2,184.5,142.3,185.5,141.1,185.5z"/>
<path fill="#225650" d="M125.5,48.1c-23.6,0-47.3,15.1-47.3,45.3c0,28.1,24.2,43.8,24.2,66h11.1c-0.6-28-24.1-41.7-24.1-66
c0-22.8,18-34.1,36.1-34.1s36,11.4,36,34.1c0,24.3-24,38.7-24,66h11c0-22.2,24.2-37.9,24.2-66C172.8,63.2,149.1,48.1,125.5,48.1z
M146.6,157.5h-7c0.6-12.5,6.5-22.4,12.2-32c5.8-9.7,11.8-19.7,11.8-32c0-11.2-4.1-20.5-12-27.1c-6.9-5.8-16.2-9-26.1-9
s-19.2,3.2-26.1,9c-7.8,6.6-12,16-12,27.1c0,12.4,5.7,21.8,11.6,31.9c5.7,9.5,11.5,19.3,12.4,32.1h-7.1c-0.6-10.1-5.8-18.8-11.3-28
c-6.3-10.6-12.9-21.7-12.9-36c0-13.4,4.9-24.6,14.1-32.5c8.2-7,19.3-10.9,31.2-10.9c11.9,0,23,3.9,31.2,10.9
c9.2,7.8,14.1,19.1,14.1,32.5c0,14.3-6.6,25.3-12.9,36C152.4,138.6,147.2,147.3,146.6,157.5z"/>
<path fill="#225650" d="M141.8,165.5h-32.7c-2.3,0-4.1,1.9-4.1,4.1c0,2.3,1.9,4.1,4.1,4.1h32.7c2.3,0,4.1-1.9,4.1-4.1
C146,167.3,144.1,165.5,141.8,165.5z M143.9,169.5L143.9,169.5c0,1.2-1,2.1-2.1,2.1h-32.7c-1.1,0-2.1-1-2.1-2.1
c0-1.1,1-2.1,2.1-2.1h32.7v0c0.6,0,1.2,0.2,1.6,0.7C143.7,168.4,144,168.8,143.9,169.5L143.9,169.5z"/>
</g>
<path fill="#FFFFFF" class="leaf" stroke="#225650" stroke-width="2" stroke-miterlimit="10" d="M121.8,158.6c-3.3-14.5-1.4-40.1,6.7-54.6
l2.4-4.3l-3.9,3.1c-5.2,4-9.9,14.2-11.6,21.9c-5.4-3.9-7.4-10.6-5.3-18.3c2.9-10.6,14-22,31.7-23.2c-2,1.8-3.6,4.2-4.5,7
c-1.9,5.3-1.3,10.1-0.7,14.7c0.6,4.6,1.1,9-0.8,13.6c-2,4.8-6.1,7.9-11.3,8.4l-0.8,0.1l-0.1,0.8c-1,9.8,0.3,22.7,3.1,30.8
L121.8,158.6L121.8,158.6z"/>
</svg>
/* CSS */
/* Globe */
#yellow-globe {width: 300px; height: 300px; margin: 0 auto; text-align: center;}
#keyframes yellow {
0% {
fill: #FFFFFF;
}
25% {
fill: #FFFFFF;
}
50% {
fill: #F9E46E;
}
75% {
fill: #F9E46E;
}
100% {
fill: #F9E46E;
}
}
.yellow {
fill: yellow;
animation-name: yellow;
animation-duration: 1s;
animation-iteration-count: infinite;
}
.leaf {
stroke-dasharray: 242;
stroke-dashoffset: 242;
animation: dash 4s linear alternate;
animation-iteration-count: 1;
}
#keyframes dash {
from {
stroke-dashoffset: 242;
}
to {
stroke-dashoffset: 0;
}
}
#keyframes fillme {
0% {
fill: #FFFFFF;
}
25% {
fill: #FFFFFF;
}
50% {
fill: #225650;
}
75% {
fill: #225650;
}
100% {
fill: #225650;
}
}
You need to include the -webkit- prefix on animations (and transitions) for webkit browsers (like Chrome). Working demo
You may also want to include the -ms- and -moz- prefixes so that you can reach older versions of FireFox and IE as well

Resources