The SVGAngle interface is used to represent a value that can be an <angle> or <number> value. An SVGAngle reflected through the animVal attribute is always read only.
An SVGAngle object can be designated as read only, which means that 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:
- Reflect the base value of a reflected animatable attribute (being exposed through the
baseValmember of anSVGAnimatedAngle), - Be detached, which is the case for
SVGAngleobjects created withSVGSVGElement.createSVGAngle().
Constants
SVG_ANGLETYPE_UNKNOWN- Some unknown type of value.
SVG_ANGLETYPE_UNSPECIFIED- A unitless
<number>interpreted as a value in degrees. SVG_ANGLETYPE_DEG- An
<angle>with adegunit. SVG_ANGLETYPE_RAD- An
<angle>with aradunit. SVG_ANGLETYPE_GRAD- An
<angle>with agradunit.
Properties
unitType- The type of the value as specified by one of the
SVG_ANGLETYPE_*constants defined on this interface. valueThe value as a floating point value, in user units. Setting this attribute will cause
valueInSpecifiedUnitsandvalueAsStringto be updated automatically to reflect this setting.Exceptions on setting: A
DOMExceptionwith codeNO_MODIFICATION_ALLOWED_ERRis raised when the length corresponds to a read-only attribute, or when the object itself is read-only.valueInSpecifiedUnitsThe value as a floating point value, in the units expressed by
unitType. Setting this attribute will causevalueandvalueAsStringto be updated automatically to reflect this setting.Exceptions on setting: A
DOMExceptionwith codeNO_MODIFICATION_ALLOWED_ERRis raised when the length corresponds to a read-only attribute, or when the object itself is read-only.valueAsStringThe value as a
DOMStringvalue, in the units expressed byunitType. Setting this attribute will causevalue,valueInSpecifiedUnits, andunitTypeto be updated automatically to reflect this setting.Exceptions on setting:
A
DOMExceptionwith codeSYNTAX_ERRis raised if the assigned string cannot be parsed as a valid<angle>.A
DOMExceptionwith codeNO_MODIFICATION_ALLOWED_ERRis raised when the length corresponds to a read-only attribute, or when the object itself is read-only.
Methods
newValueSpecifiedUnitsReset the value as a number with an associated unitType, thereby replacing the values for all of the attributes on the object.
Exceptions:
A
DOMExceptionwith codeNOT_SUPPORTED_ERRis raised ifunitTypeisSVG_ANGLETYPE_UNKNOWNor not a valid unit type constant (one of the otherSVG_ANGLETYPE_*constants defined on this interface).- A
DOMExceptionwith codeNO_MODIFICATION_ALLOWED_ERRis raised when the length corresponds to a read only attribute or when the object itself is read only. convertToSpecifiedUnits- Preserve the same underlying stored value, but reset the stored unit identifier to the given
unitType. Object attributesunitType,valueInSpecifiedUnits, andvalueAsStringmight be modified as a result of this method.
Specifications
| Specification | Status | Comment |
|---|---|---|
| Scalable Vector Graphics (SVG) 2The definition of 'SVGElement' in that specification. | Candidate Recommendation | Adds the dataset property.
|
| Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGElement' in that specification. | Recommendation | Initial definition |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
SVGAngle
|
Chrome
Full support Yes |
Edge
Full support ≤18 |
Firefox
Full support Yes |
IE
? |
Opera
Full support Yes |
Safari
Full support Yes |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support Yes |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes |
Legend
- Full support
- Full support
- Compatibility unknown
- Compatibility unknown
SVGAngle by Mozilla Contributors is licensed under CC-BY-SA 2.5.