Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To animate an SVG, choose the method that matches the change: use SVG animation elements such as <animate> for attribute changes and motion paths, CSS keyframes or transitions for style changes, and JavaScript when animation must respond to user input or application state. The examples below show each method and how to account for reduced-motion preferences.

Choose an SVG animation method

Method Use it when Typical examples
SVG animation elements You want to declare attribute changes, transforms, or path motion in the SVG markup. Move a circle, rotate a shape, or move an object along a path.
CSS animations or transitions The change can be expressed as a CSS property and you want motion rules in a stylesheet. Animate opacity, fill, or transforms.
JavaScript and the SVG DOM The animation depends on events, data, or application state. Start or change an animation when a user interacts with an SVG.

SVG supports declarative animation in markup as well as scripting. The right choice depends on what changes, how interactive it is, and how the SVG will be embedded. W3C SVG 2 introduction describes both declarative and scripted animation.

Animate an SVG attribute with <animate>

Place an <animate> element inside the SVG shape whose attribute should change. This example moves a circle horizontally and repeats the motion:

<svg viewBox="0 0 300 100" xmlns="http://www.w3.org/2000/svg">
  <circle cx="0" cy="50" r="15" fill="blue">
    <animate attributeName="cx" from="0" to="300" dur="3s" repeatCount="indefinite" />
  </circle>
</svg>

attributeName identifies the attribute to animate; from and to set its endpoints; dur sets the duration; and repeatCount controls repetition. Change the attribute and values to suit the effect. For a discrete change rather than a continuous interpolation, SVG also defines <set>. See MDN’s <animate> reference and the W3C SVG Animations draft.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Animate transforms or motion along a path

Use <animateTransform> when the animated value is a transform, such as rotation or scaling. Use <animateMotion> to move an element along a path; it can also rotate the element to follow the path’s tangent. These elements are useful when the effect is geometric motion rather than a change in a style such as opacity. MDN’s SVG animation guide explains these forms.

Animate an SVG with CSS

CSS keyframes animate CSS property values over time. This example scales a circle and changes its opacity:

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" aria-labelledby="title">
  <title id="title">Pulsing circle</title>
  <circle class="pulse" cx="50" cy="50" r="20" />
</svg>
.pulse {
  transform-box: fill-box;
  transform-origin: center;
  animation: pulse 1.2s ease-in-out infinite alternate;
}

@keyframes pulse {
  to { transform: scale(1.25); opacity: 0.65; }
}

A CSS transition is another option when a property should change smoothly in response to a state change, rather than play through a keyframe sequence. CSS is a good fit for style-driven effects, but support and behavior depend on the specific property and the SVG’s embedding context; check the target browsers for the exact combination you plan to use. The sources do not establish that CSS is always faster or preferable to SVG animation elements.

Use JavaScript for interaction or dynamic behavior

JavaScript can access SVG elements, attributes, and properties through the SVG DOM, and event handlers can be assigned to graphical objects. Choose scripting when the animation must respond to a click, changing data, or application state. A particular JavaScript animation library is not required by the approach described here; use the SVG DOM directly or a library that fits your application.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Keep the SVG accessible to the page and identify the element to be changed, then update the relevant attribute or style in response to the event or state change. The exact script depends on your interaction and application structure. See the W3C SVG 2 introduction for SVG scripting and event handling context.

Make animation safe to pause or reduce

Motion can cause discomfort for some people; blinking and flashing can be especially problematic. Provide a pause or disable mechanism for substantial or persistent motion, and respect the user’s reduced-motion preference. MDN discusses these concerns in its reduced-motion media query guide.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

For the CSS pulse above, a reduced-motion rule can disable the effect:

@media (prefers-reduced-motion: reduce) {
  .pulse {
    animation: none;
  }
}

For animation declared in SVG markup or driven by JavaScript, also provide a suitable control or alternate state. A CSS media query alone should not be assumed to control every animation mechanism or every way an SVG is embedded.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Check the SVG’s browser and embedding context

Browser support is feature-specific: verify the exact animation element or CSS property in the browsers you target, and test whether the SVG is inline in HTML or referenced as an image. MDN describes <animate> as widely available across browsers since January 2020, but that milestone is not a guarantee that every SVG animation feature behaves identically in all browsers or embedding modes. MDN’s reference was last modified September 11, 2026; its SMIL guide was last modified July 30, 2026. The W3C SVG Animations page is a living Group Draft.

Troubleshoot common SVG animation problems

  • The shape does not move: Confirm that attributeName matches an animatable attribute on the element and that the starting and ending values are valid for it.
  • A CSS transform looks misplaced: SVG transform origins can depend on the element’s coordinate system. Test with transform-box and transform-origin, as in the CSS example, and check the result in your target browsers.
  • The animation works inline but not as an image: The embedding context can affect which mechanisms work. Test the delivered form rather than assuming inline SVG and referenced SVG behave the same.
  • The effect cannot be stopped by your reduced-motion rule: The CSS rule shown applies to CSS animation. Add an appropriate control or alternate state for markup-driven or scripted animation.
  • Motion is inconsistent across browsers: Check support for the specific animation element or CSS property and the target browser versions; do not infer support for every feature from the availability of <animate>.

Or skip the browser setup

If you need a screenshot of an animated page rather than the SVG animation code itself, ScreenshotNeo is a website screenshot API and MCP server for developers. Its API can capture a URL as an image or PDF with one GET request. For example, using the supplied cURL pattern with a target page URL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for setup and options. Cookie banners, popups, and chat widgets are removed before capture; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card required; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo’s free plan.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.