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 class="main">
  <div class="checkpoint01 checkpoint"></div>
  <div class="checkpoint02 checkpoint"></div>
  <div class="checkpoint03 checkpoint"></div>
  <div class="checkpoint04 checkpoint"></div>
</div>

  <div class="blobsWrapper">
    <div class="section"></div>
    <div class="section"></div>
    <div class="section"></div>
    <div class="section"><h1>The end.</h1></div>
    <div class="section section04"><h1>four</h1></div>
    <div class="section section03"><h1>three</h1></div>
    <div class="section section02"><h1>two</h1></div>
    <div class="section section01"><h1>one</h1></div>
  </div>


<div class="half"></div>
              
            
!

CSS

              
                
@import url("https://fonts.googleapis.com/css?family=Lato:400,400i,700");

body{
  background-color: #123417;
  margin: 0;
  font-family: 'Lato Sans', sans-serif;
  color:#c1d6c2;
}

h1{
  position: relative;
  top: 47%;
  font-family: 'Lato Sans', sans-serif;
  font-size:10vw;
  margin: 0;
  text-align: center;
  visibility:hidden;
}

.main{
  position: relative;
  height:3000px;
  z-index: 2;
}

.blobsWrapper {
  position:fixed;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100vw;
  margin:0;
}
.section{
  position: absolute;
  text-align: center;
  width:20vw;
  height: 20vw;
}
.checkpoint{
  position: absolute;
  width: 10px;
  height: 10px;
  background: red;
}
.half{
  position: fixed;
  top: 50%;
  width: 30px;
  height: 1px;
  border-top: 1px solid #7d7d7d;
}
              
            
!

JS

              
                console.clear();

TweenMax.set("h1, .checkpoint",{yPercent:-50, autoAlpha:1});
TweenMax.set(".end h1",{xPercent:-50, autoAlpha:1});
TweenMax.set(".end",{xPercent:-50, y:-120});
TweenLite.defaultEase = Sine.easeInOut;

var half = window.innerHeight/2;

  //Checkpoints:  adjust each as you want
  TweenMax.set(".checkpoint01", {y:800});
  TweenMax.set(".checkpoint02", {y:1200});  
  TweenMax.set(".checkpoint03", {y:1500});  
  TweenMax.set(".checkpoint04", {y:2000});
 
var sections = $('.section');


var randomColor = '#'+ ('000000' + Math.floor(Math.random()*16777215).toString(16)).slice(-6);

  TweenMax.staggerTo(sections,0,{
    cycle:{
      width:function(index){
         return (index+1) * 10+30 +"vw";
      },
      height:function(index){
        return (index+1) * 10+30 +"vw";
      },
      borderRadius:function(index){
        return (index+1) * 10+30 +"vw";
      },
      background:['#ac6262', '#831717','#a62020']
    }
  },-0.1)

// === The Blob Timeline ==============
// The blob animations + change of flag onStart
// to prevent another start while scrolling ======
var active01 = false;
var blobAnimation01 = new TimelineMax({paused:true, onStart:stop01})
.to(".section01", 0.5, {scale:0, transformOrigin:"center"})
.to(".section01",0, {autoAlpha:0})
.staggerTo(".section",0.2,{scale:0.9,transformOrigin:"center"},-0.1)

var active02 = false;
var blobAnimation02 = new TimelineMax({paused:true, onStart:stop02})
.to(".section02", 0.5, {scale:0, transformOrigin:"center"})
.to(".section02",0, {autoAlpha:0})
.staggerTo(".section",0.5,{scale:0.8,transformOrigin:"center"},-0.1)

var active03 = false;
var blobAnimation03 = new TimelineMax({paused:true, onStart:stop03})
.to(".section03", 0.5, {scale:0, transformOrigin:"center"})
.to(".section03",0, {autoAlpha:0})
.staggerTo(".section",0.5,{scale:0.7,transformOrigin:"center"},-0.1)

var active04 = false;
var blobAnimation04 = new TimelineMax({paused:true, onStart:stop04})
.to(".section04", 0.5, {scale:0, transformOrigin:"center"})
.to(".section04",0, {autoAlpha:0})
.staggerTo(".section",0.5,{scale:0.6,transformOrigin:"center"},-0.1)
  
function stop01 (){
  active01 = true;
} 
function stop02 (){
  active02 = true;
}    
function stop03 (){
  active03 = true;
}
function stop04 (){
  active04 = true;
}

// ============================================= 
  onResize = function() {

    $( window ).scroll(function() {

      var object01 = $('.checkpoint01').offset().top - $(window).scrollTop() -half+10;
      var object02 = $('.checkpoint02').offset().top - $(window).scrollTop() -half+10;
      var object03 = $('.checkpoint03').offset().top - $(window).scrollTop() -half+10;
      var object04 = $('.checkpoint04').offset().top - $(window).scrollTop() -half+10;


      if(!active01 && object01 <= 0 ) {
        blobAnimation01.restart();
        TweenLite.set('.checkpoint01',{background:"#159415"});
      }
      else if(object01 > 0 ) {
        blobAnimation01.reverse();
        TweenLite.set('.checkpoint01',{background:"red"});
        active01 = false;
      }

      if(!active02 && object02 <= 0 ) {
        blobAnimation02.restart();
        TweenLite.set('.checkpoint02',{background:"#159415"});
      }
      else if(object02 > 0 ) {
        blobAnimation02.reverse();
        TweenLite.set('.checkpoint02',{background:"red"});
        active02 = false;
      }

      if(!active03 && object03 <= 0 ) {
        blobAnimation03.restart();
        TweenLite.set('.checkpoint03',{background:"#159415"});
      }
      else if(object03 > 0 ) {
        blobAnimation03.reverse();
        TweenLite.set('.checkpoint03',{background:"red"});
        active03 = false;
      }
      
      if(!active04 && object04 <= 0 ) {
        blobAnimation04.restart();
        TweenLite.set('.checkpoint04',{background:"#159415"});
      }
      else if(object04 > 0 ) {
        blobAnimation04.reverse();
        TweenLite.set('.checkpoint04',{background:"red"});
        active04 = false;
      } 

    console.log(object01);
    });  
  }
  
  $(document).ready(onResize);
  $(window).resize(onResize);
  
    


              
            
!
999px

Console