iOS CSS animation flicker ngAnimate
Hey guys!
Has anybody experienced flicker effect like this?

Without ngAnimate there is no flicker but I lose other needed animations using ng-enter and ng-leave. So I need to stay with ngAnimate but get rid of the flicker.
This is only iOS issue, on Desktop browsers everything works fine.
Initial state of popup:
.fade-scale {
-webkit-transition: all .2s ease-in-out;
-webkit-transform:scale(0.8);
opacity:0;
}
On tap it adds this class on popup
.show {
-webkit-transform:scale(1);
opacity:1;
}
Can you provide a minimal example for this?
@petalvlad can you provide the whole css for that, including ng-enter, ng-leave, etc...
I have a similar issue that I'm trying to reproduce, but right now I have no success.
You might want to try something like this:
&.ng-enter {
visibility: hidden;
animation-name: fadeAndSlideFromTop;
animation-play-state: paused;
&.ng-enter-active {
visibility: visible;
animation-play-state: running;
}
}
from AngularMotion, if I remember correctly I added the animation-play-state stuff to fix latest safari and visibility to fix iOS flickering.
From the main ngAnimate docs:
"Keep in mind that, by default, if an animation is running, any child elements cannot be animated until the parent element's animation has completed. This blocking feature can be overridden by placing the ng-animate-children attribute on a parent container tag."
Noticing this flicker with a fade-out animation and ng-if. At the end of the animation the element briefly reappears before being removed from the DOM
As I understand the logic the problem may be that all animation classes are removed from the element after the animation is completed but before it is removed from the DOM. This removal probably happens quickly enough not to matter in many situations but on iOS it appears that it doesn't. I'd suspect a similar problem exists with entering.
Hi, i am experiencing the same problem on my ipad with iOS 8, on chrome and safari. chrisnicola, you are right. the documentation says that the element is inserted, then ngAnimate wait a digest and then it scan the element to see if there is an animation to play on it. And the ng-enter class is added. So there is a lot of operation between the moment where element is added to the DOM and the moment where the ng-enter class is added. So I think like you that on iOS things are slower and the browser have the time to render the element before the animation starts.
It is a very annoying issue
@mgcrea Thank you so much! This flickering bug still exists and your code exactly solved the bug for iOS and Safari.
@mgcrea 's solution helped some of my animations complete correctly, but did not ultimately resolve all my iOS flickering issues.
@mgcrea - Thanks! This solved my problem with Safari flicker when using a slide in animation for a modal.
@chrisnicola +1
I'm experiencing the same thing. The animation itself works exactly as it should, but when it'sa ll over, the element reappears for half a second or so.
@chrisnicola From my own quick results, it seems that @mgcrea's solution works. This is what I have right now:
&.ng-animate {
&.ng-leave,
&.ng-enter {
@include animation-play-state(paused !important);
}
&.ng-enter {
visibility: hidden;
}
&.ng-leave-active,
&.ng-enter-active {
visibility: visible;
@include animation-play-state(running !important);
}
}
This seems to fix the ghosting / flicker problem on Mobile Safari for me. Will get back to you if this changes.
If anyone is still experiencing this, please provide a running demo (plnkr.co) etc. and the iOs Safari versions etc. in which this happens, so we can test it.