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

              
                <div class="container">
  <div class="Autumn">
    <div class="source"> AUTUMN! ALSO KNOWN AS FALL</div>
  </div>
  <div class="leaf">
    <svg version="1.1" id="leafSvg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 595.3 841.9" style="enable-background:new 0 0 595.3 841.9;" xml:space="preserve">
      <style type="text/css">
        .st0{fill:#BA5517;}
      </style>
      <path id="XMLID_126_" class="st0" d="M115,456c0,0,124.3,70.6,129.3,70.7l-64.7,80c0,0,18,16.7,20,15.3s62-83,62-83
	s133.2,44.2,136.7,42.3c3.8-2.1-18.7-58.7-18.7-58.7s79.3-22.7,78.7-25.3c-0.7-2.7-20.7-22-20.7-22L505,426c0,0-52-10.7-52-13.3
	c0-2.7,6.7-30,6.7-30l-65.3,4.7L429,320l-46.7-6l6.7-92l-68,66l-37.3-28l-22,75.3l-40.7-56l-17.3,30l-43.3-34.7l19.3,92.7L136.3,356
	l23.3,64.9L115,456z" />
    </svg>
  </div>
</div>
              
            
!

CSS

              
                $backgroundColor: #d4851c;
$borderColor:#ae700b;
@import url(https://fonts.googleapis.com/css?family=Montserrat:700);

body{
  background-color:#333;
}

.container{
  width:400px;
  height:200px;
  position:relative;
  background-color:$backgroundColor;
  border-style: solid;
  border-width:15px;
  border-color: $borderColor;
  margin:0 auto;
  overflow:hidden;
  top:25px;
   box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
}

.Autumn{
  font-family: 'Montserrat';
  text-align:center;
  width:90%;
  font-size:2em;
  top:25px;
  position:relative;
  margin:0 auto;
  z-index:2;
}

.leaf{
  position:relative;
  width:100px;
  top:-300px;
  left:0px;
  float:right;
  z-index:1;
  overflow:hidden;
}
              
            
!

JS

              
                var autumnColors = ['#fe6905', '#ae700b', '#a22a29', '#da2f03', "#ff8e0c"];
var content_text = $('.Autumn').find('.source').text();
var string_temp = "";
var colorCounter = Math.floor(Math.random() * autumnColors.length);

$('.container').mousemove(function(e) {
  //var top = (e.pageY * -1 / 10);
  var left = (e.pageX * -1 / 10);
  $('.leaf').css('left', left + 'px');
  /*$('.Autumn').css('left', ((left*-1)/2) - 30 + 'px');
   $('.Autumn').css('top', ((top)/2) + 30 + 'px');*/
});

for (var i = 0; i < content_text.length; i++) {
  charRef = content_text.charAt(i);
  //if (charRef != " ") {
  ++colorCounter;
  if (colorCounter == autumnColors.length) {
    colorCounter = 0
  }
  //}
  string_temp = string_temp + charRef;
  span = $('<span />').html(charRef);
  var seqColor = autumnColors[colorCounter];
  span.css({
      'color': seqColor,
      'padding': '5px 5px 5px 10px',
      '-moz-user-select': 'none',
      '-khtml-user-select': 'none',
      '-webkit-user-select': 'none',
      '-o-user-select': 'none',
      'pointer-events': 'none',
      'z-index': '4'
    })
    //add span
  $('.Autumn').append(span);
}

//set source text ot null
$('.Autumn').find(".source").text("");

//set leaf svg to random colour
setLeaf();

function setLeaf() {
  $('.leaf').css({
    'top': '-300px',
    'width': (Math.random() * 100) + 25,
    'left': Math.random() * -300,
    /*"filter": "blur(4px)",
    "-webkit-filter": "blur(" + Math.random() * 2 + "px)",
    "-moz-filter": "blur(" + Math.random() * 2 + "px)",
    "-o-filter": "blur(" + Math.random() * 2 + "px)",
    "-ms-filter": "blur(" + Math.random() * 2 + "px)",
    "filter": "url('#f1')"*/
  });
  
  $('#leafSvg').find('.st0').css({
    'fill': autumnColors[Math.floor(Math.random() * autumnColors.length)]
  });
  //trigger elaf anim
  fallLeaf();
}

function fallLeaf() {
  TweenMax.to($('.leaf'), 5, {
    rotation: Math.random() * 540,
    top: 30,
    ease: Linear.easeOut,
    onComplete: setLeaf,
    onCompleteScope: this
  })
}
              
            
!
999px

Console