askill
animate-svg-wrapper-instead-of-svg-element

animate-svg-wrapper-instead-of-svg-elementSafety 100Repository

Animate SVG Wrapper Instead of SVG Element

0 stars
1.2k downloads
Updated 2/12/2026

Package Files

Loading files...
SKILL.md

Animate SVG Wrapper Instead of SVG Element

Many browsers don't have hardware acceleration for CSS3 animations on SVG elements. Wrap SVG in a <div> and animate the wrapper instead.

Incorrect (animating SVG directly - no hardware acceleration):

function LoadingSpinner() {
  return (
    <svg className="animate-spin" width="24" height="24" viewBox="0 0 24 24">
      <circle cx="12" cy="12" r="10" stroke="currentColor" />
    </svg>
  );
}

Correct (animating wrapper div - hardware accelerated):

function LoadingSpinner() {
  return (
    <div className="animate-spin">
      <svg width="24" height="24" viewBox="0 0 24 24">
        <circle cx="12" cy="12" r="10" stroke="currentColor" />
      </svg>
    </div>
  );
}

This applies to all CSS transforms and transitions (transform, opacity, translate, scale, rotate). The wrapper div allows browsers to use GPU acceleration for smoother animations.

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

85/100Analyzed 2/20/2026

A solid technical reference skill explaining a specific SVG animation performance technique. Provides clear before/after code examples demonstrating how wrapping SVGs in a div enables hardware acceleration. Well-structured and actionable, though could benefit from additional context about browser compatibility or when this optimization matters most.

100
85
85
70
90

Metadata

Licenseunknown
Version-
Updated2/12/2026
Publisherihj04982

Tags

No tags yet.