4 ms·
Even if everything were GPU based, this would still be a good suggestion no? The biggest reason I see to use "transform: translateX(n)" over "left: n" is the tr
by jjcm 10y ago
Even if everything were GPU based, this would still be a good suggestion no? The biggest reason I see to use "transform: translateX(n)" over "left: n" is the transform doesn't make a call to reflow the content around it (unless that's what you're going for). Even with GPU acceleration, transform will still be more performant than standard positioning/sizing.
I've always followed this rule: Use transform unless you need reflows, then use top/left/height/width.
- sanxiyn 10y agoThe thing is, reflow is not why using left is slow. If the element is position: absolute, you don't reflow the whole page anyway. CSS transform is used because render is slow. With Servo-like GPU acceleration, render is not slow. Your suggestion would not be a good suggestion because using transform would be an unnecessary premature optimization then.
- amelius 10y agoBut why should reflow make animations less smooth in the first place? Shouldn't reflow be designed such that it doesn't affect animations?