Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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 class="container">
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440.81 14707.15">
		<defs>
			<style>.cls-1 {
					opacity: 0.11;
				}

				.cls-2 {
					opacity: 0.15;
				}

				.cls-3 {

					opacity: 0.15;
				}

				.cls-4 {

					opacity: 0.1;
				}</style>
		</defs>
		<g id="Layer_2">
			<g id="Layer_1-2" >
				<polygon class="cls-1" points="246.28 0 910.97 0 1440 529.04 1440 1193.72 246.28 0"/>
				<polygon class="cls-2" points="1440 778.43 1440.81 1442.3 0 2883.11 0 2218.43 1440 778.43"/>
				<polygon class="cls-3" points="1440 3907.52 1440 4572.2 0 3132.2 0 2467.52 1440 3907.52"/>
				<polygon class="cls-4" points="1440 4156.91 1440.81 4820.79 0 6261.6 0 5596.91 1440 4156.91"/>
				<polygon class="cls-1" points="1440 7286.01 1440 7950.69 0 6510.69 0 5846.01 1440 7286.01"/>
				<polygon class="cls-3" points="1440 10663.99 1440 11328.67 0 9888.67 0 9223.99 1440 10663.99"/>
				<polygon class="cls-4" points="1440 10913.38 1440.81 11577.25 0 13018.06 0 12353.38 1440 10913.38"/>
				<polygon class="cls-1" points="1440 14042.47 1440 14707.15 0 13267.15 0 12602.47 1440 14042.47"/>
				<polygon class="cls-2" points="1440 7535.4 1440.81 8199.27 0 9640.08 0 8975.4 1440 7535.4"/>
			</g>
		</g>
	</svg>
</div>	
<div class="body">
  
</div>



              
            
!

CSS

              
                .body{
  height: 2500px;
  
}

.container{
  width: 100vw;
  height: 100vh;
  position: fixed;
  left: 0;
  right:0;
  z-index: -1;
    
}
              
            
!

JS

              
                console.clear();
// const diagonalHeight = diagonalGroup.get(0).getBBox().height;

$(function() {
  var $window = $(window);
  var scrollTop = $window.scrollTop();
  const diagonalGroup = $("#Layer_1-2");
  var lastScrollTop = 0;
  var scrollDir;

  var timeline = new TimelineMax({ paused: true }).to(diagonalGroup, 1, {
    yPercent: -95
  });

  var proxyTween = TweenLite.to({}, 400, {});

  TweenLite.defaultEase = Linear.easeNone;

  $window.on("scroll", function() {
    //get document height
    var documentHeight = $(document).height();
    //get window height
    var windowHeight = $window.height();
    //get distance of window scrollbar
    scrollTop = $(window).scrollTop();

    var scrollPercent = Math.max(
      scrollTop / (documentHeight - windowHeight),
      0
    );

    scrollDir = scrollTop < lastScrollTop;
    // get difference to use as new progress
    var scrollDiff = (scrollTop - lastScrollTop) / (documentHeight - windowHeight);
    
    // make sure new progress is between 0 and 1 to avoid jumps
    var newProgress = Math.min(Math.max(0, proxyTween.progress() + scrollDiff), 1);
    proxyTween.progress(newProgress);
    
    if (scrollDir) {
      proxyTween.reverse();
    } else {
      proxyTween.play();
    }

    lastScrollTop = scrollTop;
  });

  TweenLite.ticker.addEventListener("tick", function() {
    var progress = timeline.progress();
    // ease can be anything from 0.5 to 0.01
    // Change ease to tweak effect
    progress += (proxyTween.progress() - progress) * 0.04;
    timeline.progress(progress);
  });
});

              
            
!
999px

Console