Capítulo 3 de 411
GSAP can tween any numeric HTML/SVG attribute (not just CSS) through the attr property, automatically included in core with no registerPlugin() call needed.
attr: {}: object of attribute names to tween (e.g. an SVG x, y, width, height).%) when tweening an attribute — but it cannot convert between units (px ↔ %).x: a plain x property tweens the CSS transform; x nested inside attr: {} tweens the element's underlying x coordinate attribute instead — the two are unrelated.gsap.to("#rect", {
duration: 1,
attr: { x: 100, y: 50, width: 100, height: 100 },
ease: "none",
x: 200, // this animates the CSS translateX() transform, not the attribute
});
attr: {}: GSAP handles CSS through its own internal system; putting CSS-affecting values inside attr bypasses that and produces incorrect results.attr is for the DOM/SVG attribute itself, not the visual CSS transform — they can coexist on the same tween with the same property name.attr tweens (e.g. can't go from px to %).