This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
The SVGAngle interface is used to represent a value that can be an <angle> or <number> value.
The SVGAngle returned from SVGAnimatedAngle.animVal and SVGAnimatedAngle.baseVal is read only, but the SVGAngle returned from SVGSVGElement.createSVGAngle() is writable. When designated as read only, attempts to modify the object will result in an exception being thrown.
An SVGAngle object can be associated with a particular element. The associated element is used to determine which element's content attribute to update if the object reflects an attribute. Unless otherwise described, an SVGAngle object is not associated with any element.
Every SVGAngle object operates in one of two modes:
baseVal member of an SVGAnimatedAngle),SVGAngle objects created with SVGSVGElement.createSVGAngle().SVGAngle.unitTypeThe type of the value as specified by one of the SVG_ANGLETYPE_* constants defined on this interface.
SVGAngle.valueThe value as a floating point value, in user units. Setting this attribute will cause valueInSpecifiedUnits and valueAsString to be updated automatically to reflect this setting.
SVGAngle.valueInSpecifiedUnitsThe value as a floating point value, in the units expressed by unitType. Setting this attribute will cause value and valueAsString to be updated automatically to reflect this setting.
SVGAngle.valueAsStringThe value as a string value, in the units expressed by unitType. Setting this attribute will cause value, valueInSpecifiedUnits, and unitType to be updated automatically to reflect this setting.
SVGAngle.convertToSpecifiedUnits()Preserve the same underlying stored value, but reset the stored unit identifier to the given unitType. Object attributes unitType, valueInSpecifiedUnits, and valueAsString might be modified as a result of this method.
SVGAngle.newValueSpecifiedUnits()Reset the value as a number with an associated unitType, thereby replacing the values for all of the attributes on the object.
SVG_ANGLETYPE_UNKNOWN (0)Some unknown type of value.
SVG_ANGLETYPE_UNSPECIFIED (1)A unitless <number> interpreted as a value in degrees.
SVG_ANGLETYPE_DEG (2)An <angle> with a deg unit.
SVG_ANGLETYPE_RAD (3)An <angle> with a rad unit.
SVG_ANGLETYPE_GRAD (4)An <angle> with a grad unit.
| Specification |
|---|
| Scalable Vector Graphics (SVG) 2> # InterfaceSVGAngle> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
SVGAngle |
1 | 12 | 1.5 | ≤12.1 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
convertToSpecifiedUnits |
1 | 12 | 1.5 | ≤12.1 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
newValueSpecifiedUnits |
1 | 12 | 1.5 | ≤12.1 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
unitType |
1 | 12 | 1.5 | ≤12.1 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
value |
1 | 12 | 1.5 | ≤12.1 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
valueAsString |
1 | 12 | 1.5 | ≤12.1 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
valueInSpecifiedUnits |
1 | 12 | 1.5 | ≤12.1 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/SVGAngle