大网数据广告活动
Web 标准与前端开发

DOMPointReadOnly

· 52CE 我爱测

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

Geometry Interfaces

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_static method:

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

Constructor

  • DOMPointReadOnly.DOMPointReadOnly
    • : Creates a new DOMPointReadOnly object given the values of its coordinates and perspective. To create a point using an object, you can instead use DOMPointReadOnly.fromPoint_static.

Instance properties

  • DOMPointReadOnly.x
    • : The point's horizontal coordinate, x.
  • DOMPointReadOnly.y
    • : The point's vertical coordinate, y.
  • DOMPointReadOnly.z
    • : The point's depth coordinate, z.
  • DOMPointReadOnly.w
    • : The point's perspective value, w.

Static methods

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

Instance methods

  • DOMPointReadOnly.matrixTransform
    • : Applies a matrix transform specified as an object to the DOMPointReadOnly object.
  • DOMPointReadOnly.toJSON()
    • : Returns a JSON-serializable plain object representing the DOMPointReadOnly object. Automatically called by JSON.stringify().

Specifications

Browser compatibility

See also

  • DOMPoint
  • DOMRect
  • DOMMatrix

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。