cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console