cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

      <h1>Animation Example: CSS3 SVG Animation with PNG fallback</h1>
     <p>As Codepen requires IE10+, you don't see the magic that happens for IE7-9. If you want to try it out, note that I've use Modernizr for feature detection.</p>
     <p>Click on <strong>the logo</strong> to start the animation</p>
      <div class="fraudoudou"></div>

              @import "compass/css3";

$sprite: "http://examples.fraudoudou.at/images/fraudoudou-animation-music.svg";
$sprite-fallback: "http://examples.fraudoudou.at/images/fraudoudou-animation-music.png";
$animation-width: 15em;
$animation-height: 15em;
$animation-frames: 4;

//make sure, the keyframes definitions are at
//the very top of your file!
@include keyframes(anim-fraudoudou-music) {
	0% {
		background-position: 0 0;
	25% {
		background-position: -1*$animation-width 0;
	50% {
		background-position: -2*$animation-width 0;
	75% {
		background-position: -3*$animation-width 0;

body {
	font-family: Helvetiva, Arial, sans-serif;
h1 {
	font-size: 1.2em;
	color: #5e5e5e;
p {
  max-width: 35em;
  line-height: 1.3em;

.fraudoudou {
	background: url($sprite) top left no-repeat;
	width: $animation-width;
	height: $animation-height;
	background-size: $animation-width*$animation-frames $animation-height;
	cursor: pointer;

.fraudoudou-animation {
	cursor: default;
	@include animation-timing-function(step-start);
	@include animation-iteration-count(infinite);
	@include animation-duration(2s);
	@include animation-name(anim-fraudoudou-music);

.no-svg .fraudoudou {
	background-image: url($sprite-fallback);
	width: 250px;
              $(function() {
  var $asset = $(".fraudoudou");

  var initSpriteAnimation = function() {
    $asset.one("click", function() {
      $asset.motio({frames: 4, fps: 2});
  var $html = $("html");
  //if css animations are not supported:
  //load a JS-library for sprite-animations.
  if($html.hasClass("no-cssanimations")) {
  //if css animations are supported:
  //add a listener for adding the class,
  //that handles the animtion.
	else {
    $asset.one("click", function() {
🕑 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 ..................