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

              
                <svg style="display:none;">
   <symbol id="vertline">
      <rect class="line-vert" x="0" y="0" width="6" height="1200" />
   </symbol>
</svg>
<div style="width:100%; height:450px;background-color:yellow;"></div>
<div id="line-group" class="line-group">
   <div class="line-section line-section1">
      <div class="curve-positioner">
         <svg id="section1-line-curved" viewBox="0 0 360 76" width="360" height="76">
            <path class="line-curved" id="lineCurved1" d="M 357 0 C 357 35 333 73 292 73 L 0 73 " />
         </svg>
      </div>
      <div id="lineVert1" class="line-positioner">
         <svg width="6" height="1200">
            <use xlink:href="#vertline" />
         </svg>
      </div>
      <div id="lineImage1" class="line-section-image">
         <img src="https://picsum.photos/325/270/?image=1025" alt="cute pug" />
         <div class="image-sprite"></div>
         <div class="image-sprite"></div>
         <div class="image-sprite"></div>
         <div class="image-sprite"></div>
         <div class="image-sprite"></div>
      </div>
      <div class="line-section-content">
         <h2>Making New Products</h2>
         <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Corporis, voluptatem. In repellat enim aliquid beatae iusto exercitationem maiores nobis ducimus eligendi nisi! Cupiditate alias totam laudantium facilis earum qui molestiae!</p>
         <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Corporis, voluptatem. In repellat enim aliquid beatae iusto exercitationem maiores nobis ducimus eligendi nisi! Cupiditate alias totam laudantium facilis earum qui molestiae!</p>
         <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Corporis, voluptatem. In repellat enim aliquid beatae iusto exercitationem maiores nobis ducimus eligendi nisi! Cupiditate alias totam laudantium facilis earum qui molestiae!</p>
      </div>
   </div>

   
   <div class="line-section line-section2">
      <div class="curve-positioner">
         <svg id="section2-line-curved" viewBox="0 0 360 76" width="360" height="76">
            <path class="line-curved" id="lineCurved2" d="M 3 0 C 3 35 30 73 68 73 L 360 73" />
         </svg>
      </div>
      <div id="lineVert2" class="line-positioner">
         <svg width="6" height="1200">
            <use xlink:href="#vertline" />
         </svg>
      </div>
      <div id="lineImage2" class="line-section-image">
         <img src="https://picsum.photos/325/270/?image=1025" alt="cute pug" />
      </div>
      <div class="line-section-content">
         <h2>Making New Products</h2>
         <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Corporis, voluptatem. In repellat enim aliquid beatae iusto exercitationem maiores nobis ducimus eligendi nisi! Cupiditate alias totam laudantium facilis earum qui molestiae!</p>
         <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Corporis, voluptatem. In repellat enim aliquid beatae iusto exercitationem maiores nobis ducimus eligendi nisi! Cupiditate alias totam laudantium facilis earum qui molestiae!</p>
      </div>
   </div>

   
   <div class="line-section line-section3">
      <div class="curve-positioner">
         <svg id="section3-line-curved" viewBox="0 0 360 76" width="360" height="76">
            <path class="line-curved" id="lineCurved3" d="M 357 0 C 357 35 333 73 292 73 L 0 73" />
         </svg>
      </div>
      <div id="lineVert3" class="line-positioner">
         <svg width="6" height="1200">
            <use xlink:href="#vertline" />
         </svg>
      </div>
      <div id="lineImage3" class="line-section-image">
         <img src="https://picsum.photos/325/270/?image=1025" alt="cute pug" />
      </div>
      <div class="line-section-content">
         <h2>Making New Products</h2>
         <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Corporis, voluptatem. In repellat enim aliquid beatae iusto exercitationem maiores nobis ducimus eligendi nisi! Cupiditate alias totam laudantium facilis earum qui molestiae!</p>
         <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Corporis, voluptatem. In repellat enim aliquid beatae iusto exercitationem maiores nobis ducimus eligendi nisi! Cupiditate alias totam laudantium facilis earum qui molestiae!</p>
         <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Corporis, voluptatem. In repellat enim aliquid beatae iusto exercitationem maiores nobis ducimus eligendi nisi! Cupiditate alias totam laudantium facilis earum qui molestiae!</p>
      </div>
   </div>

   
   <div class="line-section line-section4">
      <div class="curve-positioner">
         <svg id="section4-line-curved" viewBox="0 0 360 76" width="360" height="76">
            <path class="line-curved" id="lineCurved4" d="M 3 0 C 3 35 30 73 68 73 L 360 73" />
         </svg>
      </div>
      <div id="lineVert4" class="line-positioner">
         <svg width="6" height="1200">
            <use xlink:href="#vertline" />
         </svg>
      </div>
      <div id="lineImage4" class="line-section-image">
         <img src="https://picsum.photos/325/270/?image=1025" alt="cute pug" />
         <div class="image-sprite"></div>
         <div class="image-sprite"></div>
         <div class="image-sprite"></div>
         <div class="image-sprite"></div>
         <div class="image-sprite"></div>
      </div>
      <div class="line-section-content">
         <h2>Making New Products</h2>
         <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Corporis, voluptatem. In repellat enim aliquid beatae iusto exercitationem maiores nobis ducimus eligendi nisi! Cupiditate alias totam laudantium facilis earum qui molestiae!</p>
         <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Corporis, voluptatem. In repellat enim aliquid beatae iusto exercitationem maiores nobis ducimus eligendi nisi! Cupiditate alias totam laudantium facilis earum qui molestiae!</p>
      </div>
   </div>
</div>
<div style="width:100%; height:450px;background-color:yellow;"></div>
              
            
!

CSS

              
                /* Colors */
$lw-blue: #0097cd;
$lw-green: #70be49;
$lw-red: #f05022;
$lw-purple: #8b244f;
$lw-yellow: #ffc52f;
$lw-orange: #f78d2c;
$lw-pink: #e74582;
$lw-teal: #42beac;

.line-group {
   padding-left:50px;
   padding-right:50px;
}

.line-section {
   position:relative;
   padding-top:44px;
   padding-bottom:44px;
   max-width:1050px;
   margin-left:auto;
   margin-right:auto;
   min-height:350px;
}

.line-positioner {
   position:absolute;
   top:0;
   left:50%;
   bottom:0;
   overflow:hidden;
   transform:translateX(-50%);
}

.curve-positioner {
   position:absolute;
   top:33%;
   right:50%;
   transform:translateX(3px);
}

// Images
.line-section-image {
   position:absolute;
   left:0;
   top:33%;
   margin-top:76px;
   transform:translateY(-50%);
   width:30%;
   max-width:325px;
   visibility:hidden;
   opacity:0;
   
   img {
      max-width:100%;
      height:auto;
   }
   
   .image-sprite {
      position:absolute;
      width:40px;
      height:40px;
      background-color:$lw-blue;
      border-radius:50%;
      left:0;
      
      &:nth-of-type(2n+2) {
         left:50px;
         background-color:$lw-teal;
      }
      &:nth-of-type(3n+3) {
         left:100px;
         background-color:$lw-green;
      }
      &:nth-of-type(4n+4) {
         left:150px;
         background-color:$lw-yellow;
      }
      &:nth-of-type(5n+5) {
         left:200px;
         background-color:$lw-orange;
      }
   }
}

.line-section-content {
   position:relative;
   margin-left:50%;
   padding-left:50px;
}

// Even numbered positioning with text on left
.line-section:nth-child(even) {
   .curve-positioner {
      right:auto;
      left:50%;
      transform:translateX(-3px);
   }
   .line-section-content {
      margin-right:50%;
      margin-left:0;
      padding-left:0;
      padding-right:50px;
   }
   .line-section-image {
      left:auto;
      right:0;
   }
}

path {
   stroke-width:6;
   fill:none;
}
use {
   fill:$lw-blue;
}
              
            
!

JS

              
                // Overall DOM elements
var $lineContainer = jQuery("#line-group");
var $lineSections = $lineContainer.find(".line-section");
var $images = jQuery(".line-section-image");
var $sprites = jQuery(".image-sprite");
var $svgPaths = jQuery("path");
var $svgRects = jQuery("rect");

console.log("Number of svg rects: " + $svgRects.length);

var numberOfSections = $lineSections.length;

var sectionColors = [
   "#0097cd",
   "#70be49",
   "#f78d2c",
   "#8b244f",
   "#f05022",
];

// Animation variables
var timeLong = 1;
var timeShort = 0.5;
var straightEase = "Power0.easeNone";
var curvingEase = "Power1.easeOut";
var imageEase = "Back.easeOut";
var imageSpriteEase = "Elastic.easeOut";
var topicTimelines = [];
var topicScenes = [];
var topicImageScenes = [];

// Setting up the master timeline
var masterTL = new TimelineLite();

// Setting up initial states
masterTL
   .set(".line-curved", {drawSVG:"0%"})
   .set($svgPaths, {stroke: sectionColors[0]})
   .set($svgRects, {fill: sectionColors[0]})
   .set($sprites, {scale:"0"});

// Section In
function sectionIn(num) {
   var lineVertID = "#lineVert" + num;
   var lineCurvedID = "#lineCurved" + num;
   var prevLineVertID = "#lineVert" + (num - 1);
   var thisSection = "section" + num;
   
   var zeroBasedNum = num - 1;
   topicTimelines[zeroBasedNum] = new TimelineLite();

   // If this isn't the first section, we'll animate the rest of the previous section's line first
   if (num != 1) {
      topicTimelines[zeroBasedNum].add(function() { console.log("Start color change!"); changeLineColor(num) });
      topicTimelines[zeroBasedNum].to(prevLineVertID, timeShort, {css: {bottom: "0"}, ease:straightEase, force3D:false});
   }
   
   // Animate:
   // 1. the top of this section's vertical line
   // 2. the curved line
   topicTimelines[zeroBasedNum]
   .fromTo(lineVertID, timeShort, {css:{bottom: "100%"}}, {css: {bottom:"66%"}, ease:straightEase, force3D:false})
   .to(lineCurvedID, timeShort, {drawSVG:"100%", ease:curvingEase, force3D:false})
   
   return topicTimelines[zeroBasedNum];
}

// Line color change
function changeLineColor(num) {
   var sectionIndex = num - 1;
   var sectionColor = sectionColors[sectionIndex];

   TweenLite.to($svgPaths, 1.5, {stroke: sectionColor, ease:straightEase});
   TweenLite.to($svgRects, 1.5, {fill: sectionColor, ease:straightEase});
}

// Image Pop function
function imageIn(num) {
   var tl = new TimelineLite();
   var imageID = "#lineImage" + num;
   tl.to(imageID, timeShort, {autoAlpha: 1, ease:imageEase});
   tl.from(imageID, timeShort, {scale:"0",  ease:imageEase, clearProps:"transform"}, 0);
   
   // Bubble in subsprites, if there are any
   var jQueryString = "#lineImage" + num + " > .image-sprite";
   var $bubbleSprites = jQuery(jQueryString);
   if ($bubbleSprites.length > 0) {
      tl.add(bubbleIn($bubbleSprites));
   }
   
   return tl;
}

// Generate random number within a range
function getRandomRange(min, max) {
  return Math.random() * (max - min) + min;
}

// "Bubble in" a collection of items
function bubbleIn(items) {
   var tl = new TimelineLite();
   items.each(function() {
      tl.to(this, 0.3, {scale:"1", ease:imageEase}, getRandomRange(0.01, 0.5));
   });
   return tl;
}

// Set up ScrollMagic
var controller = new ScrollMagic.Controller();

var $sections = jQuery(".line-section");
var numberOfSections = $sections.length;

$sections.each(function(index) {
   //console.log("Looping through sections!  This is index: " + index);
   var loopIndex = index;
   var sceneNumber = loopIndex + 1;
   var $this = jQuery(this);
   var sceneDuration = $this.outerHeight() / 2;
   //console.log("This scene's duration: " + sceneDuration);
   
   topicScenes[index] = new ScrollMagic.Scene({
      triggerElement: this,
      duration: sceneDuration
   })
   .addIndicators()
   .addTo(controller)
   .setTween(sectionIn(sceneNumber));
   
   var imagePopStart = sceneDuration - 100;
   
   topicImageScenes[index] = 
   // No duration and different offset for the image pops
   topicImageScenes[index] = new ScrollMagic.Scene({
       triggerElement: this,
       offset:imagePopStart
   })
   .addTo(controller)
   .setTween(imageIn(sceneNumber));

});
              
            
!
999px

Console