How to use the Euler function from three

Find comprehensive JavaScript three.Euler code examples handpicked from public code repositorys.

5
6
7
8
9
10
11
12
13
14
15
class AudioManagerView extends View {
    constructor(model) {
        super(model);
        
        this.listenerMatrix = new THREE.Matrix4();
        this.euler = new THREE.Euler();


        this.audioContext = new AudioContext();
        window.addEventListener('click', event => {
            if(this.audioContext.state !== 'running')
fork icon8
star icon36
watch icon0

1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
};

// Reusable utility variables

var tempVector = new THREE.Vector3( 0, 0, 0 );
var tempEuler = new THREE.Euler();
var alignVector = new THREE.Vector3( 0, 1, 0 );
var zeroVector = new THREE.Vector3( 0, 0, 0 );
var lookAtMatrix = new THREE.Matrix4();
var tempQuaternion = new THREE.Quaternion();
fork icon4
star icon26
watch icon0

55
56
57
58
59
60
61
62
63
64

// convenience function to return an instance of an Euler rotation
static rot3(theta, phi) {
    var thetaRad = theta / 180 * Math.PI;
    var phiRad = phi / 180 * Math.PI;
    return new THREE.Euler(thetaRad + Math.PI / 2, phiRad, 0, 'YXZ');
}

// do next animation frame
doAnimationFrame() {
fork icon3
star icon20
watch icon5

+ 9 other calls in file

51
52
53
54
55
56
57
58
59

this.getDirection = (function () {
  // assumes the camera itself is not rotated

  let direction = new THREE.Vector3(0, 0, -1)
  let rotation = new THREE.Euler(0, 0, 0, 'YXZ')

  return function (v) {
    rotation.set(pitchObject.rotation.x, yawObject.rotation.y, 0)
fork icon398
star icon1
watch icon1

+ 3 other calls in file

52
53
54
55
56
57
58
59
60
61
this.getDirection = function() {

  // assumes the camera itself is not rotated

  var direction = new THREE.Vector3( 0, 0, - 1 );
  var rotation = new THREE.Euler( 0, 0, 0, "YXZ" );

  return function( v ) {

    rotation.set( pitchObject.rotation.x, yawObject.rotation.y, 0 );
fork icon398
star icon0
watch icon2

+ 3 other calls in file

45
46
47
48
49
50
51
52
53
54
var tempQuaternion = new THREE.Quaternion();

var zee = new THREE.Vector3(0, 0, 1);
var up = new THREE.Vector3(0, 1, 0);
var v0 = new THREE.Vector3(0, 0, 0);
var euler = new THREE.Euler();
var q0 = new THREE.Quaternion(); // - PI/2 around the x-axis
var q1 = new THREE.Quaternion(-Math.sqrt(0.5), 0, 0, Math.sqrt(0.5));

this.deviceOrientation = {};
fork icon6
star icon30
watch icon7

+ 3 other calls in file

51
52
53
54
55
56
57
58
59
60
this.getDirection = function () {

  // assumes the camera itself is not rotated

  var direction = new THREE.Vector3(0, 0, -1);
  var rotation = new THREE.Euler(0, 0, 0, "YXZ");

  return function (v) {

    rotation.set(pitchObject.rotation.x, yawObject.rotation.y, 0);
fork icon1
star icon0
watch icon1

+ 3 other calls in file

83
84
85
86
87
88
89
90
91
92
}

// Rotate the turtle's _dir_ vector by each of the 
// Euler angles indicated by the input.
rotateTurtle(x, y, z) {
    var e = new THREE.Euler(
            x * this.angle * 3.14/180,
                            y * this.angle * 3.14/180,
                            z * this.angle * 3.14/180);
    this.state.dir.applyEuler(e);
fork icon35
star icon0
watch icon2

0
1
2
3
4
5
6
7
8
9
// https://developer-archive.leapmotion.com/documentation/javascript/api/Leap.Hand.html

const THREE = require('three');
const Vector3 = THREE.Vector3;
const Matrix4 = THREE.Matrix4;
const Euler = THREE.Euler;

class Hand {
    constructor(handData) {
        const {confidence, id, timeVisible, type} = handData;
fork icon2
star icon16
watch icon3

1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
const cInterpolations = [];
const qInterpolations = [];
const pInterpolations = [];
const fInterpolations = [];
const quaternion = new three_1.Quaternion();
const euler = new three_1.Euler();
const position = new three_1.Vector3();
const center = new three_1.Vector3();
for (let i = 0, il = cameras.length; i < il; i += 1) {
    const motion = cameras[i];
fork icon1
star icon3
watch icon0

+ 4 other calls in file

186
187
188
189
190
191
192
193
194
195
piece.shift = new THREE.Vector3(piece.shiftX[0], piece.shiftY[0], piece.shiftZ[0]).divideScalar(piece.shiftDenominator[0])
piece.shift.applyEuler(parentRot)
piece.shift.add(parentShift)
let rotVector = new THREE.Vector3(piece.rotateX[0], piece.rotateY[0], piece.rotateZ[0]).divideScalar(piece.rotateDenominator).multiplyScalar(Math.PI / 2)
rotVector.add(parentRot.toVector3())
piece.rot = new THREE.Euler().setFromVector3(rotVector, 'YXZ')
for (let b of bone.Data) {
  walkSkeleton(
    chr,
    entries,
fork icon0
star icon3
watch icon0

120
121
122
123
124
125
126
127
128
129
holdCountry = true;
this.highlightCounty(pickerPoint, world)
randomPoint.set(THREE.Math.randFloat( -(sphereRadius + 5), sphereRadius + 5 ), 0 , sphereRadius + 5)
this.cameraMove(minAltitude, randomPoint) //zooms camera in

const euler = new THREE.Euler()
var startQuaternion = new THREE.Quaternion()
const endQuaternion = this.getQuaternionFromPoints(pickerPoint, randomPoint)    
startQuaternion.copy(world.quaternion).normalize()
  
fork icon0
star icon1
watch icon1

+ 17 other calls in file

43
44
45
46
47
48
49
50
51
    longitude: ViewportStore.getLongitude()
  }
  this.orbitControls = OrbitControls
  this.cameraData = {
    position: new THREE.Vector3(0,0,3),
    rotation: new THREE.Euler('xyz',0,0,0),
    scale: new THREE.Vector3(1,1,1)
  }
}
fork icon0
star icon1
watch icon1

+ 282 other calls in file

751
752
753
754
755
756
757
758
759
 }
 if(keys.indexOf("down") > -1) {
   //this.input.rotation.x += rspd;
 }

 var euler = new THREE.Euler( 0, 0, 0, 'YXZ' );
euler.x = this.input.rotation.x;
euler.y = this.input.rotation.y;
//this.tObject.quaternion.setFromEuler( euler );
fork icon0
star icon0
watch icon2

+ 272 other calls in file

2434
2435
2436
2437
2438
2439
2440
2441
2442
if ( preRotations !== undefined ) {

	preRotations = preRotations.map( THREE.Math.degToRad );
	preRotations.push( 'ZYX' );

	preRotations = new THREE.Euler().fromArray( preRotations );
	preRotations = new THREE.Quaternion().setFromEuler( preRotations );

}
fork icon0
star icon0
watch icon1

+ 355 other calls in file

139
140
141
142
143
144
145
146
147
148
  3 * (-1 + 2 * Math.random()),
  1 * (-1 + 2 * Math.random())-1,
  0.2 + (-1 + 2 * Math.random())
);

const rotation = new THREE.Euler(
  Math.random() * Math.PI * 2,
  Math.random() * Math.PI * 2,
  Math.random() * Math.PI * 2
);
fork icon0
star icon0
watch icon0

+ 2 other calls in file

7
8
9
10
11
12
13
14
15
16
class Camera3DControls extends ActorComponent_1.default {
    constructor(actor, camera) {
        super(actor, "Camera3DControls");
        this.movementSpeed = 0.2;
        this.camera = camera;
        this.rotation = actor.getLocalEulerAngles(new THREE.Euler());
    }
    setIsLayerActive(active) { }
    update() {
        const keyButtons = this.actor.gameInstance.input.keyboardButtons;
fork icon0
star icon0
watch icon0

358
359
360
361
362
363
364
365
366
    }
  }
}

// orient (e) {
//   var current = new THREE.Euler().setFromQuaternion(this.camera.quaternion, 'YXZ');
//   current.x += e.x;
//   current.y += e.y;
//   current.z += e.z;
fork icon0
star icon0
watch icon0

+ 15 other calls in file

141
142
143
144
145
146
147
148
149
150
    agents.positions[i][0] - this.size / 2,
    agents.positions[i][2] * 12.5,
    agents.positions[i][1] - this.size / 2
),
new THREE.Quaternion().setFromEuler(
    new THREE.Euler(
        0,
        Math.lerp(prevrot, Math.atan2(agents.accelerations[i][0], agents.accelerations[i][1]), .1),
        dead ? 1.4 : 0
    )
fork icon0
star icon0
watch icon0

+ 5 other calls in file

2474
2475
2476
2477
2478
2479
2480
2481
2482
2483

if (postRotation !== undefined) {
  postRotation = postRotation.map(THREE.Math.degToRad);
  postRotation.push(eulerOrder);

  postRotation = new THREE.Euler().fromArray(postRotation);
  postRotation = new THREE.Quaternion()
    .setFromEuler(postRotation)
    .inverse();
}
fork icon0
star icon0
watch icon0

+ 4 other calls in file

Other functions in three

Sorted by popularity

function icon

three.Vector3 is the most popular function in three (22341 examples)