| 916 | } |
| 917 | |
| 918 | analyzeAnimationPerformance(code) { |
| 919 | const notes = []; |
| 920 | |
| 921 | // 检查是否使用 GPU 加速 |
| 922 | if (code.includes('transform3d') || code.includes('translateZ')) { |
| 923 | notes.push('使用 3D 变换触发 GPU 加速'); |
| 924 | } |
| 925 | |
| 926 | // 检查是否有性能优化 |
| 927 | if (code.includes('will-change')) { |
| 928 | notes.push('使用 will-change 提示浏览器优化'); |
| 929 | } |
| 930 | |
| 931 | // 检查动画属性 |
| 932 | if (code.includes('left') || code.includes('top')) { |
| 933 | notes.push('警告:使用定位属性动画可能触发重排'); |
| 934 | } |
| 935 | |
| 936 | return notes.join('. '); |
| 937 | } |
| 938 | |
| 939 | getAnimationBrowserSupport(code) { |
| 940 | const support = { |