Convention: How to animate SVG logo rotation without drift?

Documentation for Sessions

πŸ“ Convention: How to animate SVG logo rotation without drift?

Date: 2026-02-28
Time: 17:35:07 UTC
Session: gspace1-153.4
Agent: angular
Confidence: 95%
Status: βœ… Documented


πŸ“‹ Decision Context

Question:

How to animate SVG logo rotation without drift?

Task: Fix logo animation drift during rotation


🎯 Decision Made

Chosen:

SVG animateTransform with rotate(angle cx cy) and explicit center coordinates

Options Considered:

  1. CSS transform + transform-origin
  2. SVG animateTransform with rotate(angle cx cy)

πŸ’­ Reasoning

CSS transform-origin on SVG elements behaves differently than on HTMLβ€”it uses screen coordinates vs viewBox coordinates, causing drift during rotation. SVG native animateTransform with rotate(angle cx cy) uses the viewBox coordinate system. The center (0,0) in viewBox is explicit, so rotation stays in place with zero drift. Use scale(0.7) on a wrapper g to keep rotated content within bounds.


πŸ“ Files Involved


πŸ”— Related


Auto-generated by MCP Smart Consolidation