George Hess

  • Archive
  • RSS
  • Contact

CSS Keyframe Animation Flicker

Just for the record (since I couldn’t find any help on this issue), if you are animating a translateX, translateY, translate3d, or opacity CSS attribute by way of a webkit keyframe animation you may notice a flicker at the end of its iteration. It is very noticeable on Android 2. The flicker is caused by the animation resetting to the beginning keframe for just a split second. This happens even if you have styled the animated CSS class to stay where it is and inherit the last keyframe’s styles upon completing the animation. The only solution I could come up with is to use more than 2 keyframes. Don’t ask me why, but it just works. For example, if the following code flickers:

@-webkit-keyframes 'slide-in' {
from { -webkit-transform: translateX(100%); }
to { -webkit-transform: translateX(0); }
}

changing it to the following will fix the problem

@-webkit-keyframes 'slide-in' {
from { -webkit-transform: translateX(100%); }
99% { -webkit-transform: translateX(0); }
to {}
}

It would probably be better to use “from”, “50%”, and “to” keyframes and assign them all a value. But if your transitions are easing in and/or out - a 50% value can make it look jerky.

I hope this post found you in time before you wasted hours like I did.

    • #web dev
  • 1 year ago
  • Permalink
  • Share
    Tweet
← Previous • Next →

Portrait/Logo

About

I'm a writer of sorts and designer of websites with a specialty in mobile and front end development …more

Me, Elsewhere

  • @georgehess on Twitter
  • Facebook Profile
  • georgehess on Vimeo
  • georgehess on Flickr
  • Google
  • My Skype Info
  • Linkedin Profile
  • georgehess on github

Twitter

loading tweets…

Following

  • RSS
  • Random
  • Archive
  • Contact
  • Mobile

© George Hess …but does anybody even care?. Effector Theme by Carlo Franco.

Powered by Tumblr