cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <h1>Basic SVG Animation Challenge</h1>
<h3 id="worksIn">works in: IE, FireFox, Chrome, Safari and Opera</h3>
<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"
	 width="600px" height="300px" viewBox="0 0 600 300" style="enable-background:new 0 0 600 300;" xml:space="preserve">
<style type="text/css">
	.gear{fill:#88ce02;}
  svg{background:#1d1d1d;}
</style>
<g class="gear" id="gear1">
	<path d="M288.03,158.162l-0.018-16.219l-12.846,0.015c-0.59-3.776-1.561-7.418-2.911-10.886l11.095-6.428l-8.125-14.04
		l-11.08,6.42c-2.379-2.928-5.044-5.601-7.991-7.966l6.402-11.102l-14.058-8.094l-6.402,11.119
		c-3.472-1.342-7.114-2.312-10.901-2.886l-0.015-12.854l-16.219,0.018l0.015,12.854c-3.769,0.582-7.41,1.569-10.878,2.911
		l-6.426-11.104l-14.041,8.125l6.411,11.088c-2.926,2.371-5.599,5.051-7.956,7.984l-11.112-6.394l-8.092,14.05l11.127,6.41
		c-1.342,3.47-2.312,7.114-2.886,10.892l-12.862,0.015l0.02,16.219l12.861-0.015c0.581,3.777,1.561,7.418,2.911,10.886
		l-11.112,6.427l8.125,14.04l11.096-6.419c2.364,2.927,5.044,5.6,7.976,7.965l-6.385,11.102l14.059,8.094l6.401-11.118
		c3.471,1.343,7.116,2.304,10.885,2.886l0.015,12.853l16.218-0.018l-0.015-12.853c3.786-0.591,7.427-1.561,10.895-2.912
		l6.426,11.104l14.04-8.125l-6.426-11.088c2.944-2.371,5.6-5.051,7.973-7.991l11.095,6.394l8.094-14.05l-11.11-6.402
		c1.342-3.47,2.304-7.114,2.886-10.892L288.03,158.162L288.03,158.162z M223.186,186.619c-20.146,0.023-36.51-16.304-36.534-36.451
		c-0.023-20.155,16.304-36.511,36.451-36.534c20.148-0.023,36.512,16.296,36.535,36.451
		C259.66,170.232,243.333,186.596,223.186,186.619z"/>
	<path d="M223.165,168.658c-10.23,0.012-18.54-8.28-18.552-18.51c-0.011-10.235,8.279-18.541,18.51-18.552
		c10.231-0.012,18.541,8.275,18.554,18.51C241.688,160.336,233.397,168.646,223.165,168.658z"/>
</g>
<g class="gear" id="gear2">
	<path d="M441.742,157.909l-0.018-16.219l-12.846,0.015c-0.59-3.776-1.561-7.418-2.911-10.886l11.095-6.428
		l-8.125-14.04l-11.08,6.42c-2.379-2.928-5.044-5.601-7.991-7.966l6.402-11.102l-14.058-8.094l-6.402,11.119
		c-3.472-1.342-7.114-2.312-10.901-2.886l-0.015-12.854l-16.219,0.018l0.015,12.854c-3.769,0.582-7.41,1.569-10.878,2.911
		l-6.426-11.104l-14.041,8.125l6.411,11.088c-2.926,2.371-5.599,5.051-7.956,7.984l-11.112-6.394l-8.092,14.05l11.126,6.41
		c-1.342,3.47-2.312,7.114-2.886,10.892l-12.862,0.015l0.02,16.219l12.861-0.015c0.581,3.777,1.561,7.418,2.911,10.886
		l-11.112,6.427l8.125,14.04l11.096-6.419c2.364,2.927,5.044,5.6,7.976,7.965l-6.385,11.102l14.059,8.094l6.401-11.118
		c3.471,1.343,7.116,2.304,10.885,2.886l0.015,12.853l16.218-0.018l-0.015-12.853c3.786-0.591,7.427-1.561,10.895-2.912
		l6.426,11.104l14.04-8.125l-6.426-11.088c2.944-2.371,5.6-5.051,7.973-7.991l11.095,6.394l8.094-14.05l-11.11-6.402
		c1.342-3.47,2.304-7.114,2.886-10.892L441.742,157.909L441.742,157.909z M376.897,186.366
		c-20.146,0.023-36.51-16.304-36.534-36.451c-0.023-20.155,16.304-36.511,36.451-36.534c20.148-0.023,36.512,16.296,36.535,36.451
		C413.372,169.979,397.045,186.343,376.897,186.366z"/>
	<path d="M376.877,168.404c-10.23,0.012-18.54-8.28-18.552-18.51c-0.011-10.235,8.279-18.541,18.51-18.552
		c10.231-0.012,18.541,8.275,18.554,18.51C395.4,160.083,387.108,168.393,376.877,168.404z"/>
</g>
</svg>

<div class="instructions">
  <h2>Challenge Guidelines</h2>
<ol>
  <li>Fork this pen.</h1>
  <li>Create this animation using CSS, any other JS library, or home-brewed script.</li>
  <li>Do NOT alter SVG markup in HTML panel.</li>
  <li>Modify sub-head to show which browsers it works in.</li>
  <li>Leave links to your solution and any other feedback in <a href="http://codepen.io/GreenSock/details/dooWWp/" target="_b lank">pen comments</a>.</li>
  <li>Share with your friends using #GSAP.</li>
</ol>



</div>
            
          
!
            
              body {
  background:#282828;
  text-align:center;
  color:#ccc;
  font-family:sans-serif;
}

.instructions {
  width:600px;
  margin:auto;
  text-align:left;
}

a:link, a:visited, a:hover {
  color:#88ce02;
}

h2, h3 {
  font-weight:normal;
}
li {
  margin-bottom:6px;
  
}
            
          
!
            
              /* 

Howdy folks,

We are prepping a large article on helpful tips for animating SVG with GSAP. We are curious about how this seemingly simple animation would be accomplished using other technologies. We're not looking to tear apart other solutions, just get a better feel for the possibilities and challenges.

So what would you do if your client said, "Hey, we have this SVG file, plese make the gears spin". 

Give it a try and let us see what you come up. Any unexpected hurdles? 
Any other SVG problems you need solved? Let us know. We'd love to take a swing at them.

We appreciate all contributions and feedback

Thank you and Happy Tweening!

- Team GreenSock

*/

//TweenMax.fromTo(".gear", 6, {x:-450}, {rotation:680, transformOrigin:"50% 50%", x:450, ease:Linear.easeNone, repeat:-1});

//here's one for the CSS folks who like more of a challenge:
TweenMax.from(".gear", 8, {x:-450, rotation:-450, transformOrigin:"50% 50%", ease:Elastic.easeOut, repeat:-1});

/* Please consider sharing this with your friends using #GSAP.

To stay up to date on solutions from the community and other SVG animation tips just follow @greensock on twitter by clicking this: https://twitter.com/greensock

Oh, 100 bonus points if you can make the gears flick-spinnable. We'll tell you what that means and show you how to do that when our article comes out... or perhaps sooner;)

*/
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console