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="ball"></div>
<section class="section1">
  <div class="hero"><p class="trigger0">what up?</p></div>
</section>
<section class="section2"></section>
<section class="section3"></section>
<section class="section4"></section>
              
            
!

CSS

              
                section {
  width: 100%;
  height: 100vh;
}

.section1,
.hero {
  display: flex;
  justify-content: center;
  align-items: center;
}
.ball {
  width: 1000px;
  height: 1000px;
  position: fixed;
  background: lightblue;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(0%, -50%);
}
              
            
!

JS

              
                // Scroll Interactions
  //Init Controller
  let controller = new ScrollMagic.Controller();
  // Ball Scene
  let ball = $('.ball');
  let xCenter = window.innerWidth/2;
  let yCenter = window.innerHeight/2;
  let ballTl0 =  new TimelineLite();
  let ballTl =  new TimelineLite();
  let ballT2 =  new TimelineLite();
  let ballT3 =  new TimelineLite();

  let ballScene0 = new ScrollMagic.Scene({
    triggerElement: '.trigger0',
  })
  .setTween(ballTl0)
  .addIndicators()
  .addTo(controller);
  
  let ballScene1 = new ScrollMagic.Scene({
    triggerElement: '.section2',
  })
  .setTween(ballTl)
  .addIndicators()
  .addTo(controller);
  
  let ballScene2 = new ScrollMagic.Scene({
  triggerElement: '.section3',
  })
  .setTween(ballT2)
  .addIndicators()
  .addTo(controller);
  
  let ballScene3 = new ScrollMagic.Scene({
  triggerElement: '.section4',
  })
  .setTween(ballT3)
  .addIndicators()
  .addTo(controller);
  
  // Change index
  
  function changeIndex() {
    console.log('change index!!!');
  }

  ballTl0
    .to(ball, .8, {css:{ x: '-12%', borderRadius: '50%'}, ease: Elastic.easeOut.config(.5, 0.4)})
  
  ballTl
    .to(ball, .8, {css:{ x: '10%', borderRadius: 0}, ease: Elastic.easeOut.config(.5, 0.4)})
    ;
    
  ballT2
    .to(ball, .5, {css:{ x: '-50%', borderRadius: '50%', scale: .5}, ease: Elastic.easeOut.config(.5, 0.4)})
    ;
    
  ballT3
    .to(ball, .5, {css:{ x: '-90%', borderRadius: 0, scale: 1}, ease: Elastic.easeOut.config(.5, 0.4)})
    ;
              
            
!
999px

Console