CSSのみで背景画像を無限スクロールするアニメーション【Scrapboxカスタマイズ】

wp_tmb_web

背景画像を無限スクロールするアニメーション

See the Pen Pure css infinite background animation by kootoopas (@kootoopas) on CodePen.

これがScrapboxで実現できます。

CSSのみでページの背景が動く メリット・デメリット

メリット

・HTML不要、CSSのみ
・見た目がスタイリッシュ

デメリット

・読み込みがやや遅くなる
・若干ページが重くなる

方法

  1. Scrapbox → https://scrapbox.io/〇〇/settingsページにいきます。
  2. 以下のCSSをcode:style.cssの中にコピペします。
Scrapbox → https://scrapbox.io/〇〇/settingsページにいきます。以下のCSSをcode:style.cssの中にコピペします。

・背景画像が動くだけCSSのみ

@-webkit-keyframes bg-scrolling-reverse {
    100% {
        background-position: 50px 50px
    }
}

@-moz-keyframes bg-scrolling-reverse {
    100% {
        background-position: 50px 50px
    }
}

@-o-keyframes bg-scrolling-reverse {
    100% {
        background-position: 50px 50px
    }
}

@keyframes bg-scrolling-reverse {
    100% {
        background-position: 50px 50px
    }
}

@-webkit-keyframes bg-scrolling {
    0% {
        background-position: 150px 150px
    }
}

@-moz-keyframes bg-scrolling {
    0% {
        background-position: 50px 50px
    }
}

@-o-keyframes bg-scrolling {
    0% {
        background-position: 50px 50px
    }
}

@keyframes bg-scrolling {
    0% {
        background-position: 100px 100px
    }
}

body {
    color: #fff;
    font: 400 16px/1.5 exo, ubuntu, "segoe ui", helvetica, arial, sans-serif;
    background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAIAAACRXR/mAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAABnSURBVHja7M5RDYAwDEXRDgmvEocnlrQS2SwUFST9uEfBGWs9c97nbGtDcquqiKhOImLs/UpuzVzWEi1atGjRokWLFi1atGjRokWLFi1atGjRokWLFi1af7Ukz8xWp8z8AAAA//8DAJ4LoEAAlL1nAAAAAElFTkSuQmCC) repeat 0 0;
    -webkit-animation: bg-scrolling-reverse 2s infinite;
    -o-animation-timing-function: linear;
    animation-timing-function: linear
}

-moz-animation:bg-scrolling-reverse 2s infinite;
-o-animation:bg-scrolling-reverse 2s infinite;
animation:bg-scrolling-reverse 2s infinite;
-webkit-animation-timing-function:linear;
-moz-animation-timing-function:linear;
  1. ブラウザを再読みこみします。すると、Scrapboxのページの背景が動きます。

DEMO ページ

https://scrapbox.io/koshishirai/settings

koshishirai / 3D Modeler

Leave a Comment