<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <style> #react { position: relative; width: 100px; height: 100px; background-color: red; opacity: 1; transform: translateZ(0) } </style></head><body> <div id="react"></div> <script type="text/javascript"> setTimeout(() => { document.getElementById("react").style.opacity = "0" }, 2000); </script></body></html>
已经用translteZ提升为合成层,改变opacity仍然出触发paint这是为什么,和认知好像有点不符
HUH函数