18
17

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アニメーション時のチラつきを解決する方法

Last updated at Posted at 2017-09-30

CSSのTransitionでアニメーションをさせた時に文字が一瞬チラつく現象に遭遇しました。
Gifだとわかりにくいですが、一瞬左右にカクカクとなっています。
chira.gif

ネットで調べると該当のセレクタに下記を追記することで、大体の場合解決するとありましたが僕の場合改善しませんでした。

.css
-webkit-backface-visibility: hidden;
backface-visibility: hidden;

結果的にwill-changeプロパティを追記することで改善されました🎉

.css
.hoge:hover > img {
    height: 300px;
    width: 300px;
    -webkit-transition: .3s ease-in-out;
    transition: .3s ease-in-out;
    will-change: transform; /* ←追記分 */
}

参考
CSS will-changeプロパティについて知っておくべきこと

18
17
1

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
18
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?