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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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="pseudoWindow">
  <svg viewBox="0 0 200 150">
    <circle id="circle" cx="100" cy="75" r="75" fill="green" />
    <text x="67" y="85" fill="#424242" font-size="30" font-family="sans-serif">scroll</text>
  </svg>

  <svg viewBox="0 0 200 150">
    <ellipse id="ellipse" cx="100" cy="75" rx="100" ry="50" fill="#7AA20D" />
  </svg>
</div>
              
            
!

CSS

              
                body{
  margin:0;
  background:grey;
}
#pseudoWindow{
  height: 0;
  width: 100%;
  margin: 0;
  padding: 0;
}

svg{
  position: fixed;
  height:80vh;
  margin:20px;
}

#ellipse{
  visibility:hidden;
}
              
            
!

JS

              
                

// Technically it’s only feasible to morph <path> elements or <polyline>/<polygon> elements, but what if you want to morph a <circle> or <rect> or <ellipse> or <line>:

MorphSVGPlugin.convertToPath("circle, rect, ellipse, line, polygon, polyline");


// the morph animation - paused
action = new TimelineMax({paused:true})
  .to('#circle',3,{morphSVG: '#ellipse', ease: Power0.easeNone, repeat:3, yoyo:true, repeatDelay:1});

// The height of the pseudoWindow (= scroll distance) defines the duration / speed of the animation - just test alternatives

TweenLite.set('#pseudoWindow',{height:3000});


// Tween the progress of the paused timeline ACTION with the scroll progress

$(window).scroll( function(){
  var scrollTop = $(window).scrollTop();
  var docHeight = $(document).height();
  var winHeight = $(window).height();
  if( scrollTop >= 0){
    action.progress( scrollTop / ( docHeight - winHeight ) );
  }
});
              
            
!
999px

Console