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 ng-app="appBanner" ng-controller="bannerCtrl" class="navCircleContainer">

  <nav-circle id="zero" class="navCircleTransition" ng-class="{active: isCurrentIndex(0)}" ng-click="setCurrentIndex(0)">
    <svg id="circle" height="100" width="100">
      <circle class="nav-circle" cx="50" cy="50" r="45" />
    </svg>
  </nav-circle>

  <nav-circle id="one" class="navCircleTransition" ng-class="{active: isCurrentIndex(1)}" ng-click="setCurrentIndex(1)">
    <svg id="circle" height="100" width="100">
      <circle class="nav-circle" cx="50" cy="50" r="45" />
    </svg>
  </nav-circle>

  <nav-circle id="two" class="navCircleTransition" ng-class="{active: isCurrentIndex(2)}" ng-click="setCurrentIndex(2)">
    <svg id="circle" height="100" width="100">
      <circle class="nav-circle" cx="50" cy="50" r="45" />
    </svg>
  </nav-circle>
  
  <nav-circle id="three" class="navCircleTransition" ng-class="{active: isCurrentIndex(3)}" ng-click="setCurrentIndex(3)">
    <svg id="circle" height="100" width="100">
      <circle class="nav-circle" cx="50" cy="50" r="45" />
    </svg>
  </nav-circle>
  
</div>
              
            
!

CSS

              
                .navCircleContainer {
  position: absolute;
  display: flex;
  justify-content: space-between;
  padding: 5px;
  bottom: 2.5px;
  left: 12.5%;
  width: 75%;
}

body {
  background: #ffffff;
  background: #333;
}

.nav-circle {
  stroke: #F44336;
  stroke-width: 4;
  visibility: hidden;
  opacity: 0;
  fill: #555;
  fill-opacity: 0.8;
}
              
            
!

JS

              
                console.clear();
var log = console.log.bind(console);

angular.module("appBanner", ['ngAnimate'])
  .controller('bannerCtrl', function($scope) {

    // $scope.currentIndex = 0;
  
    // Don't use an index value to start off with or it won't animate the first circle
    // until you click on some of the other circles
    $scope.currentIndex = -1;
    $scope.setCurrentIndex = function(index) {
      $scope.currentIndex = index;
    }

    $scope.isCurrentIndex = function(index) {
      return $scope.currentIndex === index;
    }
  })

  // Create controller for directive. Use 'this' instead of $scope to access
  // properties/methods in directive. A controller will be created for each directive
  .controller("NavCircleController", function() {
  
    this.timeline = new TimelineMax({ paused: true });
  })
  .directive("navCircle", function() {
  
    return {
      scope: {}, // Isolate scope
      controller: "NavCircleController", // Controller to use for directive
      link: function(scope, element, attrs, ctrl) { // Notice the 4th parameter, this is the directive controller
        
        var circle = element.find(".nav-circle");
        
        // The circle is hidden in the CSS. Make it visible and set drawSVG to 0% 0%
        TweenLite.set(circle, { drawSVG: "0% 0%", autoAlpha: 1 });
        
        // Add animations to timeline on controller
        ctrl.timeline.to(circle, 1.5, {
          fillOpacity: 0,
          drawSVG: "0% 100%",
          ease: Linear.easeInOut
        });
      }
    };
  })
  .animation(".navCircleTransition", function() {
  
    return {
      addClass: function(element, className, done) {
        
        if (className === "active") {
          
          // Get controller for element/directive
          var ctrl = element.controller("navCircle");
          
          // Get timeline from controller
          var tl = ctrl.timeline;
          
          // Set the onComplete function to done
          tl.onComplete = done;
          
          // Play the animation
          tl.play();
          
        } else {
          done();
        }
      },
      removeClass: function(element, className, done) {
        
        if (className === "active") {
          
          var ctrl = element.controller("navCircle");
          
          var tl = ctrl.timeline;
          
          tl.onComplete = done;
          tl.reverse();
          
        } else {
          done();
        }
      }
    };
  })
//   .animation('.navCircleTransition', function($window) {
//     return {
//       addClass: function(element, className, done) {
//         if (className === 'active') {
//           var svgEl = element.find("circle");
//           log("CIRCLE %O", svgEl)
//           navCircleAnimate(svgEl, "play", done);
//         } else {
//           done();
//         }
//       },
//       removeClass: function(element, className, done) {
//         if (className === 'active') {
//           var svgEl = element.find("circle");
//           log("CIRCLE %O", svgEl)
//           navCircleAnimate(svgEl, "reverse", done);
//         } else {
//           done();
//         }
//       }
//     }
//   });

// function navCircleAnimate(el, direction, done) {
//   var tlNavCircle = new TimelineMax({
//     paused: true
//   });
//   tlNavCircle.set($(el), {
//     fill:"white",
//     drawSVG: "0% 100%"
//   });
  
//   tlNavCircle.to($(el), 1, {
//     drawSVG: "0% 0%",
//     fill:"blue",
//     ease: Linear.easeInOut,
//     onComplete: done
//   });

//   if (direction === "play") tlNavCircle.play();
//   else tlNavCircle.reverse();
// }
              
            
!
999px

Console