Atlaslog
Atlaslog / three.js / API reference / Vector2
three.js · API reference

Vector2

Quick answer

Vector2 holds two components and appears in screen coordinates, normalized device coordinates, and texture UVs. Methods such as add(), multiplyScalar(), distanceTo(), angle(), and applyMatrix3() operate in place and return this for chaining. Remember that screen y grows downward while UV and NDC y grow upward.

Last verified 2026-11-03 · three.js 0.160.0 · Cite this page
new THREE.Vector2 ( x , y ) → Vector2
Key points
Example
const pointer = new THREE.Vector2();

function onPointerMove(event) {
  const rect = renderer.domElement.getBoundingClientRect();

  pointer.x = ((event.clientX - rect.left) / rect.width) * 2 - 1;
  pointer.y = -((event.clientY - rect.top) / rect.height) * 2 + 1;
}

renderer.domElement.addEventListener('pointermove', onPointerMove);
texture.wrapS = THREE.RepeatWrapping;
texture.wrapT = THREE.RepeatWrapping;
texture.repeat.set(8, 8);   // 覆盖 8 × 8 次
texture.offset.set(0.5, 0);
Notes
Runnable examplesChinese originalAll API references
English edition written for Atlaslog. Code is taken from the original Chinese page and runs unchanged.
Cite this page

Atlaslog (2026). Vector2. https://www.jingweizhi.com/en/three/api/vector2.html (accessed 2026-11-03).