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

              
                <div class="svg-container"><svg version="1.1" id="Layer_1"
	 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	 viewBox="0 0 1280 900" enable-background="new 0 0 1280 900" xml:space="preserve">

<path class="line" id="js-path" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="2900" stroke-dashoffset="2900" d="
	M113.388,508.086c44.937-33.438,84.122-76.28,110.205-126.062c6.46-12.331,11.415-25.392,15.822-38.576
	c5.578-16.688,10.2-34.019,11.505-51.619c0.941-12.708-0.064-28.511-11.478-36.512c-2.518-1.765-5.155-3.097-8.055-1.783
	c-4.08,1.849-7.568,5.309-10.191,8.864c-6.11,8.28-9.368,18.325-11.591,28.268c-10.652,47.637,5.777,95.569,40.166,129.542
	c26.316,25.999,66.003,45.577,103.754,40.112c42.812-6.197,64.181-56.721,50.788-95.271c-0.951-2.744-4.646-2.142-4.909,0.665
	c-1.518,16.194,8.636,33.79,17.532,46.494c8.889,12.689,22.665,27.959,39.482,28.095c20.534,0.166,27.895-27.399,21.151-43.104
	c-7.828-18.229-29.497-26.733-48.025-28.333c-17.932-1.549-42.342,1.066-52.643,17.897c-9.077,14.83,10.376,21.708,21.471,23.597
	c21.08,3.583,42.88-0.853,63.031-7.042c27.688-8.511,53.686-21.795,79.653-34.416c17.289-8.402,50.703-29.605,49.081-29.988
	c-9.972-2.355-37.143,30.445-19.515,40.07c22.012,12.02,37.05-20.559,28.035-37.476c-1.05-1.971-3.976-1.396-4.569,0.6
	c-4.134,13.828,9.423,28.862,20.25,35.607c12.595,7.848,25.188-0.093,34.915-8.536c12.479-10.828,25.571-23.398,37.619-34.678
	c8.562-8.019,31.125-29.963,28.459-29.167c-14.463,4.324-33.544,21.057-41.709,33.125c-6.521,9.641-12.107,26.077,3.74,29.509
	c16.906,3.661,26.404-20.354,30.344-32.669c7.35-22.995-4.083-45.896-16.368-65.052c-0.579-0.895-1.163-1.785-1.755-2.671
	c-1.235-1.867-4.977-1.406-4.658,1.262c2.904,24.355,10.514,48.04,21.428,69.966c8.84,17.75,20.891,34.906,36.367,47.498
	c12.928,10.517,32.98,16.899,44.9,1.108c11.296-14.966,7.062-50.542,8.165-50.13c1.931,0.72,6.382,6.938,8.669,10.386
	c3.955,5.966,7.585,12.148,11.312,18.258c3.791,6.214,7.636,12.408,11.901,18.312c3.113,4.304,6.542,8.85,11.12,11.688
	c20.521,12.732,16.941-53.096,19.364-60.049c0.472-1.354,20.641,21.548,32.025,32.517c5.861,5.646,33.295,31.9,38.973,47.021
	c0.586,1.559-9.788-24.599-13.891-36.992c-2.198-6.65-3.584-14.081-1.518-20.935c2.61-8.663,11.889-11.908,20.153-11.117
	c8.566,0.82,14.957,8.202,20.151,14.349c7.146,8.452,13.246,17.979,21.996,24.924c6.353,5.042,15.386,8.22,22.629,3.232
	c7.021-4.833,13.812-13.096,18.32-19.999c9.061-13.868,19.108-28.142,34.98-32.002c2.701-0.657,2.841-0.252,0,0
	c-9.353,0.83-18.729,6.188-26.334,11.35c-6.536,4.438-16.146,12.015-14.043,21.085c1.002,4.321,5.358,6.792,9.005,8.562
	c6.271,3.045,13.42,2.924,19.845,0.486c12.513-4.75,16.679-31.585,17.616-30.671c2.212,2.156,14.721,57.131,17.916,86.509
	c2.361,21.712,1.032,47.839-16.466,63.264c-12.646,11.151-30.812,14.684-47.095,16.027c-19.184,1.584-38.629-0.058-57.648-2.647"/>
<g id="js-pen">
	<polygon fill="#FFFFFF" points="-2.097,11.15 -2.097,62.15 7.018,57.65 11.76,44.65 11.76,29.9 4.832,14.4 	"/>
	<g>
		<path fill="#3F2D40" d="M-4.284,0.056C-2.204,0.036-0.106,0.02,1.992,0c1.549,10.747,9.261,18.799,13.525,28.395
			c3.643,8.217,1.023,18.051-5.396,24.097c0.016,1.846,0.05,3.711,0.122,5.576c4.831,2.755,8.64,7.688,6.989,13.567
			c-2.724,14.317-0.118,28.784,0.889,43.141c2.115,23.832-0.701,47.707-2.55,71.469c-1.028,47.536-2.107,95.124-4.048,142.665
			c-0.216,3.947-0.378,7.895-0.467,11.877c-0.382,15.518-1.247,30.999-1.646,46.516c-4.734,0.041-9.45,0.084-14.167,0.127
			c-3.172-59.746-6.827-119.468-8.852-179.259c0.267-22.24-4.055-44.169-4.863-66.346c-1.44-18.549,1.425-37.029,1.744-55.539
			c0.3-6.692-2.18-13.18-1.631-19.856c0.54-3.825,4.145-5.918,6.85-8.149c0.02-1.862,0.021-3.729,0.04-5.576
			c-6.582-5.985-9.341-15.86-5.794-24.195C-13.171,18.913-5.605,10.776-4.284,0.056z M-11.193,39.499
			c0.645,3.994,3.967,6.547,6.788,9.088c0.077,2.653,0.156,5.305,0.233,7.977c0.879-0.008,2.601-0.041,3.478-0.066
			c0.897,0.011,2.691,0.011,3.588,0.003c0.012-2.688,0.023-5.362,0.071-8.016c2.455-2.301,5.448-4.462,6.296-7.913
			c2.588-7.465-3.05-14.048-6.512-20.114c-0.072,3.925-0.072,7.854-0.037,11.799c-0.933,0.01-2.76,0.06-3.676,0.087
			c-0.86-0.012-2.599-0.03-3.461-0.021c-0.052-3.893-0.123-7.783-0.211-11.674C-7.85,26.396-12.961,32.468-11.193,39.499z
			 M-10.931,66.83c-0.224,7.104,1.667,14.1,1.41,21.22c-0.285,16.179-2.778,32.269-2.005,48.494
			c0.723,24.524,5.44,48.766,5.176,73.355c0.968,19.88,0.842,39.878,3.171,59.674c0.901,36.413,3.091,72.816,5.373,109.167
			c2.284-41.337,3.239-82.754,4.267-124.156c0.275-7.48,0.924-14.983,0.284-22.456c1.37-9.178,1.001-18.463,1.097-27.7
			c-0.285-21.681,3.342-43.179,3.759-64.849c0.915-17.921-2.4-35.663-2.83-53.54C8.499,79.603,10.378,73.22,9.71,66.807
			c-1.677-1.117-3.39-2.123-5.156-3.021c-2.887-0.047-5.757-0.127-8.629-0.244C-6.414,64.564-8.754,65.519-10.931,66.83z"/>
		<path fill="#796D7A" d="M-10.931,66.83c2.176-1.312,4.517-2.266,6.855-3.289c1.213,45.163,0.937,90.377,1.557,135.546
			c-0.077,23.493,1.354,47.028-0.66,70.486c-2.329-19.796-2.203-39.794-3.171-59.674c0.264-24.59-4.454-48.831-5.176-73.355
			c-0.773-16.226,1.72-32.315,2.005-48.494C-9.264,80.93-11.155,73.934-10.931,66.83z"/>
		<path fill="#796D7A" d="M4.554,63.785c1.766,0.898,3.479,1.904,5.156,3.021c0.668,6.413-1.211,12.796-0.939,19.232
			c0.43,17.877,3.745,35.619,2.83,53.54c-0.417,21.67-4.043,43.168-3.759,64.849c-0.096,9.237,0.273,18.522-1.097,27.7
			c-1.081-8.617-1.428-17.276-1.218-25.958C5.208,158.719,3.85,111.243,4.554,63.785z"/>
		<path fill="#D9D6DA" d="M-11.193,39.499c-1.768-7.031,3.344-13.104,6.556-18.851c0.088,3.891,0.16,7.781,0.211,11.674
			c0.862-0.01,2.601,0.009,3.461,0.021c0.145,8.051,0.235,16.103,0.27,24.154c-0.877,0.025-2.599,0.059-3.478,0.066
			c-0.077-2.672-0.156-5.323-0.233-7.977C-7.226,46.046-10.549,43.493-11.193,39.499z"/>
		<path fill="#948994" d="M-4.075,63.541c2.872,0.117,5.742,0.197,8.629,0.244C3.85,111.243,5.208,158.719,5.526,206.17
			c-0.21,8.682,0.138,17.341,1.218,25.958c0.641,7.473-0.009,14.976-0.284,22.456c-1.027,41.401-1.982,82.818-4.267,124.156
			c-2.281-36.35-4.472-72.753-5.373-109.167c2.014-23.458,0.583-46.993,0.66-70.486C-3.139,153.918-2.862,108.704-4.075,63.541z"/>
	</g>
</g>
<path class="line" id="js-dot" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="112" stroke-dashoffset="112" d="
	M781.833,305.834c0,0,13.098-5.758,16.367-3.302c3.43,2.576,2.246,9.616-0.881,11.772c-5.18,3.571-21.844,1.056-21.63-6.78
	c0.133-4.903,6.916-10.157,9.923-7.066c2.545,2.616,0.284,7.447,0.15,11.132c-9.715,2.688-11.521-18.773-11.264-24.424"/>
</svg>

      </div>

<div class="sol0mka-learn-more"><style>.sol0mka-learn-more{position: fixed;top: 0;right: 10px;position: fixed;}.sol0mka-learn-more__link{width: 80px;padding-bottom: 120%;background: #3478bd url('http://blog.legomushroom.com/learn-more.png') no-repeat center center;background-size: 70% auto;display: block;border-bottom-left-radius: 3px;border-bottom-right-radius: 3px;}.sol0mka-learn-more__link:hover{background-color: #387fc7;}@media all and (max-width:1440px){.sol0mka-learn-more__link{width: 60px;}}@media all and (max-width:1280px){.sol0mka-learn-more__link{width: 50px;}@media all and (max-width:505px){.sol0mka-learn-more__link{display: none;}}@media only screen and (-webkit-min-device-pixel-ratio: 2), (min-resolution: 144dpi){.sol0mka-learn-more__link{background: #3478bd url('http://blog.legomushroom.com/learn-more@2x.png') no-repeat center center;background-size: 53px 75px;background-size: 70% auto;}}</style><a href="http://blog.legomushroom.com/2014/03/defining-advanced-animation-path/" title="learn more" class="sol0mka-learn-more__link"></a></div>
              
            
!

CSS

              
                .svg-container{
  padding-bottom:70.3125%;
  position:relative
}

.svg-container svg{
  width:100%;
  height:100%;
  position:absolute;
  top:0;
  left:0;
  overflow:hidden
}

.line{
  stroke:#2c202d;
  stroke-width:5px
}


/* Pen for http://blog.legomushroom.com/2014/03/defining-advanced-animation-path/ */

              
            
!

JS

              
                (function() {
  var Main;

  Main = (function() {
    function Main() {
      this.vars();
      this.launchAnimation();
      this.animate();
    }

    Main.prototype.vars = function() {
      this.path = document.getElementById('js-path');
      this.pen = document.getElementById('js-pen');
      this.dotPath = document.getElementById('js-dot');
      this.pathLength = this.path.getTotalLength();
      this.dotLength = this.dotPath.getTotalLength();
      this.dashOffset = parseInt(this.path.getAttribute('stroke-dashoffset'), 10);
      this.dotOffset = parseInt(this.dotPath.getAttribute('stroke-dashoffset'), 10);
      return this.animate = this.bind(this.animate, this);
    };

    Main.prototype.launchAnimation = function() {
      this.writeLoading();
      return this.interval = setInterval((function(_this) {
        return function() {
          return _this.writeLoading();
        };
      })(this), 11000);
    };

    Main.prototype.writeLoading = function() {
      var duration, it, repeat;
      this.dotPath.setAttribute('stroke-dashoffset', this.dotLength);
      this.path.setAttribute('stroke-dashoffset', this.pathLength);
      it = this;
      duration = 6000;
      repeat = 9999999;
      this.tween = new TWEEN.Tween({
        length: 0,
        offset: this.dashOffset,
        proc: 1
      }).to({
        length: this.pathLength,
        offset: 0,
        proc: 8
      }, duration).easing(TWEEN.Easing.Sinusoidal.InOut).onUpdate(function() {
        var angle, attr, point;
        point = it.path.getPointAtLength(this.length);
        angle = Math.abs(Math.sin(this.proc) * 20);
        angle = -angle;
        attr = "translate(" + point.x + "," + point.y + ") rotate(" + angle + ")";
        it.pen.setAttribute('transform', attr);
        return it.path.setAttribute('stroke-dashoffset', this.offset);
      });
      duration = 400;
      this.moveDownTween = new TWEEN.Tween({
        x: 954,
        y: 510,
        angle: -20
      }).to({
        x: 900,
        y: 600,
        angle: 0
      }, duration).easing(TWEEN.Easing.Sinusoidal.Out).onUpdate(function() {
        var attr;
        attr = "translate(" + this.x + "," + this.y + ") rotate(" + this.angle + ")";
        return it.pen.setAttribute('transform', attr);
      });
      duration = 600;
      this.moveUpTween = new TWEEN.Tween({
        x: 900,
        y: 600
      }).to({
        x: 781.8336791992188,
        y: 305.8337097167969
      }, duration).easing(TWEEN.Easing.Sinusoidal.Out).onUpdate(function() {
        return it.pen.setAttribute('transform', "translate(" + this.x + "," + this.y + ")");
      });
      duration = 1000;
      this.dot = new TWEEN.Tween({
        length: 0,
        offset: this.dotOffset
      }).to({
        length: this.dotLength,
        offset: 0
      }, duration).easing(TWEEN.Easing.Sinusoidal.InOut).onUpdate(function() {
        var point;
        point = it.dotPath.getPointAtLength(this.length);
        it.pen.setAttribute('transform', "translate(" + point.x + "," + point.y + ")");
        return it.dotPath.setAttribute('stroke-dashoffset', this.offset);
      });
      duration = 800;
      this.moveAway = new TWEEN.Tween({
        x: 780,
        y: 300
      }).to({
        x: 1000,
        y: 1300
      }, duration).easing(TWEEN.Easing.Sinusoidal.Out).onUpdate(function() {
        return it.pen.setAttribute('transform', "translate(" + this.x + "," + this.y + ")");
      });
      this.dot.chain(this.moveAway);
      this.moveUpTween.chain(this.dot);
      this.moveDownTween.chain(this.moveUpTween);
      return this.tween.chain(this.moveDownTween).start();
    };

    Main.prototype.animate = function() {
      requestAnimationFrame(this.animate);
      return TWEEN.update();
    };

    Main.prototype.bind = function(func, context) {
      var bindArgs, wrapper;
      wrapper = function() {
        var args, unshiftArgs;
        args = Array.prototype.slice.call(arguments);
        unshiftArgs = bindArgs.concat(args);
        return func.apply(context, unshiftArgs);
      };
      bindArgs = Array.prototype.slice.call(arguments, 2);
      return wrapper;
    };

    return Main;

  })();

  new Main;

}).call(this);

              
            
!
999px

Console