Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

SVGAngle

この記事はまだボランティアによって 日本語 に翻訳されていません。ぜひ MDN に参加して翻訳を手伝ってください!

SVG angle interface

The SVGAngle interface correspond to the <angle> basic data type.

An SVGAngle object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown.

Interface overview

Also implement None
Methods
  • void newValueSpecifiedUnits(in unsigned short unitType, in float valueInSpecifiedUnits)
  • void convertToSpecifiedUnits(in unsigned short unitType)
Properties
  • readonly unsigned short unitType
  • float value
  • float valueInSpecifiedUnits
  • DOMString valueAsString
Constants
  • SVG_ANGLETYPE_UNKNOWN = 0
  • SVG_ANGLETYPE_UNSPECIFIED = 1
  • SVG_ANGLETYPE_DEG = 2
  • SVG_ANGLETYPE_RAD = 3
  • SVG_ANGLETYPE_GRAD = 4
Normative document SVG 1.1 (2nd Edition)

Constants

Name Value Description
SVG_ANGLETYPE_UNKNOWN 0 The unit type is not one of predefined unit types. It is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type.
SVG_ANGLETYPE_UNSPECIFIED 1 No unit type was provided (i.e., a unitless value was specified). For angles, a unitless value is treated the same as if degrees were specified.
SVG_ANGLETYPE_DEG 2 The unit type was explicitly set to degrees.
SVG_ANGLETYPE_RAD 3 The unit type is radians.
SVG_ANGLETYPE_GRAD 4 The unit type is gradians.

Properties

Name Type Description
unitType unsigned short The type of the value as specified by one of the SVG_ANGLETYPE_* constants defined on this interface.
value float

The 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.

Exceptions on setting: a DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised when the length corresponds to a read only attribute or when the object itself is read only.

valueInSpecifiedUnits float

The 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.

Exceptions on setting: a DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised when the length corresponds to a read only attribute or when the object itself is read only.

valueAsString DOMString

The 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.

Exceptions on setting:

  • a DOMException with code SYNTAX_ERR is raised if the assigned string cannot be parsed as a valid <angle>.
  • a DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised when the length corresponds to a read only attribute or when the object itself is read only.

Methods

Name & Arguments Return Description
newValueSpecifiedUnits(in unsigned short unitType, in float valueInSpecifiedUnits) void

Reset the value as a number with an associated unitType, thereby replacing the values for all of the attributes on the object.

Exceptions:

  • a DOMException with code NOT_SUPPORTED_ERR is raised if unitType is SVG_ANGLETYPE_UNKNOWN or not a valid unit type constant (one of the other SVG_ANGLETYPE_* constants defined on this interface).
  • a DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised when the length corresponds to a read only attribute or when the object itself is read only.
convertToSpecifiedUnits(in unsigned short unitType) void 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.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support ? ? ? ? ?
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? ? ? ? ?

 

ドキュメントのタグと貢献者

 このページの貢献者: fscholz, kscarfone, Sheppy, Jeremie
 最終更新者: fscholz,