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

              
                <section class="demo" id="bezier">
  <div class="spacer s2"></div>
  <div class="spacer s0" id="trigger"></div>
  <div id="target">
    <img id="plane" src="https://janpaepke.github.io/ScrollMagic/img/example_bezier.png">
  </div>
  <div class="spacer s2"></div>
</section>
<div class="spacer s_viewport"></div>
              
            
!

CSS

              
                .dot{
	position: absolute;
	width: 8px;
	height: 2px;
	background-color: red;
	border-radius: 50%;
}
              
            
!

JS

              
                	$(function () { // wait for document ready
		var flightpath = {
			entry : {
				curviness: 1.25,
				autoRotate: true,
				values: [
						{x: 100,	y: -20},
						{x: 300,	y: 10}
					]
			},
			looping : {
				curviness: 1.25,
				autoRotate: true,
				values: [
						{x: 510,	y: 60},
						{x: 620,	y: -60},
						{x: 500,	y: -100},
						{x: 380,	y: 20},
						{x: 500,	y: 60},
						{x: 580,	y: 20},
						{x: 620,	y: 15}
					]
			},
			leave : {
				curviness: 1.25,
				autoRotate: true,
				values: [
						{x: 660,	y: 20},
						{x: 800,	y: 130},
						{x: $(window).width() + 300,	y: -100},
					]
			}
		};
		// init controller
		var controller = new ScrollMagic.Controller();

		// create tween
		var tween = new TimelineMax()
			.add(TweenMax.to($("#plane"), 1.2, {css:{bezier:flightpath.entry}, ease:Power1.easeInOut}))
			.add(TweenMax.to($("#plane"), 2, {css:{bezier:flightpath.looping}, ease:Power1.easeInOut}))
			.add(TweenMax.to($("#plane"), 1, {css:{bezier:flightpath.leave}, ease:Power1.easeInOut}));

     var dots = 200;
  var target = $("#plane")[0]
    
  for (var i = 1; i <= dots; i++){
  var dot = $("<div class='dot'></div>").appendTo($("#target")); //create a dot.
 tween.progress(i/dots); // increment the progress().
  
 TweenLite.set(dot, {x:target._gsTransform.x, y:target._gsTransform.y, rotation:target._gsTransform.rotation, opacity:0}); //position dot based on target's x/y position.
  tween.set(dot, {opacity:1}, tween.time())
   tween.time(0).play()
  }
    
    
    
		// build scene
		var scene = new ScrollMagic.Scene({triggerElement: "#trigger", duration: 500, offset: 100})
						.setPin("#target")
						.setTween(tween)
						.addIndicators() // add indicators (requires plugin)
						.addTo(controller);
	})
              
            
!
999px

Console