tsparticles
Version:
Easily create highly customizable particle, confetti and fireworks animations and use them as animated backgrounds for your website. Ready to use components available also for React, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Riot.js, Inferno.
59 lines (58 loc) • 1.47 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Vector3d = void 0;
const Vector_1 = require("./Vector");
class Vector3d extends Vector_1.Vector {
constructor(x, y, z) {
super(x, y);
this.z = z === undefined ? x.z : z;
}
static clone(source) {
return Vector3d.create(source.x, source.y, source.z);
}
static create(x, y, z) {
return new Vector3d(x, y, z);
}
add(v) {
return v instanceof Vector3d ? Vector3d.create(this.x + v.x, this.y + v.y, this.z + v.z) : super.add(v);
}
addTo(v) {
super.addTo(v);
if (v instanceof Vector3d) {
this.z += v.z;
}
}
sub(v) {
return v instanceof Vector3d ? Vector3d.create(this.x - v.x, this.y - v.y, this.z - v.z) : super.sub(v);
}
subFrom(v) {
super.subFrom(v);
if (v instanceof Vector3d) {
this.z -= v.z;
}
}
mult(n) {
return Vector3d.create(this.x * n, this.y * n, this.z * n);
}
multTo(n) {
super.multTo(n);
this.z *= n;
}
div(n) {
return Vector3d.create(this.x / n, this.y / n, this.z / n);
}
divTo(n) {
super.divTo(n);
this.z /= n;
}
copy() {
return Vector3d.clone(this);
}
setTo(v) {
super.setTo(v);
if (v instanceof Vector3d) {
this.z = v.z;
}
}
}
exports.Vector3d = Vector3d;