what are the advantages and disadvantages of using animation and positioning displacement?
what are the advantages and disadvantages of using animation and positioning displacement?
Animation modifying the left and top of an element will change its shape and may cause other elements on the page to move and change shape, a process called layout. CSS-based animation and natively supported Web animation are usually handled on a thread called a synthesizer thread, where both transforms and opacity can be processed; unlike the browser's main thread, it executes styles, layout, drawing, and JavaScript in that main thread. This means that if the browser runs some time-consuming task on the main thread, the animation can continue to run without interruption; if any animation starts drawing, layout, or both, the main thread will do the job. This is the same for CSS-based or JavaScript-based animation, layout or drawing costs are huge, making it meaningless for the associated CSS or JavaScript to perform work or render; avoid using attribute animation that triggers layout or drawing. For most modern browsers, this means limiting animation (modified properties) to opacity and transform
so: when you modify left and top, transform:translate (x, y) and left:xpx;top:ypx are different in performance, and there may be differences in effect https://codeshelper.com/a/11...
transform has higher performance, and
left,top has better compatibility
Previous: Is there any way for h5 browser to open local app?
Next: How does js get the position of an element on the screen?
1, as shown in the picture, various immortals, help how to use css3 to draw the following wave line part, are there any relevant examples or ideas. 2, Thank you very much! ...
<html> <head> < head> <body> <video src="http: www.w3school.com.cn i movie.mp4" controls="controls" loop="loop">< video> <button style="z-index:2147483647;position:fixed;...
long pressing the press event will cause the browser to pop up the menu. Apple s can use: please enter the code-webkit-touch-callout: none; to disable it, but Android can t. The prohibition of pop-up can only be controlled with j and bold text s: win...
paste the structure code: hasVerticalScroll has a value for true,scrollerHeight, if I set overflow-y:auto; for class menu-wrapper and foods-wrapper The style is also completely fine, and the print better-scroll initialization is also fine. add: I found...