Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <p style="text-align: center;"><a href="https://github.com/daybrush/scenejs" target="_blank">https://github.com/daybrush/scenejs</a></p>
<div class="image">
  <div class="clip clip1 x1 y1"></div>
  <div class="clip clip2 x2 y1"></div>
  <div class="clip clip3 x3 y1"></div> 
  <div class="clip clip4 x4 y1"></div> 
  <div class="clip clip5 x1 y2"></div>
  <div class="clip clip6 x2 y2"></div>
  <div class="clip clip7 x3 y2"></div> 
  <div class="clip clip8 x4 y2"></div> 
</div>
              
            
!

CSS

              
                .image {
  position: relative;
  width: 600px;
  height: 400px;
  font-size: 0;
  overflow: hidden;
  margin: auto;
}
.image .clip {
  position: absolute;
  background-image: url(https://daybrush.github.io/scenejs/example/image/1.jpg);
  background-size: 600px 400px;
  width: 25%;
  display: inline-block;
  height: 50%;
  box-sizing: border-box;
}
.x1 {
  background-position-x: 0%;
  left: 0%;
}
.x2 {
  background-position-x: 33.3333%;
  left: 25%;
}
.x3 {
  background-position-x: 66.6666%;
  left: 50%;
}
.x4 {
  background-position-x: 100%;
  left: 75%;
}
.y1 {
  background-position-y: 0%;
  top: 0%;
}
.clip.y2 {
  background-position-y: 100%;
  top: 50%;
  height: 100%;
}
              
            
!

JS

              
                var scene = new Scene({
  ".clip1": {
    0: {
      "background-position-y": "-300px",
      height: "75%",
      top: "0%"
    },
    1: {
      "background-position-y": "0px",
      height: "25%",
      top: "-25%",
    }
  },
  ".clip5": {
    0: {
      top: "75%",
      "background-position-y": "-200px",
    },
    1: {
      top: "0%",
      "background-position-y": "-800px",
    }
  },
  ".clip2": {
    0: {
      "background-position-y": "400px",
      height: "50%",
      top: "-25%"
    },
    1: {
      "background-position-y": "-400px",
      height: "100%",
      top: "0%",
    }
  },
  ".clip6": {
    0: {
      top: "25%",
      "background-position-y": "0px",
    },
    1: {
      top: "100%",
      "background-position-y": "400px",
    }
  },
  ".clip3": {
    0: {
      "background-position-y": "40px",
      height: "75%",
      top: "0%"
    },
    1: {
      height: "25%",
      top: "-25%",
    }
  },
  ".clip7": {
    0: {
      top: "75%",
      "background-position-y": "000px",
    },
    1: {
      top: "0%",
      "background-position-y": "-800px",
    }
  },
  ".clip4": {
    0: {
      "background-position-y": "0px",
      height: "25%",
      top: "0%"
    },
    1: {
      height: "25%",
      top: "-25%",
    }
  },
  ".clip8": {
    0: {
      top: "25%",
      "background-position-y": "-400px",
    },
    1: {
      top: "0%",
      "background-position-y": "-800px",
    },
    2: {
      
    }
  },
}, {
  easing: Scene.EASE_IN_OUT,
  duration: 4,
  iterationCount: "infinite",
  selector: true,
}).playCSS();
              
            
!
999px

Console