I'm trying to make use of the CSS will-change property instead of the translateZ(0) hack.
I understand that the property needs to be applied before the element changes. But my doubt is if it needs to be applied also while it is changing.
I'm interested in knowing if the property needs to be applied before and while the element is transitioning or only before.
You don't need apply
will-changewhile the corresponding CSS property is changing (or changed).The main goal of
will-changeis to help browser apply some changes that are expensive for the renderer "in advance" (e.g., create the new stacking context for the element that will change itsopacityrather than create it dynamically in the moment when opacity starts changing). If the change already occurs, there is no more need in such pre-optimisations.