Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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>

  <div class="wrapper">
    <p>画面が読み込まれるとpng画像がループして動く</p>
    <div class="steps"></div>
  </div>
  <!--/wrapper-->
</body>
              
            
!

CSS

              
                @charset "utf-8";

/*========= レイアウトのためのCSS ===============*/
.wrapper {
  text-align: center;
  padding: 0 0 100px 0;
}

p {
  text-align: center;
  padding: 20px 0;
  font-size: clamp(1rem, 2vw, 1.5rem);
  color: #333;
  white-space: nowrap;
  font-weight: bold;
}

.steps {
  margin: 0 auto;
}

/*=============== 画面が読み込まれるとpng画像がループして動く =================*/

.steps {
  width: 100px; /*1フレーム分の横幅*/
  height: 100px; /*1フレーム分の縦幅*/
  background: url("https://assets.codepen.io/6329135/steps.png") no-repeat; /*背景画像の読み込み*/
  animation: stepsline 1s steps(5) infinite;
  /*stepsline→アニメーション名
    1s→アニメーションをする時間
    step→()の中には、1フレーム分最後に余白を持たせてループをさせたいので、アニメーション制作コマ数+1の値を入れる(例:4コマ+1コマ=5コマ)
    infinite→無限ループ*/
}

@keyframes stepsline {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: -500px 0; /*1フレーム分最後に余白を持たせてループをさせたいので、アニメーション制作コマ数から1コマ分足した横幅(今回は1フレーム100pxで制作しているので全体の400px+100px=500px⇒-500px)を指定。*/
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console