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.

            
              

- 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)
            
          
!
            
              // --- 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)


            
          
!
999px
🕑 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 ..................

Console