HTML

HTMLは基本この形です。特別なことはないですね。

HTML

  1. <section class="section1">
  2. <h2>SECTION 01</h2>
  3. </section>

横型ストライプ

横型のストライプはrepeating-linear-gradientを使うと簡単ですね。
アニメーションはkeyframesで設定します。
nfinite linearで無限にスクロールするようになります。

CSS

  1. @keyframes move-stripe1 {
  2. 0% { background-position-y: 0; }
  3. 100% { background-position-y: -50px; }
  4. }
  5. .section1 {
  6. background: repeating-linear-gradient(#00b1ff, #00b1ff 25px, #8be4fc 0, #8be4fc 50px);
  7. animation: move-stripe1 .8s infinite linear
  8. }

斜め型のストライプ

斜め型はサイズ感がわからなかったので画像を作成しました。

基本やってること変わらないですが、keyframesbackground-position-xにして移動方向を変えてます。

CSS

  1. @keyframes move-stripe2 {
  2. 0% { background-position-x: 0; }
  3. 100% { background-position-x: -34px; }
  4. }
  5. .section2 {
  6. background: url("img/01.png");
  7. animation: move-stripe2 1s infinite linear;
  8. }

テキストに斜め型のストライプ

background-clipなるものを使えばテキストの背景も設定できるんです。
IEは対応していないので実際使用するには分岐の処理が必要になります。

CSS

  1. @keyframes move-stripe3 {
  2. 0% { background-position-x: 0; }
  3. 100% { background-position-x: -27px; }
  4. }
  5. .section3 h2 {
  6. background: url("img/02.png");
  7. -webkit-background-clip: text;
  8. -webkit-text-fill-color: transparent;
  9. animation: move-stripe3 1.5s infinite linear;
  10. }

以上。簡単なわりにわりと効果ありそうな気がしてます。