2 ms·
I don't see it. If I create something like this: .wide { transition: width 2s; width: 300px; } but don't apply it to any element, th
by IgorPartola 12y ago
I don't see it. If I create something like this:
.wide {
transition: width 2s;
width: 300px;
}
but don't apply it to any element, then load a remote JavaScript file that adds that class dynamically, no rendering engine will be able to apply this optimization.
- Pxtl 12y agoI was thinking of animations that are applied declaratively in the HTML/CSS itself, not javascript - things like hover.
- IgorPartola 12y agoThe animations that are applied dynamically are the interesting thing. They are the ones more likely to end up being used in performance-critical applications.
- dmmalam 12y agoThis would be caught be live profiling. The same way a JS engine can figure out that a particular function is only called with ints, and then create a specialised version. Admittedly this would run slow the first few times, until the renderer can get enough data.
- IgorPartola 12y agoRunning slowly the first few times is what will-change is trying to avoid. If you read the article, there is an explicit section on applying will-change separately from the actual transformation so that the rendering engine prepares to animate/transform the object ahead of time.