Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
// DOWN
if (y < 0) {
this.tilt.to(Fn.scale(y, 0, -100, TILT_CENTER, TILT_MAX));
}
// UP
if (y > 0) {
this.tilt.to(Fn.scale(y, 0, 100, TILT_CENTER, TILT_MIN));
// this.tilt.to(TILT_MIN, ms);
}
// LEFT
if (x < 0) {
this.pan.to(Fn.scale(x, 0, -100, PAN_CENTER, PAN_MIN));
}
if (x > 0) {
this.pan.to(Fn.scale(x, 0, 100, PAN_CENTER, PAN_MAX));
}
return this;
}
}
this.tilt.to(Fn.scale(y, 0, -100, TILT_CENTER, TILT_MAX));
}
// UP
if (y > 0) {
this.tilt.to(Fn.scale(y, 0, 100, TILT_CENTER, TILT_MIN));
// this.tilt.to(TILT_MIN, ms);
}
// LEFT
if (x < 0) {
this.pan.to(Fn.scale(x, 0, -100, PAN_CENTER, PAN_MIN));
}
if (x > 0) {
this.pan.to(Fn.scale(x, 0, 100, PAN_CENTER, PAN_MAX));
}
return this;
}
}
if (x === 0) {
this.pan.to(PAN_CENTER);
}
if (y === 0) {
this.tilt.to(TILT_CENTER);
}
// DOWN
if (y < 0) {
this.tilt.to(Fn.scale(y, 0, -100, TILT_CENTER, TILT_MAX));
}
// UP
if (y > 0) {
this.tilt.to(Fn.scale(y, 0, 100, TILT_CENTER, TILT_MIN));
// this.tilt.to(TILT_MIN, ms);
}
// LEFT
if (x < 0) {
this.pan.to(Fn.scale(x, 0, -100, PAN_CENTER, PAN_MIN));
}
if (x > 0) {
this.pan.to(Fn.scale(x, 0, 100, PAN_CENTER, PAN_MAX));
}
return this;
}
}
let ms = 250;
let { x, y } = axis;
this.stop();
if (x === 0) {
this.pan.to(PAN_CENTER);
}
if (y === 0) {
this.tilt.to(TILT_CENTER);
}
// DOWN
if (y < 0) {
this.tilt.to(Fn.scale(y, 0, -100, TILT_CENTER, TILT_MAX));
}
// UP
if (y > 0) {
this.tilt.to(Fn.scale(y, 0, 100, TILT_CENTER, TILT_MIN));
// this.tilt.to(TILT_MIN, ms);
}
// LEFT
if (x < 0) {
this.pan.to(Fn.scale(x, 0, -100, PAN_CENTER, PAN_MIN));
}
if (x > 0) {
this.pan.to(Fn.scale(x, 0, 100, PAN_CENTER, PAN_MAX));
}