MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / setPosition

Function setPosition

assets/js/3DPaint.js:88–95  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

86
87 const temp = new THREE.Vector3();
88 function setPosition(e) {
89 const pos = getCanvasRelativePosition(e);
90 const x = (pos.x / canvas.width) * 2 - 1;
91 const y = (pos.y / canvas.height) * -2 + 1;
92 temp.set(x, y, 0).unproject(camera);
93 state.x = temp.x;
94 state.y = temp.y;
95 }
96
97 canvas.addEventListener("mousemove", setPosition);
98 canvas.addEventListener(

Callers 1

mainFunction · 0.85

Calls 1

Tested by

no test coverage detected