How to use the aframe/src.THREE.Vector2 function in aframe

To help you get started, we’ve selected a few aframe examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kabbi / zanzarah-tools / src / three / OrbitControls.js View on Github external
// current position in spherical coordinates
  const spherical = new THREE.Spherical();
  const sphericalDelta = new THREE.Spherical();

  let scale = 1;
  const panOffset = new THREE.Vector3();
  let zoomChanged = false;

  const rotateStart = new THREE.Vector2();
  const rotateEnd = new THREE.Vector2();
  const rotateDelta = new THREE.Vector2();

  const panStart = new THREE.Vector2();
  const panEnd = new THREE.Vector2();
  const panDelta = new THREE.Vector2();

  const dollyStart = new THREE.Vector2();
  const dollyEnd = new THREE.Vector2();
  const dollyDelta = new THREE.Vector2();

  function getAutoRotationAngle() {
    return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
  }

  function getZoomScale() {
    return Math.pow(0.95, scope.zoomSpeed);
  }

  function rotateLeft(angle) {
    sphericalDelta.theta -= angle;
  }
github kabbi / zanzarah-tools / src / three / OrbitControls.js View on Github external
const STATE = { NONE: -1, ROTATE: 0, DOLLY: 1, PAN: 2, TOUCH_ROTATE: 3, TOUCH_DOLLY: 4, TOUCH_PAN: 5 };

  let state = STATE.NONE;

  const EPS = 0.000001;

  // current position in spherical coordinates
  const spherical = new THREE.Spherical();
  const sphericalDelta = new THREE.Spherical();

  let scale = 1;
  const panOffset = new THREE.Vector3();
  let zoomChanged = false;

  const rotateStart = new THREE.Vector2();
  const rotateEnd = new THREE.Vector2();
  const rotateDelta = new THREE.Vector2();

  const panStart = new THREE.Vector2();
  const panEnd = new THREE.Vector2();
  const panDelta = new THREE.Vector2();

  const dollyStart = new THREE.Vector2();
  const dollyEnd = new THREE.Vector2();
  const dollyDelta = new THREE.Vector2();

  function getAutoRotationAngle() {
    return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
  }

  function getZoomScale() {
github kabbi / zanzarah-tools / src / three / OrbitControls.js View on Github external
let state = STATE.NONE;

  const EPS = 0.000001;

  // current position in spherical coordinates
  const spherical = new THREE.Spherical();
  const sphericalDelta = new THREE.Spherical();

  let scale = 1;
  const panOffset = new THREE.Vector3();
  let zoomChanged = false;

  const rotateStart = new THREE.Vector2();
  const rotateEnd = new THREE.Vector2();
  const rotateDelta = new THREE.Vector2();

  const panStart = new THREE.Vector2();
  const panEnd = new THREE.Vector2();
  const panDelta = new THREE.Vector2();

  const dollyStart = new THREE.Vector2();
  const dollyEnd = new THREE.Vector2();
  const dollyDelta = new THREE.Vector2();

  function getAutoRotationAngle() {
    return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
  }

  function getZoomScale() {
    return Math.pow(0.95, scope.zoomSpeed);
  }
github kabbi / zanzarah-tools / src / three / OrbitControls.js View on Github external
const STATE = { NONE: -1, ROTATE: 0, DOLLY: 1, PAN: 2, TOUCH_ROTATE: 3, TOUCH_DOLLY: 4, TOUCH_PAN: 5 };

  let state = STATE.NONE;

  const EPS = 0.000001;

  // current position in spherical coordinates
  const spherical = new THREE.Spherical();
  const sphericalDelta = new THREE.Spherical();

  let scale = 1;
  const panOffset = new THREE.Vector3();
  let zoomChanged = false;

  const rotateStart = new THREE.Vector2();
  const rotateEnd = new THREE.Vector2();
  const rotateDelta = new THREE.Vector2();

  const panStart = new THREE.Vector2();
  const panEnd = new THREE.Vector2();
  const panDelta = new THREE.Vector2();

  const dollyStart = new THREE.Vector2();
  const dollyEnd = new THREE.Vector2();
  const dollyDelta = new THREE.Vector2();

  function getAutoRotationAngle() {
    return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
  }

  function getZoomScale() {
    return Math.pow(0.95, scope.zoomSpeed);
github kabbi / zanzarah-tools / src / three / OrbitControls.js View on Github external
const EPS = 0.000001;

  // current position in spherical coordinates
  const spherical = new THREE.Spherical();
  const sphericalDelta = new THREE.Spherical();

  let scale = 1;
  const panOffset = new THREE.Vector3();
  let zoomChanged = false;

  const rotateStart = new THREE.Vector2();
  const rotateEnd = new THREE.Vector2();
  const rotateDelta = new THREE.Vector2();

  const panStart = new THREE.Vector2();
  const panEnd = new THREE.Vector2();
  const panDelta = new THREE.Vector2();

  const dollyStart = new THREE.Vector2();
  const dollyEnd = new THREE.Vector2();
  const dollyDelta = new THREE.Vector2();

  function getAutoRotationAngle() {
    return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
  }

  function getZoomScale() {
    return Math.pow(0.95, scope.zoomSpeed);
  }

  function rotateLeft(angle) {
    sphericalDelta.theta -= angle;
github kabbi / zanzarah-tools / src / components / mouse-cursor.js View on Github external
init() {
    this.__raycaster = new THREE.Raycaster();
    this.__mouse = new THREE.Vector2();
    this.__isMobile = this.el.sceneEl.isMobile;
    this.__isStereo = false;
    this.__active = false;
    this.__isDown = false;
    this.__intersectedEl = null;
    this.attachEventListeners();
  },
github kabbi / zanzarah-tools / src / three / OrbitControls.js View on Github external
const spherical = new THREE.Spherical();
  const sphericalDelta = new THREE.Spherical();

  let scale = 1;
  const panOffset = new THREE.Vector3();
  let zoomChanged = false;

  const rotateStart = new THREE.Vector2();
  const rotateEnd = new THREE.Vector2();
  const rotateDelta = new THREE.Vector2();

  const panStart = new THREE.Vector2();
  const panEnd = new THREE.Vector2();
  const panDelta = new THREE.Vector2();

  const dollyStart = new THREE.Vector2();
  const dollyEnd = new THREE.Vector2();
  const dollyDelta = new THREE.Vector2();

  function getAutoRotationAngle() {
    return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
  }

  function getZoomScale() {
    return Math.pow(0.95, scope.zoomSpeed);
  }

  function rotateLeft(angle) {
    sphericalDelta.theta -= angle;
  }

  function rotateUp(angle) {
github kabbi / zanzarah-tools / src / three / TransformControls.js View on Github external
scale: new THREE.TransformGizmoScale(),
  };

  for (const type in _gizmo) {
    const gizmoObj = _gizmo[type];
    gizmoObj.visible = (type === _mode);
    this.add(gizmoObj);
  }

  const changeEvent = { type: 'change' };
  const mouseDownEvent = { type: 'mouseDown' };
  const mouseUpEvent = { type: 'mouseUp', mode: _mode };
  const objectChangeEvent = { type: 'objectChange' };

  const ray = new THREE.Raycaster();
  const pointerVector = new THREE.Vector2();

  const point = new THREE.Vector3();
  const offset = new THREE.Vector3();

  const rotation = new THREE.Vector3();
  const offsetRotation = new THREE.Vector3();
  let scale = 1;

  const lookAtMatrix = new THREE.Matrix4();
  const eye = new THREE.Vector3();

  const tempMatrix = new THREE.Matrix4();
  const tempVector = new THREE.Vector3();
  const tempQuaternion = new THREE.Quaternion();
  const unitX = new THREE.Vector3(1, 0, 0);
  const unitY = new THREE.Vector3(0, 1, 0);
github kabbi / zanzarah-tools / src / three / OrbitControls.js View on Github external
let scale = 1;
  const panOffset = new THREE.Vector3();
  let zoomChanged = false;

  const rotateStart = new THREE.Vector2();
  const rotateEnd = new THREE.Vector2();
  const rotateDelta = new THREE.Vector2();

  const panStart = new THREE.Vector2();
  const panEnd = new THREE.Vector2();
  const panDelta = new THREE.Vector2();

  const dollyStart = new THREE.Vector2();
  const dollyEnd = new THREE.Vector2();
  const dollyDelta = new THREE.Vector2();

  function getAutoRotationAngle() {
    return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
  }

  function getZoomScale() {
    return Math.pow(0.95, scope.zoomSpeed);
  }

  function rotateLeft(angle) {
    sphericalDelta.theta -= angle;
  }

  function rotateUp(angle) {
    sphericalDelta.phi -= angle;
  }
github kabbi / zanzarah-tools / src / three / OrbitControls.js View on Github external
const sphericalDelta = new THREE.Spherical();

  let scale = 1;
  const panOffset = new THREE.Vector3();
  let zoomChanged = false;

  const rotateStart = new THREE.Vector2();
  const rotateEnd = new THREE.Vector2();
  const rotateDelta = new THREE.Vector2();

  const panStart = new THREE.Vector2();
  const panEnd = new THREE.Vector2();
  const panDelta = new THREE.Vector2();

  const dollyStart = new THREE.Vector2();
  const dollyEnd = new THREE.Vector2();
  const dollyDelta = new THREE.Vector2();

  function getAutoRotationAngle() {
    return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
  }

  function getZoomScale() {
    return Math.pow(0.95, scope.zoomSpeed);
  }

  function rotateLeft(angle) {
    sphericalDelta.theta -= angle;
  }

  function rotateUp(angle) {
    sphericalDelta.phi -= angle;