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

              
                <svg class="shape-use" xmlns="http://www.w3.org/2000/svg" version="1.1" x="0" y="0" width="0" height="0" viewBox="0 0 100 86.2" enable-background="new 0 0 100 86.2" xml:space="preserve">
  <defs>
    <g id="shape">
      <polygon fill="none" stroke="#93A3B1" stroke-miterlimit="10" points="2 84.8 50.4 1 98.8 84.8 "/><line fill="none" stroke="#93A3B1" stroke-miterlimit="10" x1="50.4" y1="54" x2="50.4" y2="1.7"/><line fill="none" stroke="#93A3B1" stroke-miterlimit="10" x1="50.4" y1="54" x2="98.8" y2="84.8"/><line fill="none" stroke="#93A3B1" stroke-miterlimit="10" x1="50.4" y1="54" x2="2" y2="84.8"/><polygon fill="none" stroke="#7C898B" stroke-miterlimit="10" points="27.4 42.3 73.2 42 50.4 83.8 "/><line fill="none" stroke="#7C898B" stroke-miterlimit="10" x1="50.4" y1="54" x2="72.9" y2="42.2"/><line fill="none" stroke="#7C898B" stroke-miterlimit="10" x1="50.4" y1="54" x2="50.4" y2="83.8"/><line fill="none" stroke="#7C898B" stroke-miterlimit="10" x1="50.4" y1="54.5" x2="27.4" y2="42.9"/><polygon fill="none" stroke="#636355" stroke-miterlimit="10" points="51.1 84.1 26.9 70.3 26.5 42.5 50.4 28.4 74.6 42.2 74.9 70 "/><ellipse fill="none" stroke="#636355" stroke-miterlimit="10" cx="50.1" cy="55.8" rx="13" ry="13"/>
    </g>
  </defs>
</svg>

<div class="container">
  <div class="left">
    <svg class="s1" x="0" y="0" width="50" height="50" viewBox="0 0 100 86.2">
        <use xlink:href="#shape"/>
    </svg>
    <figcaption>This is a bezier-tween with  curviness set to 0...</figcation>
  </div><!--left-->

  <div class="right">
    <svg class="s2" x="0" y="0" width="50" height="50" viewBox="0 0 100 86.2">
        <use xlink:href="#shape"/>
    </svg>
    <figcaption>...and this is one with curviness set to 
    <span class="custom-dropdown">
      <select id="single">
        <option value='1'>1</option>
        <option value='2' selected="selected">2</option>
        <option value='3'>3</option>
        <option value='4'>4</option>
        <option value='5'>5</option>
        <option value='6'>6</option>
        <option value='7'>7</option>
        <option value='8'>8</option>
      </select>
    </span>
   </figcation>
  </div><!--right-->
</div><!--container-->
              
            
!

CSS

              
                $blue: #253c42;
$blue-lt: lighten($blue, 12%);
$blue-dk: darken($blue, 4%);

html, body, .shape-contain {
  width: 100wv;
  height: 100vh;
  margin: 0;
  paddding: 0;
  background: $blue;
  font-family: 'Open Sans Condensed', sans-serif;
  color: #93A3B1;
  font-size: 25px;
  letter-spacing: 0.015em;
}

.container {
   display: -webkit-box;   /* OLD: Safari, iOS, Android browser */
  display: -moz-box;      /* OLD: Firefox (buggy) */ 
  display: -ms-flexbox;   /* MID: IE 10 */
  display: -webkit-flex;  /* NEW, Chrome 21+ */
  display: flex;          /* NEW: Opera 12.1, Firefox 22+ */ 
  margin: 0;
  padding: 0;
}

.left, .right {
  margin: 0;
  padding: 20px;
  -webkit-box-flex: 1;
  box-flex: 1 auto;
  -webkit-flex: 1 auto;
  -moz-flex: 1 auto;
  -ms-flex: 1 auto;
  flex: 1 auto;
  float: left;
  height: 100vh;
}

.shape-use {
  display: none;
}

.left {
  background: $blue-dk;
}

figcaption {
  text-align: center; 
  margin-top: 110px;
  opacity: 0.5;
}

.s1, .s2 {
  position: absolute;
  width: 50px;
  height: 50px;
  transform: translate3d(50px, 100px, 0);
}

/* Custom dropdown */
.custom-dropdown {
  font-size: 18px;
  position: relative;
  display: inline-block;
  vertical-align: middle;
  margin: 5px; 
}

.custom-dropdown select {
  background-color: $blue-lt;
  color: #fff;
  font-size: inherit;
  padding: .5em;
  padding-right: 2.2em;	
  border: 0;
  margin: 0;
  border-radius: 3px;
  text-indent: 0.01px;
  text-overflow: '';
  outline: none;
  -webkit-appearance: button; /* hide default arrow in chrome OSX */
}

.custom-dropdown::before,
.custom-dropdown::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.custom-dropdown::after { /*  Custom dropdown arrow */
  content: "\25BC";
  height: 1em;
  font-size: .625em;
  line-height: 1;
  right: 0.75em;
  top: 50%;
  margin-top: -.4em;
}

.custom-dropdown::before { /*  Custom dropdown arrow cover */
  width: 1.65em;
  right: 0;
  top: 0;
  bottom: 0;
  border-radius: 0 4px 4px 0;
}

.custom-dropdown::before {
  background-color: rgba(0,0,0,.15);
}

.custom-dropdown::after {
  color: rgba(0,0,0,.4);
}

              
            
!

JS

              
                $(document).ready(function() {
  var tl = new TimelineMax(),
      //cache the bezier path coordinates as a variable to reuse for both animations
      bezier = [{
    x: 50,
    y: 100
  }, {
    x: 30,
    y: 150
  }, {
    x: 200,
    y: 200
  }, {
    x: 350,
    y: 60
  }, {
    x: 50,
    y: 100
  }];

  //the function for the "control" animation that doesn't change and has no curviness
  function stableTL() {
    tl.to($('.s1'), 1.75, {
      rotation: 360,
      bezier: {
        type: 'thru',
        values: bezier,
        curviness: 0
      },
      ease: Power1.easeInOut
    });
  }
  stableTL();

  //the function for the animation that accepts values for curviness from the dropdown
  function displayVals() {
    //get the value from the dropdown
    var singleValues = $("#single").val();
    //the timeline for the changing animation
    tl.to($('.s2'), 1.75, {
      rotation: 360,
      bezier: {
        type: 'thru',
        values: bezier,
        curviness: singleValues
      },
      ease: Power1.easeInOut
    });
  }
  displayVals();

  //replay it when the select is changed
  $(document).on('change', 'select', function() {
    stableTL();
    displayVals();
  });

});
              
            
!
999px

Console