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

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.

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 id="section0"> </div>
<div id="section1"> </div>


<div class="tree-container">
  
  
<svg id="tree-svg" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" x="0px" y="0px" width="500px" height="800px" viewBox="0 0 500 800" enable-background="new 0 0 500 800"
				xml:space="preserve">
	<defs></defs>


<!-- TREE TRUNK LEFT -->
	<g>
		<path id="tree0" fill="#C49A6C" d="M245.1,800.1v-99.6l-2.6,40v1.1c-0.2,0.1-0.1,1.8-0.1,1.8s-1.1,41.7-1.8,56.8L245.1,800.1L245.1,800.1z" />
		<path id="tree1" fill="none" d="M243.2,800V607l-5.4,77.4l-5.5-1.4c0.1,0.3,5.7,6.9,5.7,6.9s-2.2,80.9-3.4,110.1H243.2z" />
		

	</g>

	<!-- TREE TRUNK RIGHT -->
	<g>
		<path id="tree0b" fill="#A97C50" d="M247.4,728.8c0,0-2.2-28.5-2.3-28.5V800h6.2l-3.6-66.2l-0.1-2.1L247.4,728.8z" />

		<path id="tree1b" fill="none" d="M248.8,677.2c0,0-5.4-70.3-5.6-70.3V800h12.1c-1.4-29.2-5.2-113.2-5.2-113.2l8.9-17.7L248.8,677.2z" />
		

	</g>
  
  
  
  <!-- LEAF1A  -->
	<g>
		<path id="leaf0a" fill="#75D877" d="M245.2,733.2c-0.7-1-1.7-1.6-2.8-1.8h-0.1c-0.1,0-0.2,0-0.3,0c-1.3-0.2-2.8,0.2-4.1,1.1
			c-0.2,0.1-0.4,0.3-0.6,0.4c-4.5,3.4-5.6,11.2-5.6,11.2s7.8-0.2,11.9-3.9C246,738.4,246.7,735.3,245.2,733.2z" />

		<path id="leaf1a" fill="none" d="M233.1,681.4c-0.8-1.1-1.9-1.8-3.2-2.1c0,0-0.1,0-0.1-0.1c-0.1,0-0.2,0-0.3,0
			c-1.5-0.2-3.2,0.2-4.7,1.2c-0.2,0.2-0.4,0.3-0.6,0.5c-5.1,3.8-6.4,12.8-6.4,12.8s8.9-0.2,13.5-4.4
			C234,687.4,234.8,683.8,233.1,681.4z" />

	</g>

	<!-- LEAF1B  -->
	<g>
		<path id="leaf0b" fill="#7CC170" d="M231.9,744c4.6,0.5,17.4-3.9,13.6-10.5c-0.8-1.5-1.8-1.7-1.8-1.7
			C234.5,735.5,231.9,744,231.9,744z" />

		<path id="leaf1b" fill="none" d="M217.9,693.8c5.3,0.6,19.9-4.4,15.6-12c-1-1.7-2-2-2-2C220.8,684.1,217.9,693.8,217.9,693.8z" />

	</g>
  
  
  
  <!-- LEAF2A  -->
	<g>
		<path id="leaf2a0" fill="#75D877" d="M247.1,729.2c-0.6-1.4-0.5-2.9,0.1-4.3v-0.1c0.1-0.1,0.1-0.2,0.2-0.3c0.8-1.6,2.2-2.9,4-3.7
			c0.3-0.1,0.6-0.2,0.9-0.3c6.8-2.4,16,1.9,16,1.9s-5.7,8.2-12.5,10C252.2,733.7,248.4,732.3,247.1,729.2z" />

		<path id="leaf2a1" fill="none" d="M253.1,675.2c-0.6-1.6-0.6-3.3,0.1-4.9v-0.1c0.1-0.1,0.1-0.2,0.2-0.3c0.9-1.8,2.5-3.3,4.6-4.2
			c0.3-0.1,0.7-0.2,1-0.3c7.7-2.8,18.2,2.1,18.2,2.1s-6.5,9.4-14.3,11.4C258.9,680.3,254.5,678.7,253.1,675.2z" />

	</g>

	<!-- LEAF2B  -->
	<g>
		<path id="leaf2b0" fill="#7CC170" d="M268.2,722.6c-2.7,5.3-16.4,15.9-20.9,7.2c-1-1.9-0.6-3.1-0.6-3.1
			C257.2,719.4,268.2,722.6,268.2,722.6z" />

		<path id="leaf2b1" fill="none" d="M277.2,667.6c-3.1,6.1-18.8,18.1-23.8,8.2c-1.1-2.2-0.6-3.6-0.6-3.6
			C264.7,663.9,277.2,667.6,277.2,667.6z" />

	

	</g>

  </svg>
  
</div>
              
            
!

CSS

              
                body, html {
  padding:0;
  margin:0;
}


#section0 {
  height:100vh;
  background-color:#CCC;
}
#section1 {
  height:100vh;
  background-color:#999;
}


.tree-container {
  position: fixed;
  right:0;
  left: 0;
  top:0;
  height: 100vh;
}

#tree-svg {
  bottom: 18px;;
  position: absolute;
  right: 0;
  left:50%;
  margin-left:-250px;
}
              
            
!

JS

              
                (function() {
    if (typeof ScrollMagic !== 'undefined') {
        // Init ScrollMagic Controller
        var scrollMagicController = new ScrollMagic.Controller(),

            // TRUNK LEFT
            tree0 = document.getElementById("tree0");

        
        var trunkLeft = TweenLite.to(tree0, 0.7, {
            morphSVG: "#tree1"
        });

        // Create the Scene and trigger when visible
        var scene = new ScrollMagic.Scene({
                triggerElement: '#section1',
                duration: '100%',
                triggerHook: 1
            })
            .setTween(trunkLeft)
            .addTo(scrollMagicController);



        //TRUNK RIGHT

        tree0b = document.getElementById("tree0b");
        
        var trunkRight = TweenLite.to(tree0b, 0.7, {
            morphSVG: "#tree1b"
        });

        // Create the Scene and trigger when visible
        var scene2 = new ScrollMagic.Scene({
                triggerElement: '#section1',
                duration: '100%',
                triggerHook: 1
            })
            .setTween(trunkRight)
            .addTo(scrollMagicController);


        //LEAF1A

        leaf0a = document.getElementById("leaf0a");
       
        var leaf1a = TweenLite.to(leaf0a, 0.7, {
            morphSVG: "#leaf1a"
        });

        // Create the Scene and trigger when visible
        var scene3 = new ScrollMagic.Scene({
                triggerElement: '#section1',
                duration: '100%',
                triggerHook: 1
            })
            .setTween(leaf1a)
            .addTo(scrollMagicController);


        //LEAF1B

        leaf0b = document.getElementById("leaf0b");
        
        var leaf1b = TweenLite.to(leaf0b, 0.7, {
            morphSVG: "#leaf1b"
        });

        // Create the Scene and trigger when visible
        var scene4 = new ScrollMagic.Scene({
                triggerElement: '#section1',
                duration: '100%',
                triggerHook: 1
            })
            .setTween(leaf1b)
            .addTo(scrollMagicController);


        //LEAF2A

        leaf2a0 = document.getElementById("leaf2a0");
        
        var leaf2a0 = TweenLite.to(leaf2a0, 0.7, {
            morphSVG: "#leaf2a1"
        });

        // Create the Scene and trigger when visible
        var scene5 = new ScrollMagic.Scene({
                triggerElement: '#section1',
                duration: '100%',
                triggerHook: 1
            })
            .setTween(leaf2a0)
            .addTo(scrollMagicController);


        //LEAF2B

        leaf2b0 = document.getElementById("leaf2b0");
        
        var leaf2b0 = TweenLite.to(leaf2b0, 0.7, {
            morphSVG: "#leaf2b1"
        });

        // Create the Scene and trigger when visible
        var scene6 = new ScrollMagic.Scene({
                triggerElement: '#section1',
                duration: '100%',
                triggerHook: 1
            })
            .setTween(leaf2b0)
            .addTo(scrollMagicController);
      
      
      
        // Add debug indicators fixed on right side
         scene.addIndicators();
    }

})();

              
            
!
999px

Console