css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <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">
<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
		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
	<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
<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
		c1.342-3.47,2.304-7.114,2.886-10.892L441.742,157.909L441.742,157.909z M376.897,186.366
	<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

<div class="instructions">
  <h2>Challenge Guidelines</h2>
  <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="https://codepen.io/GreenSock/details/dooWWp/" target="_b lank">pen comments</a>.</li>
  <li>Share with your friends using #GSAP.</li>

              body {

.instructions {

a:link, a:visited, a:hover {

h2, h3 {
li {

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;)

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................