Join us online - 19th of November
Save your spot
For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.

Interface SVGLength

The SVGLength interface correspond to the basic data type.

MDN Reference

interface SVGLength {
    SVG_LENGTHTYPE_CM: 6;
    SVG_LENGTHTYPE_EMS: 3;
    SVG_LENGTHTYPE_EXS: 4;
    SVG_LENGTHTYPE_IN: 8;
    SVG_LENGTHTYPE_MM: 7;
    SVG_LENGTHTYPE_NUMBER: 1;
    SVG_LENGTHTYPE_PC: 10;
    SVG_LENGTHTYPE_PERCENTAGE: 2;
    SVG_LENGTHTYPE_PT: 9;
    SVG_LENGTHTYPE_PX: 5;
    SVG_LENGTHTYPE_UNKNOWN: 0;
    unitType: number;
    value: number;
    valueAsString: string;
    valueInSpecifiedUnits: number;
    convertToSpecifiedUnits(unitType: number): void;
    newValueSpecifiedUnits(
        unitType: number,
        valueInSpecifiedUnits: number,
    ): void;
}
Index
SVG_LENGTHTYPE_CM: 6
SVG_LENGTHTYPE_EMS: 3
SVG_LENGTHTYPE_EXS: 4
SVG_LENGTHTYPE_IN: 8
SVG_LENGTHTYPE_MM: 7
SVG_LENGTHTYPE_NUMBER: 1
SVG_LENGTHTYPE_PC: 10
SVG_LENGTHTYPE_PERCENTAGE: 2
SVG_LENGTHTYPE_PT: 9
SVG_LENGTHTYPE_PX: 5
SVG_LENGTHTYPE_UNKNOWN: 0
unitType: number

The unitType property of the SVGLength interface that represents type of the value as specified by one of the SVG_LENGTHTYPE_* constants defined on this interface.

MDN Reference

value: number

The value property of the SVGLength interface represents the floating point value of the in user units.

MDN Reference

valueAsString: string

The valueAsString property of the SVGLength interface represents the 's value as a string, in the units expressed by unitType.

MDN Reference

valueInSpecifiedUnits: number

The valueInSpecifiedUnits property of the SVGLength interface represents floating point value, in the units expressed by unitType.

MDN Reference

  • The convertToSpecifiedUnits() method of the SVGLength interface allows you to convert the length's value to the specified unit type.

    MDN Reference

    Parameters

    • unitType: number

    Returns void

  • The newValueSpecifiedUnits() method of the SVGLength interface resets the value as a number with an associated unitType, thereby replacing the values for all of the attributes on the object.

    MDN Reference

    Parameters

    • unitType: number
    • valueInSpecifiedUnits: number

    Returns void

Was this helpful?