Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent flicker on webkit-transition of webkit-transform [duplicate]

People also ask

What does WebKit transition do?

The -webkit-transition Boolean CSS media feature is a Chrome extension whose value is true if the browsing context supports CSS transitions. It was never supported in browsers not based on WebKit or Blink. Apple has a description in Safari CSS Reference; this is now called transition there.

What is WebKit transition duration?

The transition-duration CSS property sets the length of time a transition animation should take to complete. By default, the value is 0s , meaning that no animation will occur.


The solution is mentioned here: iPhone WebKit CSS animations cause flicker.

For your element, you need to set

-webkit-backface-visibility: hidden;

The rule:

-webkit-backface-visibility: hidden;

will not work for sprites or image backgrounds.

body {-webkit-transform:translate3d(0,0,0);}

screws up backgrounds that are tiled.

I prefer to make a class called no-flick and do this:

.no-flick{-webkit-transform:translate3d(0,0,0);}

Add this css property to the element being flickered:

-webkit-transform-style: preserve-3d;

(And a big thanks to Nathan Hoad: http://nathanhoad.net/how-to-stop-css-animation-flicker-in-webkit)


For a more detailed explanation, check out this post:

http://www.viget.com/inspire/webkit-transform-kill-the-flash/

I would definitely avoid applying it to the entire body. The key is to make sure whatever specific element you plan on transforming in the future starts out rendered in 3d so the browsers doesn't have to switch in and out of rendering modes. Adding

-webkit-transform: translateZ(0) 

(or either of the options already mentioned) to the animated element will accomplish this.


I had to use:

-webkit-perspective: 1000;
-webkit-backface-visibility: hidden;    

on the element, or I would still get a flickr the first time a transition occurred after page load