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

              
                - var fragments = 30;

mixin fragment(n)
  if (n > 0)
    div.fragment(class = "fragment-" + n)
      +fragment(n - 1)
      
div.container(ontouchstart = "")
  div.fragment-cont
    +fragment(fragments)
              
            
!

CSS

              
                // original image size is 1200 x 1703
$w: 320px
$h: $w * 1.41916667
$fragments: 30
$fragmentH: $h / $fragments
$transDur: 0.25s
$cutDelay: 8

.container, .fragment-cont, .fragment
  transform-style: preserve-3d
  -webkit-transform-style: preserve-3d
  transition: transform $transDur

body
  margin: 0
  perspective: 800px
  -webkit-perspective: 800px
  
.container
  width: $w
  height: $h
  margin: auto
  transform: rotateX(45deg) rotateZ(45deg)
  &:hover
    // roll up
    .fragment-cont
      transform: translateY(-$fragmentH) translate3d(0,2px,5px) rotateX(0deg + (360/$fragments*-3))
    .fragment
      transform: translateY($fragmentH) rotateX(0deg + (360/$fragments*3))
      @for $i from 1 through $fragments
        .fragment-#{$i}
          transition-delay: ($transDur/$cutDelay) * ($i - 1)
      
// for containing fragments and moving them to top of global container
.fragment-cont
  transform: translateY(-$fragmentH) rotateX(0deg)
  
.fragment
  // background size has extra 0.75% to hide white edge at right; then in second @for loop, 0.25% of fragment height (0.0025) is added to background position to preserve top dark edge of paper
  background-image: url(https://www.sethkaller.com/images/extras/Constitutionw.png)
  background-size: 100.75% auto
  width: 100%
  height: $fragmentH
  transform-origin: 0% 0%
  -webkit-transform-origin: 0% 0%
  transform: translateY($fragmentH)
  
// roll down
@for $j from 1 through $fragments
  .fragment-#{$fragments - ($j - 1)}
    background-position: 0 (($h * 0.0025) + ($fragmentH * ($fragments - ($j - 1))))
    transition-delay: ($transDur/$cutDelay) * ($j - 1)
              
            
!

JS

              
                
              
            
!
999px

Console