Firefox Tomorrow

web api interface

DOMPointReadOnly

View on MDN ↗

Available in workers

The DOMPointReadOnly interface specifies the coordinate and perspective fields used by DOMPoint to define a 2D or 3D point in a coordinate system.

There are two ways to create a new DOMPointReadOnly instance. First, you can use its constructor, passing in the values of the parameters for each dimension and, optionally, the perspective:

/* 2D */
const point2D = new DOMPointReadOnly(50, 50);

/* 3D */
const point3D = new DOMPointReadOnly(50, 50, 25);

/* 3D with perspective */
const point3DPerspective = new DOMPointReadOnly(100, 100, 100, 1.0);

The other option is to use the static DOMPointReadOnly.fromPoint() method:

const point = DOMPointReadOnly.fromPoint({ x: 100, y: 100, z: 50, w: 1.0 });

Constructor

Instance properties

  • x Read only
    • : The point’s horizontal coordinate, x.
  • y Read only
    • : The point’s vertical coordinate, y.
  • z Read only
    • : The point’s depth coordinate, z.
  • w Read only
    • : The point’s perspective value, w.

Static methods

  • DOMPointReadOnly.fromPoint()
    • : A static method that creates a new DOMPointReadOnly object given the coordinates provided in the specified object.

Instance methods

  • matrixTransform()
    • : Applies a matrix transform specified as an object to the DOMPointReadOnly object.
  • toJSON()
    • : Returns a JSON representation of the DOMPointReadOnly object.

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also