Chuyển đến nội dung
Skillpedia
Website và giao diện (frontend)75k · #2722

animation-performance

Skill này làm gì

Skill này kiểm tra hoạt ảnh CSS xem có thuộc tính nào làm chậm việc render hay không. Nó dành cho lập trình viên muốn chuyển động mượt trên trang web.

Khi nào nên dùng

  • ✓Khi một hoạt ảnh CSS bị giật hoặc khựng trên trang.
  • ✓Khi một stylesheet làm hoạt ảnh kích thước, vị trí hoặc margin.
  • ✓Khi bạn muốn hoạt ảnh tôn trọng cài đặt giảm chuyển động.

Liên kết skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/animation-performance/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/animation-performance/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Hoạt ảnh trượt vào của menu tôi bị khựng trên điện thoại. Bạn kiểm tra CSS và làm nó mượt hơn được không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent tìm các hoạt ảnh thay đổi thuộc tính bố cục, chuyển chúng sang thay đổi transform và opacity, và gợi ý tôn trọng cài đặt giảm chuyển động.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Use transform and opacity for animations

Animating layout properties (width, height, top, margin) triggers the full browser rendering pipeline on every frame — style recalculation, layout, paint, and composite. This runs on the main thread and competes with JavaScript. Animating transform and opacity skips layout and paint entirely and runs on a dedicated GPU thread, achieving smooth 60fps even when the main thread is busy.

Quick Reference

  • Only transform and opacity can be composited on the GPU without triggering layout
  • Use will-change: transform sparingly to promote an element to its own compositor layer
  • Prefer CSS transitions and animations over JavaScript animation libraries for simple effects
  • Respect prefers-reduced-motion to disable animations for users who need it

Check

Find CSS animations or transitions in this file that animate layout-triggering properties like top, left, width, height, or margin. Flag them for optimization.

Fix

Convert layout-triggering animations to use transform equivalents: position changes to translate(), size changes to scale().

Explain

Explain the browser rendering pipeline, why transform and opacity are performant for animation, and how the GPU compositor works.

Code Review

Review stylesheets, component styles, and responsive states related to Use transform and opacity for animations. Flag exact selectors, declarations, or breakpoints that violate the rule in the rendered UI.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/css/animation-performance

Câu hỏi thường gặp

Vì sao transform và opacity mượt hơn?

Skill nói chúng có thể được bộ xử lý đồ họa xử lý mà không kích hoạt tính toán bố cục và vẽ lại ở mỗi khung hình.

will-change làm gì?

Skill nói nên dùng nó tiết kiệm, để cấp cho phần tử một lớp render riêng.

Có nên dùng thư viện cho hiệu ứng đơn giản không?

Skill khuyến nghị dùng CSS transition và animation cho hiệu ứng đơn giản thay vì thư viện hoạt ảnh JavaScript.

Chi tiết

Mô tả gốc của tác giả

Use when reviewing stylesheets, component styles, and responsive behavior related to Use transform and opacity for animations. Check the rendered layout across breakpoints and interaction states before proposing a fix.

repo: thedaviddias/Front-End-Checklist

Độ phổ biến

Sao GitHub
75k
Vị trí xếp hạng
#2722
Giấy phép
MIT
Cập nhật
31/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự