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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <p class="scroll">scroll,</p>
<div class="animated  bounce">
  <img src="http://static.indigoimages.ca/2016/shop/114450_img12_whiteAirplane_v3.png" alt="white plane"  class="whitePlane"/>
</div>

<div class="container" id="bezier">
  <img src="http://static.indigoimages.ca/2016/shop/114450_img16_line.jpg" class="background"/>
  <img src="http://static.indigoimages.ca/2016/shop/114450_img01_blueAirplane_45deg.png" class="plane" id="plane"/>
  <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 726.57 3896.09">
    <path style="fill:none;isolation:isolate"/>
    <path id="lisaPath" d="M12.8,4.64a808.3,808.3,0,0,0,162,81c250.5,91.5,424.1,10.5,512,124,2.2,2.8,46.1,61.3,32,126-18.3,83.7-127.5,148.3-276,156-283.8,53-451.6,204.1-438,312,8.5,67.2,90.4,142.3,170,172,45.9,17.1,52.6,5.6,154,24,98.4,17.9,148.4,27,200,60,20.1,12.9,127.7,81.8,124,176-3.4,86.8-99.1,142.5-160,178-99.8,58.2-197.8,67.4-254,68-133.2,56.5-195,161.2-171.8,226.9,3.1,8.9,18.1,46,83.8,70.1,0,0,386-10,440,80s48,214-106,270-384,134-390,200-60,138,108,210c230,30,188-46,434,84,42.8,35.3,51.4,66.9,53.5,84,10.2,85.3-98.8,191.3-281.5,241-206.8,64.2-330,177.1-316,258,11,63.2,106,108.3,114,112,69.9,32.3,95.5,4.7,194,30,48.3,12.4,122.9,32.6,176,98,14.1,17.4,50.9,61.5,50,120-1.8,116.6-147.2,185.9-156,190q-234,68.55-468,137"/></svg>
</div>
  
              
            
!

CSS

              
                html, body {
  background: #0086b8;
  height: 100%;
  text-align: center;
  width: 100%;
}
.scroll {
  font: italic 700 84px/1.5 'playfair display';
  color: #FBFDFE;
  letter-spacing: 0.03em;
}
.bounce {
  animation-iteration-count: infinite;
  animation-duration: 4s;
}

.whitePlane{
  transform: rotate(75deg);
}

.container {
  position: relative;
  width: 1108px;
  height: 3896.09px;
  margin: 755px auto 1255px;
}

.plane {
  position: absolute;
  z-index: 10;
  left: 105px;
  top: 40px;
}

#Layer_1 {
  // stroke: black;
  fill: none;
  position: absolute;
  max-width: 726px;
  top: 100px;
  left:150px
}
              
            
!

JS

              
                var svg = $('#Layer_1'),
  plane = $('.plane'),
  pathString = $("#lisaPath").attr('d'),
  lisaPath = Snap.path.toCubic(pathString),
  arrayPath = [];

var controller = new ScrollMagic.Controller({
  globalSceneOptions: {
    offset: 100
  }
});

function calcOffset() {
  var center = $(window).scrollTop() + (window.innerHeight / 2) - (plane.height() / 2),
    offset = plane.position().top,
    distance = center - offset;
}

function setUpPoint(segment) {
  for (var i = 0; i < segment.length; i += 2) {
    //create a new object for the point so it can be passed to the bezier plugin
    var point = {};
    point.x = segment[i];
    point.y = segment[i + 1];
    //add the point to the array
    arrayPath.push(point);
  } //loop end
}

// loop through the curves collection
for (var i = 0; i < lisaPath.length; i++) {
  var segment = lisaPath[i],
    point;
  // the first element returned in the array is a letter, remove it
  segment.shift();
  //call the function to set up the points based on the segment returned
  point = setUpPoint(segment);
}

var tween1 = new TimelineMax()
  .add(TweenMax.to(plane, 1, {
    bezier: {
      values: arrayPath,
      type: "cubic",
      autoRotate: true
    },
    ease: Linear.easeNone,
    onUpdate: calcOffset
  }));



// build scene
var scene = new ScrollMagic.Scene({
    triggerElement: ".container",
    duration: svg.height()
  })
  .setTween(tween1)
  .addTo(controller)
    .on("update", function (e) { 
    var stDiv = $("#scrollDirection"),
        st = e.target.controller().info("scrollDirection");
    // stDiv.text(st); 
    if (st === 'FORWARD') {
      plane.attr('src', 'http://static.indigoimages.ca/2016/shop/114450_img01_blueAirplane_45deg.png');
    } else if (st === 'REVERSE') {
      plane.attr('src', 'http://static.indigoimages.ca/114450_img01_blueAirplane_45deg__REVERSED.png');
    };
});
              
            
!
999px

Console