Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Pic.prototype.startGrid = function() {
var target = {x: 10, y: 20, z: 0};
// this.tween = new TWEEN.Tween(this.position).to(target, 2000);
// this.tween.start();
new TWEEN.Tween(this.position).to(target, 2000)
.start();
new TWEEN.Tween(this.rotation).to({x:0,y:0,z:0}, 2000)
.start();
};
Pic.prototype.startGrid = function() {
var target = {x: 10, y: 20, z: 0};
// this.tween = new TWEEN.Tween(this.position).to(target, 2000);
// this.tween.start();
new TWEEN.Tween(this.position).to(target, 2000)
.start();
new TWEEN.Tween(this.rotation).to({x:0,y:0,z:0}, 2000)
.start();
};
// Move camera from its current position to target:
new TWEEN.Tween(from).to(cameraEndPos, 400)
.easing(TWEEN.Easing.Linear.None)
.onUpdate(moveCamera)
.onComplete(function() {
if (typeof done === 'function') done();
})
.start();
// Also rotate camera while it flies to an object:
var startRotation = new THREE.Quaternion().copy(camera.quaternion);
camera.lookAt(new THREE.Vector3(to.x, to.y, to.z));
var endRotation = new THREE.Quaternion().copy(camera.quaternion);
camera.quaternion.copy(startRotation); // revert to original rotation
new TWEEN.Tween({
x: startRotation.x,
y: startRotation.y,
z: startRotation.z,
w: startRotation.w
}).to({
x: endRotation.x,
y: endRotation.y,
z: endRotation.z,
w: endRotation.w
}, 300).onUpdate(rotateCamera).start();
}
// Move camera from its current position to target:
new TWEEN.Tween(from).to(cameraEndPos, 400)
.easing(TWEEN.Easing.Linear.None)
.onUpdate(moveCamera)
.onComplete(function() {
if (typeof done === 'function') done();
})
.start();
// Also rotate camera while it flies to an object:
var startRotation = new THREE.Quaternion().copy(camera.quaternion);
camera.lookAt(new THREE.Vector3(to.x, to.y, to.z));
var endRotation = new THREE.Quaternion().copy(camera.quaternion);
camera.quaternion.copy(startRotation); // revert to original rotation
new TWEEN.Tween({
x: startRotation.x,
y: startRotation.y,
z: startRotation.z,
w: startRotation.w
}).to({
x: endRotation.x,
y: endRotation.y,
z: endRotation.z,
w: endRotation.w
}, 300).onUpdate(rotateCamera).start();
}
cameraOffset = done;
done = undefined;
}
cameraOffset = typeof cameraOffset === 'number' ? cameraOffset : 100;
// copy camera's current position - we will be animating this value
var from = {
x: camera.position.x,
y: camera.position.y,
z: camera.position.z,
};
// Camera needs to stop at given distance from target's center
var cameraEndPos = intersect(from, to, cameraOffset);
// Move camera from its current position to target:
new TWEEN.Tween(from).to(cameraEndPos, 400)
.easing(TWEEN.Easing.Linear.None)
.onUpdate(moveCamera)
.onComplete(function() {
if (typeof done === 'function') done();
})
.start();
// Also rotate camera while it flies to an object:
var startRotation = new THREE.Quaternion().copy(camera.quaternion);
camera.lookAt(new THREE.Vector3(to.x, to.y, to.z));
var endRotation = new THREE.Quaternion().copy(camera.quaternion);
camera.quaternion.copy(startRotation); // revert to original rotation
new TWEEN.Tween({
x: startRotation.x,
y: startRotation.y,
WorldRenderer.prototype.autopan = function(duration) {
var targetY = this.camera.parent.rotation.y - AUTOPAN_ANGLE;
var tween = new TWEEN.Tween(this.camera.parent.rotation)
.to({y: targetY}, AUTOPAN_DURATION)
.easing(TWEEN.Easing.Quadratic.Out)
.start();
};
PeerRenderer.prototype.stopWalking_ = function() {
var leftBack = new TWEEN.Tween(this.leftLeg.rotation);
leftBack.to({x: 0}, WALKING_RATE/2).start();
var rightBack = new TWEEN.Tween(this.rightLeg.rotation);
rightBack.to({x: 0}, WALKING_RATE/2).start();
this.startIdleAnimation_();
};
var placeSelection = function (theatre) {
var nodePosition = theatre.selectedNode.position;
var selection = theatre.selection;
selection.material.opacity = 0;
selection.position.x = nodePosition.x;
selection.position.y = nodePosition.y - 250;
selection.position.z = nodePosition.z;
new TWEEN.Tween(selection.position).to( {y: nodePosition.y - 100}, 300 ).start();
new TWEEN.Tween(selection.material).to( {opacity:1}, 300 ).start();
}
function tweenObject(object, destination, duration) {
var tween = object.__internalTween;
if(tween) {
tween.stop();
}
tween = new TWEEN.Tween(object);
tween.easing(TWEEN.Easing.Exponential.Out);
tween.to(destination, duration);
object.__internalTween = tween;
return tween;
}
constructor() {
const texture = PIXI.Texture.fromImage(BUNNY);
super(texture);
this.tween = new Tween(this);
this.anchor.x = .5;
this.anchor.y = 1;
this.pivot.x = .5;
this.pivot.y = .5;
this.interactive = true;
}