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

              
                <head>
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
  <!--==============レイアウトを制御する独自のCSSを読み込み===============-->
  <link href="https://assets.codepen.io/6329135/reset04.css" rel="stylesheet">
</head>

<body>
  <!--SVG-->
  <div class="svganimeblock">

    <!-- SVGタグを差し替える-->
    <svg id="logo" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="2rem" height="auto" viewBox="0 0 546 44.4" style="overflow:visible;enable-background:new 0 0 546 44.4;" xml:space="preserve">
      <defs>
      </defs>
      <g>
        <path d="M15.1,8H2.9c-0.5,0-1-0.1-1.4-0.4C0.5,7,0,6,0,4.5c0-1.2,0.4-2.2,1.1-2.9C1.6,1.2,2.2,1,2.9,1h32.4c0.6,0,1.1,0.2,1.6,0.5
		c0.9,0.7,1.3,1.7,1.3,3c0,1.3-0.4,2.3-1.2,2.9c-0.5,0.4-1,0.6-1.7,0.6H23.1v32.7c0,1-0.3,1.7-1,2.3c-0.8,0.7-1.8,1-3,1
		c-1.7,0-2.9-0.5-3.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,5.2c3.8,0,6.8-1.6,8.9-4.8c1.9-2.8,2.8-6.3,2.8-10.5c0-4.9-1.2-8.7-3.5-11.5C488.3,7.9,485.5,6.6,482.2,6.6z" />
        <path d="M538.9,31.7l-0.5-28.3c0-0.8,0.3-1.5,0.8-2c0.8-0.7,1.7-1,3-1c1.4,0,2.4,0.4,3.2,1.3c0.4,0.5,0.7,1.1,0.7,1.8v35.3
		c0,1.5-0.4,2.8-1.2,3.7c-0.8,1-2,1.6-3.5,1.6c-2.3,0-4.2-1.2-5.5-3.5L517.9,9.6l0.5,31.3c0,0.9-0.3,1.6-0.9,2.2
		c-0.8,0.7-1.7,1-2.9,1c-1.5,0-2.6-0.5-3.3-1.5c-0.3-0.5-0.5-1-0.5-1.6V6c0-2.2,1-3.9,3-5c0.9-0.5,2-0.7,3.1-0.7
		c2.7,0,4.8,1.3,6.3,3.9L538.9,31.7z" />
      </g>
    </svg>

    <!-- /SVGタグを差し替えここまで-->
    <p>※使用したライブラリ<a href="https://maxwellito.github.io/vivus/" target="_blank">https://maxwellito.github.io/vivus/</a></p>
    <!--/svganimeblock-->
  </div>

  <script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/vivus/0.4.4/vivus.min.js"></script>

</body>
              
            
!

CSS

              
                @charset "utf-8";

/*========= レイアウトのためのCSS ===============*/

a {
  color: #333;
}

.svganimeblock {
  margin: 100px auto;
  text-align: center;
}

p {
  margin: 20px 0 0 0;
}

/*=============== SVGアニメーション内の指定 =================*/

/*SVGの横幅*/
.svganimeblock {
  max-width: 1080px;
  width: 100%;
  padding: 30px;
}

/*SVGの可変*/
.svganimeblock svg {
  width: 100%;
}

/*アニメーション前のパスの指定*/
.svganimeblock svg path {
  fill-opacity: 0; /*最初は透過0で見えない状態*/
  transition: fill-opacity 0.5s; /*カラーがつく際のアニメーション0.5秒で変化*/
  fill: none; /*塗りがない状態*/
  stroke: pink; /*線の色*/
}

/*アニメーション後に.doneというクラス名が付与された時のパスの指定*/
.svganimeblock svg.done path {
  fill: red; /*塗りの色*/
  fill-opacity: 1; /*透過1で見える状態*/
  stroke: none; /*線の色なし*/
}

              
            
!

JS

              
                //SVGの初期設定

var logoVivus1; //SVG設定

//SVG初期設定
function VivusInit() {
  logoVivus1 = new Vivus(
    "logo",
    {
      start: "autostart", //アニメーションの自動再生
      duration: 100, //アニメーションの時間。数字が小さくなれば速くなり、大きくなれば遅くなる
      type: "scenario", // アニメーションのタイプを設定
      pathTimingFunction: Vivus.EASE //動きの加速減速設定
    },
    function (obj) {
      $("#logo").attr("class", "done"); //描画が終わったらdoneというクラスを追加
    }
  );
  logoVivus1.stop();
}

//スクロールをしたらSVGが出現する設定
function VivusAnime() {
  //スクロールをしたら id="logo"が出現する設定
  var elemPos = $("#logo").offset().top - 50; //要素より、50px上の位置まで来たら出現
  var scroll = $(window).scrollTop();
  var windowHeight = $(window).height();
  if (scroll >= elemPos - windowHeight) {
    logoVivus1.play(1); //描画される速さ。数が大きくなるほど速い
  }
}

// 画面をスクロールをしたら動かしたい場合の記述
$(window).scroll(function () {
  VivusAnime(); /* SVGアニメーション用の関数を呼ぶ*/
});
// ここまで画面をスクロールをしたら動かしたい場合の記述

// 画面が読み込まれたらすぐに動かしたい場合の記述
$(window).on("load", function () {
  VivusInit(); //SVG初期設定
  VivusAnime(); /* SVGアニメーション用の関数を呼ぶ*/
});
// ここまで画面が読み込まれたらすぐに動かしたい場合の記述

              
            
!
999px

Console