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

              
                

- generations = 8


mixin branches(n)
  if(n>0)
    div
      +branches(n-1)
    div
      +branches(n-1)

mixin tree(n)
  div.trunk 
    +branches(n)
    
  div.info
    p=n + " generations"
    p=Math.pow(2, n+1)-1 + " divs (branches)"

+tree(generations)
              
            
!

CSS

              
                // --- Play whith these vars !!! ---
$l = 25vmin
$w = ($l / 10)
$angle = 30deg
$spread = 30deg
$speed = 0.5hz
$scale = 0.72
// -----------------------------------

body
html
  padding 0
  margin 0
  
  overflow hidden
  
  height 100%
  width 100%
  background-color #fff

body
  perspective 100px

.info
  margin 20px
  padding 0px 20px
  background-color #ccc
  display inline-block

$time = unit(1 / $speed, 's')

.trunk
.trunk div
  background hsl(200,75%,30%)
  will-change transform
  // border-radius $w
  width $l
  height $w
  position absolute
  margin-left - $w
  animation-name rot
  animation-duration $time * 1.13281
  animation-iteration-count infinite
  animation-direction alternate
  transform-origin ($w/2) ($w/2)
  animation-timing-function ease-in-out
  &.trunk
    bottom 0
    left 50%
    animation-name rot-root
    animation-duration $time*1.23214

  >div
    // opacity 0.9 // blur :(
    top 0
    left $l
    animation-duration calc(inherit / 2) // don't works :(
    &:nth-child(2)
      // animation-duration 15s
      animation-name rot-inv
      animation-duration ($time/1.12527)

@keyframes rot
  from
    transform rotate($angle - $spread/2) scale($scale)
  to
    transform rotate($angle + $spread/2) scale($scale)

@keyframes rot-inv
  from
    transform rotate(- $angle - $spread/2) scale($scale)
  to
    transform rotate(- $angle + $spread/2) scale($scale)

@keyframes rot-root
  from
    transform rotate(-95deg)
  to
    transform rotate(-85deg)


              
            
!

JS

              
                
              
            
!
999px

Console