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

fixing-motion-performance

Skill này làm gì

Công cụ này giúp sửa các hiệu ứng bị giật hoặc chạy chậm trên trang web và ứng dụng. Nó kiểm tra xem mã có tuân theo thực hành tốt nhất để đảm bảo mọi thứ chạy mượt mà hay không.

Khi nào nên dùng

  • ✓Khi hiệu ứng trên trang web bị giật.
  • ✓Khi bạn thấy các chuyển cảnh bị giật lag.
  • ✓Khi kiểm tra mã hiệu ứng để đảm bảo hiệu năng tốt.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/fixing-motion-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/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/fixing-motion-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

“Phân tích đoạn mã này và cho tôi biết có vấn đề về hiệu năng hiệu ứng không và cách sửa: [dán mã vào đây]”

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

Cách hoạt động

Công cụ phân tích mã hiệu ứng của bạn, tìm các mẫu gây chậm như hiệu ứng cần quá nhiều phép tính hoặc không dùng đúng bộ phận của máy để chạy. Sau đó, nó gợi ý các cách sửa cụ thể.

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.

fixing-motion-performance

When to Use

Use this skill when you need audit and fix animation performance issues including layout thrashing, compositor properties, scroll-linked motion, and blur effects. Use when animations stutter, transitions jank, or reviewing CSS/JS animation performance.

Fix animation performance issues.

how to use

  • /fixing-motion-performance Apply these constraints to any UI animation work in this conversation.

  • /fixing-motion-performance <file> Review the file against all rules below and report:

    • violations (quote the exact line or snippet)
    • why it matters (one short sentence)
    • a concrete fix (code-level suggestion)

Do not migrate animation libraries unless explicitly requested. Apply rules within the existing stack.

when to apply

Reference these guidelines when:

  • adding or changing UI animations (CSS, WAAPI, Motion, rAF, GSAP)
  • refactoring janky interactions or transitions
  • implementing scroll-linked motion or reveal-on-scroll
  • animating layout, filters, masks, gradients, or CSS variables
  • reviewing components that use will-change, transforms, or measurement

rendering steps glossary

  • composite: transform, opacity
  • paint: color, borders, gradients, masks, images, filters
  • layout: size, position, flow, grid, flex

rule categories by priority

priority category impact
1 never patterns critical
2 choose the mechanism critical
3 measurement high
4 scroll high
5 paint medium-high
6 layers medium
7 blur and filters medium
8 view transitions low
9 tool boundaries critical

quick reference

1. never patterns (critical)

  • do not interleave layout reads and writes in the same frame
  • do not animate layout continuously on large or meaningful surfaces
  • do not drive animation from scrollTop, scrollY, or scroll events
  • no requestAnimationFrame loops without a stop condition
  • do not mix multiple animation systems that each measure or mutate layout

2. choose the mechanism (critical)

  • default to transform and opacity for motion
  • use JS-driven animation only when interaction requires it
  • paint or layout animation is acceptable only on small, isolated surfaces
  • one-shot effects are acceptable more often than continuous motion
  • prefer downgrading technique over removing motion entirely

3. measurement (high)

  • measure once, then animate via transform or opacity
  • batch all DOM reads before writes
  • do not read layout repeatedly during an animation
  • prefer FLIP-style transitions for layout-like effects
  • prefer approaches that batch measurement and writes

4. scroll (high)

  • prefer Scroll or View Timelines for scroll-linked motion when available
  • use IntersectionObserver for visibility and pausing
  • do not poll scroll position for animation
  • pause or stop animations when off-screen
  • scroll-linked motion must not trigger continuous layout or paint on large surfaces

5. paint (medium-high)

  • paint-triggering animation is allowed only on small, isolated elements
  • do not animate paint-heavy properties on large containers
  • do not animate CSS variables for transform, opacity, or position
  • do not animate inherited CSS variables
  • scope animated CSS variables locally and avoid inheritance

6. layers (medium)

  • compositor motion requires layer promotion, never assume it
  • use will-change temporarily and surgically
  • avoid many or large promoted layers
  • validate layer behavior with tooling when performance matters

7. blur and filters (medium)

  • keep blur animation small (<=8px)
  • use blur only for short, one-time effects
  • never animate blur continuously
  • never animate blur on large surfaces
  • prefer opacity and translate before blur

8. view transitions (low)

  • use view transitions only for navigation-level changes
  • avoid view transitions for interaction-heavy UI
  • avoid view transitions when interruption or cancellation is required
  • treat size changes as potentially layout-triggering

9. tool boundaries (critical)

  • do not migrate or rewrite animation libraries unless explicitly requested
  • apply these rules within the existing animation system
  • never partially migrate APIs or mix styles within the same component

common fixes

/* layout thrashing: animate transform instead of width */
/* before */ .panel { transition: width 0.3s; }

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

'Layout thrashing' là gì?

Đó là khi mã liên tục yêu cầu thông tin về kích thước và vị trí của phần tử trong lúc hiệu ứng đang chạy, khiến mọi thứ bị chậm.

Những hiệu ứng nào được khuyến nghị nhất?

Các hiệu ứng dùng 'transform' và 'opacity' (thay đổi hình dạng và độ trong suốt) thường nhanh hơn.

Tôi có thể tạo hiệu ứng cho bất cứ thứ gì không?

Tốt nhất chỉ nên tạo hiệu ứng cho các phần tử nhỏ, độc lập, nếu hiệu ứng ảnh hưởng đến 'paint' hoặc 'layout'.

Chi tiết

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

Audit and fix animation performance issues including layout thrashing, compositor properties, scroll-linked motion, and blur effects. Use when animations stutter, transitions jank, or reviewing CSS/JS animation performance.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#4631
Giấy phép
MIT
Cập nhật
15/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ự