Baseline Widely available
Note: This feature is available in Web Workers.
The DOMPoint()
constructor creates and returns a new DOMPoint
object, given the values for some or all of its properties.
You can also create a DOMPoint
by calling the DOMPoint.fromPoint()
static function. That function accepts any object with the required parameters, including a DOMPoint
or DOMPointReadOnly
.
new DOMPoint()
new DOMPoint(x)
new DOMPoint(x, y)
new DOMPoint(x, y, z)
new DOMPoint(x, y, z, w)
Parameters
x
Optional
The x
coordinate for the new DOMPoint
.
y
Optional
The y
coordinate for the new DOMPoint
.
z
Optional
The z
coordinate for the new DOMPoint
.
w
Optional
The perspective value of the new DOMPoint
.
This example creates a DOMPoint
representing the top-left corner of the current window, then creates a second point based on the first, which is then offset by 100 pixels both vertically and horizontally.
const windTopLeft = new DOMPoint(window.screenX, window.screenY);
const newTopLeft = DOMPoint.fromPoint(windTopLeft);
newTopLeft.x += 100;
newTopLeft.y += 100;
Specifications Browser compatibility See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4