0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CSSのみで文字をキラーンとさせる方法

Posted at

CSSのみを使用して文字が光ったようなアニメーションを実装します。(IE非対応)
以下、参考にした資料。
文字グラデーション
バックグラウンドの位置変更
CSSアニメーション

この3つの記事(機能)をベースに実装しました。
ちなみにFlashかと思ったのですが、たぶん違くて正式なアニメーションの名称が分かれば教えて欲しいです!

完成イメージ

flashImage.png
※gitは後で乗せます。

コード

html
<div class="back">
  <h1>~FlashTest~</h1>
</div>
css
.back{
    background-color: gray;
    width: 100%;
    height: 100vh;
}

h1{
    width: 100%;
    font-size: 50px;
    background: -webkit-linear-gradient(-30deg, black 1%, white 5%, black 10%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-position: -200px;
    animation-name: flashText;
    animation-duration: 1.5s;
    animation-timing-function: ease;
    animation-delay: 0s;
    animation-iteration-count: 1;
    animation-direction: normal;
}

@keyframes flashText{
    0%{
        background-position: -100px;
    }
    100%{
        background-position: 300px;
    }
}

これで出来るかと。ホームページのタイトル部分とかに使えそうですね^^

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?