UNPKG

@flashport/flashport

Version:

FlashPort is a TypeScript 2D graphics library that largely replicates the Flash ActionScript 3.0 library

1,442 lines (1,441 loc) 492 kB
var __defProp = Object.defineProperty; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __publicField = (obj, key, value) => { __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); return value; }; class Orientation3D extends Object { constructor() { super(); } } __publicField(Orientation3D, "EULER_ANGLES", "eulerAngles"); __publicField(Orientation3D, "AXIS_ANGLE", "axisAngle"); __publicField(Orientation3D, "QUATERNION", "quaternion"); const _Vector3D = class extends Object { constructor(x = 0, y = 0, z = 0, w = 0) { super(); __publicField(this, "x"); __publicField(this, "y"); __publicField(this, "z"); __publicField(this, "w"); this.x = x; this.y = y; this.z = z; this.w = w; } static angleBetween(a, b) { var dot = a.x * b.x + a.y * b.y + a.z * b.z; var al = a.length; var bl = b.length; dot = dot / (al * bl); return Math.acos(dot); } static distance(pt1, pt2) { return pt1.subtract(pt2).length; } clone() { return new _Vector3D(this.x, this.y, this.z, this.w); } dotProduct(a) { return this.x * a.x + this.y * a.y + this.z * a.z; } crossProduct(a) { return new _Vector3D(this.y * a.z - this.z * a.y, this.z * a.x - this.x * a.z, this.x * a.y - this.y * a.x, 1); } get length() { var r = this.x * this.x + this.y * this.y + this.z * this.z; if (r <= 0) { return 0; } return Math.sqrt(r); } get lengthSquared() { return this.x * this.x + this.y * this.y + this.z * this.z; } normalize() { var len = this.length; var lenInv = len != 0 ? 1 / len : 0; this.x = this.x * lenInv; this.y = this.y * lenInv; this.z = this.z * lenInv; return len; } scaleBy(s) { this.x = this.x * s; this.y = this.y * s; this.z = this.z * s; } incrementBy(a) { this.x = this.x + a.x; this.y = this.y + a.y; this.z = this.z + a.z; } decrementBy(a) { this.x = this.x - a.x; this.y = this.y - a.y; this.z = this.z - a.z; } add(a) { return new _Vector3D(this.x + a.x, this.y + a.y, this.z + a.z); } subtract(a) { return new _Vector3D(this.x - a.x, this.y - a.y, this.z - a.z); } negate() { this.x = -this.x; this.y = -this.y; this.z = -this.z; } equals(toCompare, allFour = false) { return this.x === toCompare.x && this.y === toCompare.y && this.z === toCompare.z && (allFour ? this.w === toCompare.w : true); } nearEquals(toCompare, tolerance, allFour = false) { var diff = this.x - toCompare.x; diff = diff < 0 ? 0 - diff : diff; var goodEnough = diff < tolerance; if (goodEnough) { diff = this.y - toCompare.y; diff = diff < 0 ? 0 - diff : diff; goodEnough = diff < tolerance; if (goodEnough) { diff = this.z - toCompare.z; diff = diff < 0 ? 0 - diff : diff; goodEnough = diff < tolerance; if (goodEnough && allFour) { diff = this.w = toCompare.w; diff = diff < 0 ? 0 - diff : diff; goodEnough = diff < tolerance; } } } return goodEnough; } project() { var tRecip = 1 / this.w; this.x = this.x * tRecip; this.y = this.y * tRecip; this.z = this.z * tRecip; } toString() { var s = "Vector3D(" + this.x + ", " + this.y + ", " + this.z; s = s + ")"; return s; } copyFrom(sourceVector3D) { this.x = sourceVector3D.x; this.y = sourceVector3D.y; this.z = sourceVector3D.z; } setTo(xa, ya, za) { this.x = xa; this.y = ya; this.z = za; } }; let Vector3D = _Vector3D; __publicField(Vector3D, "X_AXIS", new _Vector3D(1, 0, 0)); __publicField(Vector3D, "Y_AXIS", new _Vector3D(0, 1, 0)); __publicField(Vector3D, "Z_AXIS", new _Vector3D(0, 0, 1)); const _Matrix3D = class { constructor(v = null) { __publicField(this, "rawData"); if (v != null && v.length === 16) this.rawData = v; else this.rawData = new Array(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } get determinant() { return (this.rawData[0] * this.rawData[5] - this.rawData[4] * this.rawData[1]) * (this.rawData[10] * this.rawData[15] - this.rawData[14] * this.rawData[11]) - (this.rawData[0] * this.rawData[9] - this.rawData[8] * this.rawData[1]) * (this.rawData[6] * this.rawData[15] - this.rawData[14] * this.rawData[7]) + (this.rawData[0] * this.rawData[13] - this.rawData[12] * this.rawData[1]) * (this.rawData[6] * this.rawData[11] - this.rawData[10] * this.rawData[7]) + (this.rawData[4] * this.rawData[9] - this.rawData[8] * this.rawData[5]) * (this.rawData[2] * this.rawData[15] - this.rawData[14] * this.rawData[3]) - (this.rawData[4] * this.rawData[13] - this.rawData[12] * this.rawData[5]) * (this.rawData[2] * this.rawData[11] - this.rawData[10] * this.rawData[3]) + (this.rawData[8] * this.rawData[13] - this.rawData[12] * this.rawData[9]) * (this.rawData[2] * this.rawData[7] - this.rawData[6] * this.rawData[3]); } get position() { return new Vector3D(this.rawData[12], this.rawData[13], this.rawData[14]); } set position(val) { this.rawData[12] = val.x; this.rawData[13] = val.y; this.rawData[14] = val.z; } append(lhs) { var m111 = this.rawData[0]; var m121 = this.rawData[4]; var m131 = this.rawData[8]; var m141 = this.rawData[12]; var m112 = this.rawData[1]; var m122 = this.rawData[5]; var m132 = this.rawData[9]; var m142 = this.rawData[13]; var m113 = this.rawData[2]; var m123 = this.rawData[6]; var m133 = this.rawData[10]; var m143 = this.rawData[14]; var m114 = this.rawData[3]; var m124 = this.rawData[7]; var m134 = this.rawData[11]; var m144 = this.rawData[15]; var m211 = lhs.rawData[0]; var m221 = lhs.rawData[4]; var m231 = lhs.rawData[8]; var m241 = lhs.rawData[12]; var m212 = lhs.rawData[1]; var m222 = lhs.rawData[5]; var m232 = lhs.rawData[9]; var m242 = lhs.rawData[13]; var m213 = lhs.rawData[2]; var m223 = lhs.rawData[6]; var m233 = lhs.rawData[10]; var m243 = lhs.rawData[14]; var m214 = lhs.rawData[3]; var m224 = lhs.rawData[7]; var m234 = lhs.rawData[11]; var m244 = lhs.rawData[15]; this.rawData[0] = m111 * m211 + m112 * m221 + m113 * m231 + m114 * m241; this.rawData[1] = m111 * m212 + m112 * m222 + m113 * m232 + m114 * m242; this.rawData[2] = m111 * m213 + m112 * m223 + m113 * m233 + m114 * m243; this.rawData[3] = m111 * m214 + m112 * m224 + m113 * m234 + m114 * m244; this.rawData[4] = m121 * m211 + m122 * m221 + m123 * m231 + m124 * m241; this.rawData[5] = m121 * m212 + m122 * m222 + m123 * m232 + m124 * m242; this.rawData[6] = m121 * m213 + m122 * m223 + m123 * m233 + m124 * m243; this.rawData[7] = m121 * m214 + m122 * m224 + m123 * m234 + m124 * m244; this.rawData[8] = m131 * m211 + m132 * m221 + m133 * m231 + m134 * m241; this.rawData[9] = m131 * m212 + m132 * m222 + m133 * m232 + m134 * m242; this.rawData[10] = m131 * m213 + m132 * m223 + m133 * m233 + m134 * m243; this.rawData[11] = m131 * m214 + m132 * m224 + m133 * m234 + m134 * m244; this.rawData[12] = m141 * m211 + m142 * m221 + m143 * m231 + m144 * m241; this.rawData[13] = m141 * m212 + m142 * m222 + m143 * m232 + m144 * m242; this.rawData[14] = m141 * m213 + m142 * m223 + m143 * m233 + m144 * m243; this.rawData[15] = m141 * m214 + m142 * m224 + m143 * m234 + m144 * m244; } appendRotation(degrees, axis, pivotPoint = null) { var m = _Matrix3D.getAxisRotation(axis.x, axis.y, axis.z, degrees); if (pivotPoint != null) { var p = pivotPoint; m.appendTranslation(p.x, p.y, p.z); } this.append(m); } appendScale(xScale, yScale, zScale) { this.rawData[0] *= xScale; this.rawData[1] *= xScale; this.rawData[2] *= xScale; this.rawData[3] *= xScale; this.rawData[4] *= yScale; this.rawData[5] *= yScale; this.rawData[6] *= yScale; this.rawData[7] *= yScale; this.rawData[8] *= zScale; this.rawData[9] *= zScale; this.rawData[10] *= zScale; this.rawData[11] *= zScale; } appendTranslation(x, y, z) { this.rawData[12] += x; this.rawData[13] += y; this.rawData[14] += z; } clone() { return new _Matrix3D(this.rawData.concat()); } copyColumnFrom(column, vector3D) { switch (column) { case 0: { this.rawData[0] = vector3D.x; this.rawData[1] = vector3D.y; this.rawData[2] = vector3D.z; this.rawData[3] = vector3D.w; } break; case 1: { this.rawData[4] = vector3D.x; this.rawData[5] = vector3D.y; this.rawData[6] = vector3D.z; this.rawData[7] = vector3D.w; } break; case 2: { this.rawData[8] = vector3D.x; this.rawData[9] = vector3D.y; this.rawData[10] = vector3D.z; this.rawData[11] = vector3D.w; } break; case 3: { this.rawData[12] = vector3D.x; this.rawData[13] = vector3D.y; this.rawData[14] = vector3D.z; this.rawData[15] = vector3D.w; } break; default: throw new Error("Error, Column " + column + " out of bounds [0, ..., 3]"); } } copyColumnTo(column, vector3D) { var c4 = column * 4; vector3D.x = this.rawData[c4]; vector3D.y = this.rawData[1 + c4]; vector3D.z = this.rawData[2 + c4]; vector3D.w = this.rawData[3 + c4]; } copyFrom(other) { this.rawData = other.rawData.concat(); } copyRawDataFrom(vector, index = 0, transpose = false) { if (transpose) this.transpose(); var l = vector.length - index; { var _g = 0; while (_g < Number(l)) { var c = _g++; this.rawData[c] = vector[c + index]; } } if (transpose) this.transpose(); } copyRawDataTo(vector, index = 0, transpose = false) { if (transpose) this.transpose(); var l = this.rawData.length; { var _g = 0; while (_g < l) { var c = _g++; vector[c + index] = this.rawData[c]; } } if (transpose) this.transpose(); } copyRowFrom(row, vector3D) { switch (row) { case 0: { this.rawData[0] = vector3D.x; this.rawData[4] = vector3D.y; this.rawData[8] = vector3D.z; this.rawData[12] = vector3D.w; } break; case 1: { this.rawData[1] = vector3D.x; this.rawData[5] = vector3D.y; this.rawData[9] = vector3D.z; this.rawData[13] = vector3D.w; } break; case 2: { this.rawData[2] = vector3D.x; this.rawData[6] = vector3D.y; this.rawData[10] = vector3D.z; this.rawData[14] = vector3D.w; } break; case 3: { this.rawData[3] = vector3D.x; this.rawData[7] = vector3D.y; this.rawData[11] = vector3D.z; this.rawData[15] = vector3D.w; } break; default: throw new Error("Error, Row " + ("" + row) + " out of bounds [0, ..., 3]"); } } copyRowTo(row, vector3D) { vector3D.x = this.rawData[row]; vector3D.y = this.rawData[4 + row]; vector3D.z = this.rawData[8 + row]; vector3D.w = this.rawData[12 + row]; } copyToMatrix3D(other) { other.rawData = this.rawData.concat(); } decompose(orientationStyle = null) { if (orientationStyle == null) orientationStyle = Orientation3D.EULER_ANGLES; var vec = []; var m = this.clone(); var mr = m.rawData.concat(); var pos = new Vector3D(mr[12], mr[13], mr[14]); var scale = new Vector3D(); scale.x = Math.sqrt(mr[0] * mr[0] + mr[1] * mr[1] + mr[2] * mr[2]); scale.y = Math.sqrt(mr[4] * mr[4] + mr[5] * mr[5] + mr[6] * mr[6]); scale.z = Math.sqrt(mr[8] * mr[8] + mr[9] * mr[9] + mr[10] * mr[10]); if (mr[0] * (mr[5] * mr[10] - mr[6] * mr[9]) - mr[1] * (mr[4] * mr[10] - mr[6] * mr[8]) + mr[2] * (mr[4] * mr[9] - mr[5] * mr[8]) < 0) scale.z = -scale.z; mr[0] /= scale.x; mr[1] /= scale.x; mr[2] /= scale.x; mr[4] /= scale.y; mr[5] /= scale.y; mr[6] /= scale.y; mr[8] /= scale.z; mr[9] /= scale.z; mr[10] /= scale.z; var rot = new Vector3D(); switch (orientationStyle) { case Orientation3D.AXIS_ANGLE: { rot.w = Math.acos((mr[0] + mr[5] + mr[10] - 1) / 2); var len = Math.sqrt((mr[6] - mr[9]) * (mr[6] - mr[9]) + (mr[8] - mr[2]) * (mr[8] - mr[2]) + (mr[1] - mr[4]) * (mr[1] - mr[4])); if (len != 0) { rot.x = (mr[6] - mr[9]) / len; rot.y = (mr[8] - mr[2]) / len; rot.z = (mr[1] - mr[4]) / len; } else rot.x = rot.y = rot.z = 0; } break; case Orientation3D.QUATERNION: { var tr = mr[0] + mr[5] + mr[10]; if (tr > 0) { rot.w = Math.sqrt(1 + tr) / 2; rot.x = (mr[6] - mr[9]) / (4 * rot.w); rot.y = (mr[8] - mr[2]) / (4 * rot.w); rot.z = (mr[1] - mr[4]) / (4 * rot.w); } else if (mr[0] > mr[5] && mr[0] > mr[10]) { rot.x = Math.sqrt(1 + mr[0] - mr[5] - mr[10]) / 2; rot.w = (mr[6] - mr[9]) / (4 * rot.x); rot.y = (mr[1] + mr[4]) / (4 * rot.x); rot.z = (mr[8] + mr[2]) / (4 * rot.x); } else if (mr[5] > mr[10]) { rot.y = Math.sqrt(1 + mr[5] - mr[0] - mr[10]) / 2; rot.x = (mr[1] + mr[4]) / (4 * rot.y); rot.w = (mr[8] - mr[2]) / (4 * rot.y); rot.z = (mr[6] + mr[9]) / (4 * rot.y); } else { rot.z = Math.sqrt(1 + mr[10] - mr[0] - mr[5]) / 2; rot.x = (mr[8] + mr[2]) / (4 * rot.z); rot.y = (mr[6] + mr[9]) / (4 * rot.z); rot.w = (mr[1] - mr[4]) / (4 * rot.z); } } break; case Orientation3D.EULER_ANGLES: { rot.y = Math.asin(-mr[2]); if (mr[2] != 1 && mr[2] != -1) { rot.x = Math.atan2(mr[6], mr[10]); rot.z = Math.atan2(mr[1], mr[0]); } else { rot.z = 0; rot.x = Math.atan2(mr[4], mr[5]); } } break; } vec.push(pos); vec.push(rot); vec.push(scale); return vec; } deltaTransformVector(v) { var x = v.x; var y = v.y; var z = v.z; return new Vector3D(x * this.rawData[0] + y * this.rawData[4] + z * this.rawData[8] + this.rawData[3], x * this.rawData[1] + y * this.rawData[5] + z * this.rawData[9] + this.rawData[7], x * this.rawData[2] + y * this.rawData[6] + z * this.rawData[10] + this.rawData[11], 0); } identity() { this.rawData[0] = 1; this.rawData[1] = 0; this.rawData[2] = 0; this.rawData[3] = 0; this.rawData[4] = 0; this.rawData[5] = 1; this.rawData[6] = 0; this.rawData[7] = 0; this.rawData[8] = 0; this.rawData[9] = 0; this.rawData[10] = 1; this.rawData[11] = 0; this.rawData[12] = 0; this.rawData[13] = 0; this.rawData[14] = 0; this.rawData[15] = 1; } interpolateTo(toMat, percent) { var _g = 0; while (_g < 16) { var i = _g++; this.rawData[i] = this.rawData[i] + (toMat.rawData[i] - this.rawData[i]) * percent; } } invert() { var d = this.determinant; var invertable = Math.abs(d) > 1e-11; if (invertable) { d = 1 / d; var m11 = this.rawData[0]; var m21 = this.rawData[4]; var m31 = this.rawData[8]; var m41 = this.rawData[12]; var m12 = this.rawData[1]; var m22 = this.rawData[5]; var m32 = this.rawData[9]; var m42 = this.rawData[13]; var m13 = this.rawData[2]; var m23 = this.rawData[6]; var m33 = this.rawData[10]; var m43 = this.rawData[14]; var m14 = this.rawData[3]; var m24 = this.rawData[7]; var m34 = this.rawData[11]; var m44 = this.rawData[15]; this.rawData[0] = d * (m22 * (m33 * m44 - m43 * m34) - m32 * (m23 * m44 - m43 * m24) + m42 * (m23 * m34 - m33 * m24)); this.rawData[1] = -d * (m12 * (m33 * m44 - m43 * m34) - m32 * (m13 * m44 - m43 * m14) + m42 * (m13 * m34 - m33 * m14)); this.rawData[2] = d * (m12 * (m23 * m44 - m43 * m24) - m22 * (m13 * m44 - m43 * m14) + m42 * (m13 * m24 - m23 * m14)); this.rawData[3] = -d * (m12 * (m23 * m34 - m33 * m24) - m22 * (m13 * m34 - m33 * m14) + m32 * (m13 * m24 - m23 * m14)); this.rawData[4] = -d * (m21 * (m33 * m44 - m43 * m34) - m31 * (m23 * m44 - m43 * m24) + m41 * (m23 * m34 - m33 * m24)); this.rawData[5] = d * (m11 * (m33 * m44 - m43 * m34) - m31 * (m13 * m44 - m43 * m14) + m41 * (m13 * m34 - m33 * m14)); this.rawData[6] = -d * (m11 * (m23 * m44 - m43 * m24) - m21 * (m13 * m44 - m43 * m14) + m41 * (m13 * m24 - m23 * m14)); this.rawData[7] = d * (m11 * (m23 * m34 - m33 * m24) - m21 * (m13 * m34 - m33 * m14) + m31 * (m13 * m24 - m23 * m14)); this.rawData[8] = d * (m21 * (m32 * m44 - m42 * m34) - m31 * (m22 * m44 - m42 * m24) + m41 * (m22 * m34 - m32 * m24)); this.rawData[9] = -d * (m11 * (m32 * m44 - m42 * m34) - m31 * (m12 * m44 - m42 * m14) + m41 * (m12 * m34 - m32 * m14)); this.rawData[10] = d * (m11 * (m22 * m44 - m42 * m24) - m21 * (m12 * m44 - m42 * m14) + m41 * (m12 * m24 - m22 * m14)); this.rawData[11] = -d * (m11 * (m22 * m34 - m32 * m24) - m21 * (m12 * m34 - m32 * m14) + m31 * (m12 * m24 - m22 * m14)); this.rawData[12] = -d * (m21 * (m32 * m43 - m42 * m33) - m31 * (m22 * m43 - m42 * m23) + m41 * (m22 * m33 - m32 * m23)); this.rawData[13] = d * (m11 * (m32 * m43 - m42 * m33) - m31 * (m12 * m43 - m42 * m13) + m41 * (m12 * m33 - m32 * m13)); this.rawData[14] = -d * (m11 * (m22 * m43 - m42 * m23) - m21 * (m12 * m43 - m42 * m13) + m41 * (m12 * m23 - m22 * m13)); this.rawData[15] = d * (m11 * (m22 * m33 - m32 * m23) - m21 * (m12 * m33 - m32 * m13) + m31 * (m12 * m23 - m22 * m13)); } return invertable; } pointAt(pos, at = null, up = null) { if (at == null) at = new Vector3D(0, 0, -1); if (up == null) up = new Vector3D(0, -1, 0); var dir = at.subtract(pos); var vup = up.clone(); var right; dir.normalize(); vup.normalize(); var dir2 = dir.clone(); dir2.scaleBy(vup.dotProduct(dir)); vup = vup.subtract(dir2); if (vup.length > 0) vup.normalize(); else if (dir.x != 0) vup = new Vector3D(-dir.y, dir.x, 0); else vup = new Vector3D(1, 0, 0); right = vup.crossProduct(dir); right.normalize(); this.rawData[0] = right.x; this.rawData[4] = right.y; this.rawData[8] = right.z; this.rawData[12] = 0; this.rawData[1] = vup.x; this.rawData[5] = vup.y; this.rawData[9] = vup.z; this.rawData[13] = 0; this.rawData[2] = dir.x; this.rawData[6] = dir.y; this.rawData[10] = dir.z; this.rawData[14] = 0; this.rawData[3] = pos.x; this.rawData[7] = pos.y; this.rawData[11] = pos.z; this.rawData[15] = 1; } prepend(rhs) { var m111 = rhs.rawData[0]; var m121 = rhs.rawData[4]; var m131 = rhs.rawData[8]; var m141 = rhs.rawData[12]; var m112 = rhs.rawData[1]; var m122 = rhs.rawData[5]; var m132 = rhs.rawData[9]; var m142 = rhs.rawData[13]; var m113 = rhs.rawData[2]; var m123 = rhs.rawData[6]; var m133 = rhs.rawData[10]; var m143 = rhs.rawData[14]; var m114 = rhs.rawData[3]; var m124 = rhs.rawData[7]; var m134 = rhs.rawData[11]; var m144 = rhs.rawData[15]; var m211 = this.rawData[0]; var m221 = this.rawData[4]; var m231 = this.rawData[8]; var m241 = this.rawData[12]; var m212 = this.rawData[1]; var m222 = this.rawData[5]; var m232 = this.rawData[9]; var m242 = this.rawData[13]; var m213 = this.rawData[2]; var m223 = this.rawData[6]; var m233 = this.rawData[10]; var m243 = this.rawData[14]; var m214 = this.rawData[3]; var m224 = this.rawData[7]; var m234 = this.rawData[11]; var m244 = this.rawData[15]; this.rawData[0] = m111 * m211 + m112 * m221 + m113 * m231 + m114 * m241; this.rawData[1] = m111 * m212 + m112 * m222 + m113 * m232 + m114 * m242; this.rawData[2] = m111 * m213 + m112 * m223 + m113 * m233 + m114 * m243; this.rawData[3] = m111 * m214 + m112 * m224 + m113 * m234 + m114 * m244; this.rawData[4] = m121 * m211 + m122 * m221 + m123 * m231 + m124 * m241; this.rawData[5] = m121 * m212 + m122 * m222 + m123 * m232 + m124 * m242; this.rawData[6] = m121 * m213 + m122 * m223 + m123 * m233 + m124 * m243; this.rawData[7] = m121 * m214 + m122 * m224 + m123 * m234 + m124 * m244; this.rawData[8] = m131 * m211 + m132 * m221 + m133 * m231 + m134 * m241; this.rawData[9] = m131 * m212 + m132 * m222 + m133 * m232 + m134 * m242; this.rawData[10] = m131 * m213 + m132 * m223 + m133 * m233 + m134 * m243; this.rawData[11] = m131 * m214 + m132 * m224 + m133 * m234 + m134 * m244; this.rawData[12] = m141 * m211 + m142 * m221 + m143 * m231 + m144 * m241; this.rawData[13] = m141 * m212 + m142 * m222 + m143 * m232 + m144 * m242; this.rawData[14] = m141 * m213 + m142 * m223 + m143 * m233 + m144 * m243; this.rawData[15] = m141 * m214 + m142 * m224 + m143 * m234 + m144 * m244; } prependRotation(degrees, axis, pivotPoint = null) { var m = _Matrix3D.getAxisRotation(axis.x, axis.y, axis.z, degrees); if (pivotPoint != null) { var p = pivotPoint; m.appendTranslation(p.x, p.y, p.z); } this.prepend(m); } prependScale(xScale, yScale, zScale) { this.rawData[0] *= xScale; this.rawData[1] *= yScale; this.rawData[2] *= zScale; this.rawData[4] *= xScale; this.rawData[5] *= yScale; this.rawData[6] *= zScale; this.rawData[8] *= xScale; this.rawData[9] *= yScale; this.rawData[10] *= zScale; this.rawData[12] *= xScale; this.rawData[13] *= yScale; this.rawData[14] *= zScale; } prependTranslation(x, y, z) { var m = _Matrix3D.TEMP; m.identity(); m.position = new Vector3D(x, y, z); this.prepend(m); } recompose(components, orientationStyle = null) { if (components.length < 3 || components[2].x == 0 || components[2].y == 0 || components[2].z == 0) return false; if (orientationStyle == null) orientationStyle = Orientation3D.EULER_ANGLES; this.identity(); var scale = []; scale[0] = scale[1] = scale[2] = components[2].x; scale[4] = scale[5] = scale[6] = components[2].y; scale[8] = scale[9] = scale[10] = components[2].z; switch (orientationStyle) { case Orientation3D.EULER_ANGLES: { var cx = Math.cos(components[1].x); var cy = Math.cos(components[1].y); var cz = Math.cos(components[1].z); var sx = Math.sin(components[1].x); var sy = Math.sin(components[1].y); var sz = Math.sin(components[1].z); this.rawData[0] = cy * cz * scale[0]; this.rawData[1] = cy * sz * scale[1]; this.rawData[2] = -sy * scale[2]; this.rawData[3] = 0; this.rawData[4] = (sx * sy * cz - cx * sz) * scale[4]; this.rawData[5] = (sx * sy * sz + cx * cz) * scale[5]; this.rawData[6] = sx * cy * scale[6]; this.rawData[7] = 0; this.rawData[8] = (cx * sy * cz + sx * sz) * scale[8]; this.rawData[9] = (cx * sy * sz - sx * cz) * scale[9]; this.rawData[10] = cx * cy * scale[10]; this.rawData[11] = 0; this.rawData[12] = components[0].x; this.rawData[13] = components[0].y; this.rawData[14] = components[0].z; this.rawData[15] = 1; } break; default: { var x = components[1].x; var y = components[1].y; var z = components[1].z; var w = components[1].w; if (orientationStyle == Orientation3D.AXIS_ANGLE) { x *= Math.sin(w / 2); y *= Math.sin(w / 2); z *= Math.sin(w / 2); w = Math.cos(w / 2); } this.rawData[0] = (1 - 2 * y * y - 2 * z * z) * scale[0]; this.rawData[1] = (2 * x * y + 2 * w * z) * scale[1]; this.rawData[2] = (2 * x * z - 2 * w * y) * scale[2]; this.rawData[3] = 0; this.rawData[4] = (2 * x * y - 2 * w * z) * scale[4]; this.rawData[5] = (1 - 2 * x * x - 2 * z * z) * scale[5]; this.rawData[6] = (2 * y * z + 2 * w * x) * scale[6]; this.rawData[7] = 0; this.rawData[8] = (2 * x * z + 2 * w * y) * scale[8]; this.rawData[9] = (2 * y * z - 2 * w * x) * scale[9]; this.rawData[10] = (1 - 2 * x * x - 2 * y * y) * scale[10]; this.rawData[11] = 0; this.rawData[12] = components[0].x; this.rawData[13] = components[0].y; this.rawData[14] = components[0].z; this.rawData[15] = 1; } break; } if (components[2].x === 0) this.rawData[0] = 1e-15; if (components[2].y === 0) this.rawData[5] = 1e-15; if (components[2].z === 0) this.rawData[10] = 1e-15; return !(components[2].x === 0 || components[2].y === 0 || components[2].y === 0); } transformVector(v) { var x = v.x; var y = v.y; var z = v.z; return new Vector3D(x * this.rawData[0] + y * this.rawData[4] + z * this.rawData[8] + this.rawData[12], x * this.rawData[1] + y * this.rawData[5] + z * this.rawData[9] + this.rawData[13], x * this.rawData[2] + y * this.rawData[6] + z * this.rawData[10] + this.rawData[14], x * this.rawData[3] + y * this.rawData[7] + z * this.rawData[11] + this.rawData[15]); } transformVectors(vin, vout) { var i = 0; while (i + 3 <= vin.length) { var x = vin[i]; var y = vin[i + 1]; var z = vin[i + 2]; vout[i] = x * this.rawData[0] + y * this.rawData[4] + z * this.rawData[8] + this.rawData[12]; vout[i + 1] = x * this.rawData[1] + y * this.rawData[5] + z * this.rawData[9] + this.rawData[13]; vout[i + 2] = x * this.rawData[2] + y * this.rawData[6] + z * this.rawData[10] + this.rawData[14]; i += 3; } } transpose() { var oRawData = this.rawData.concat(); this.rawData[1] = oRawData[4]; this.rawData[2] = oRawData[8]; this.rawData[3] = oRawData[12]; this.rawData[4] = oRawData[1]; this.rawData[6] = oRawData[9]; this.rawData[7] = oRawData[13]; this.rawData[8] = oRawData[2]; this.rawData[9] = oRawData[6]; this.rawData[11] = oRawData[14]; this.rawData[12] = oRawData[3]; this.rawData[13] = oRawData[7]; this.rawData[14] = oRawData[11]; } static interpolate(thisMat, toMat, percent) { var m = new _Matrix3D(); { var _g = 0; while (_g < 16) { var i = _g++; m.rawData[i] = thisMat.rawData[i] + (toMat.rawData[i] - thisMat.rawData[i]) * percent; } } return m; } static getAxisRotation(x, y, z, degrees, target = null) { var m = target || new _Matrix3D(); var rad = -degrees * (Math.PI / 180); var c = Math.cos(rad); var s = Math.sin(rad); var t = 1 - c; m.rawData[0] = c + x * x * t; m.rawData[5] = c + y * y * t; m.rawData[10] = c + z * z * t; var tmp1 = x * y * t; var tmp2 = z * s; m.rawData[4] = tmp1 + tmp2; m.rawData[1] = tmp1 - tmp2; tmp1 = x * z * t; tmp2 = y * s; m.rawData[8] = tmp1 - tmp2; m.rawData[2] = tmp1 + tmp2; tmp1 = y * z * t; tmp2 = x * s; m.rawData[9] = tmp1 + tmp2; m.rawData[6] = tmp1 - tmp2; return m; } }; let Matrix3D = _Matrix3D; __publicField(Matrix3D, "TEMP", new _Matrix3D()); class PerspectiveMatrix3D extends Matrix3D { constructor(v = null) { super(v); __publicField(this, "lookAtLH", (eye, at, up) => { this._z.copyFrom(at); this._z.subtract(eye); this._z.normalize(); this._z.w = 0; this._x.copyFrom(up); this._crossProductTo(this._x, this._z); this._x.normalize(); this._x.w = 0; this._y.copyFrom(this._z); this._crossProductTo(this._y, this._x); this._y.w = 0; this._w.x = this._x.dotProduct(eye); this._w.y = this._y.dotProduct(eye); this._w.z = this._z.dotProduct(eye); this._w.w = 1; this.copyRowFrom(0, this._x); this.copyRowFrom(1, this._y); this.copyRowFrom(2, this._z); this.copyRowFrom(3, this._w); }); __publicField(this, "lookAtRH", (eye, at, up) => { this._z.copyFrom(eye); this._z.subtract(at); this._z.normalize(); this._z.w = 0; this._x.copyFrom(up); this._crossProductTo(this._x, this._z); this._x.normalize(); this._x.w = 0; this._y.copyFrom(this._z); this._crossProductTo(this._y, this._x); this._y.w = 0; this._w.x = this._x.dotProduct(eye); this._w.y = this._y.dotProduct(eye); this._w.z = this._z.dotProduct(eye); this._w.w = 1; this.copyRowFrom(0, this._x); this.copyRowFrom(1, this._y); this.copyRowFrom(2, this._z); this.copyRowFrom(3, this._w); }); __publicField(this, "perspectiveLH", (width, height, zNear, zFar) => { this.copyRawDataFrom([ 2 * zNear / width, 0, 0, 0, 0, 2 * zNear / height, 0, 0, 0, 0, zFar / (zFar - zNear), 1, 0, 0, zNear * zFar / (zNear - zFar), 0 ]); }); __publicField(this, "perspectiveRH", (width, height, zNear, zFar) => { this.copyRawDataFrom([ 2 * zNear / width, 0, 0, 0, 0, 2 * zNear / height, 0, 0, 0, 0, zFar / (zNear - zFar), -1, 0, 0, zNear * zFar / (zNear - zFar), 0 ]); }); __publicField(this, "perspectiveFieldOfViewLH", (fieldOfViewY, aspectRatio, zNear, zFar) => { var yScale = 1 / Math.tan(fieldOfViewY / 2); var xScale = yScale / aspectRatio; this.copyRawDataFrom([ xScale, 0, 0, 0, 0, yScale, 0, 0, 0, 0, zFar / (zFar - zNear), 1, 0, 0, zNear * zFar / (zNear - zFar), 0 ]); }); __publicField(this, "perspectiveFieldOfViewRH", (fieldOfViewY, aspectRatio, zNear, zFar) => { var yScale = 1 / Math.tan(fieldOfViewY / 2); var xScale = yScale / aspectRatio; this.copyRawDataFrom([ xScale, 0, 0, 0, 0, yScale, 0, 0, 0, 0, zFar / (zNear - zFar), -1, 0, 0, zNear * zFar / (zNear - zFar), 0 ]); }); __publicField(this, "perspectiveOffCenterLH", (left, right, bottom, top, zNear, zFar) => { this.copyRawDataFrom([ 2 * zNear / (right - left), 0, 0, 0, 0, -2 * zNear / (bottom - top), 0, 0, -1 - 2 * left / (right - left), 1 + 2 * top / (bottom - top), -zFar / (zNear - zFar), 1, 0, 0, zNear * zFar / (zNear - zFar), 0 ]); }); __publicField(this, "perspectiveOffCenterRH", (left, right, bottom, top, zNear, zFar) => { this.copyRawDataFrom([ 2 * zNear / (right - left), 0, 0, 0, 0, -2 * zNear / (bottom - top), 0, 0, 1 + 2 * left / (right - left), -1 - 2 * top / (bottom - top), zFar / (zNear - zFar), -1, 0, 0, zNear * zFar / (zNear - zFar), 0 ]); }); __publicField(this, "orthoLH", (width, height, zNear, zFar) => { this.copyRawDataFrom([ 2 / width, 0, 0, 0, 0, 2 / height, 0, 0, 0, 0, 1 / (zFar - zNear), 0, 0, 0, zNear / (zNear - zFar), 1 ]); }); __publicField(this, "orthoRH", (width, height, zNear, zFar) => { this.copyRawDataFrom([ 2 / width, 0, 0, 0, 0, 2 / height, 0, 0, 0, 0, 1 / (zNear - zNear), 0, 0, 0, zNear / (zNear - zFar), 1 ]); }); __publicField(this, "orthoOffCenterLH", (left, right, bottom, top, zNear, zFar) => { this.copyRawDataFrom([ 2 / (right - left), 0, 0, 0, 0, 2 * zNear / (top - bottom), 0, 0, -1 - 2 * left / (right - left), 1 + 2 * top / (bottom - top), 1 / (zFar - zNear), 0, 0, 0, zNear / (zNear - zFar), 1 ]); }); __publicField(this, "orthoOffCenterRH", (left, right, bottom, top, zNear, zFar) => { this.copyRawDataFrom([ 2 / (right - left), 0, 0, 0, 0, 2 * zNear / (top - bottom), 0, 0, -1 - 2 * left / (right - left), 1 + 2 * top / (bottom - top), 1 / (zNear - zFar), 0, 0, 0, zNear / (zNear - zFar), 1 ]); }); __publicField(this, "_x", new Vector3D()); __publicField(this, "_y", new Vector3D()); __publicField(this, "_z", new Vector3D()); __publicField(this, "_w", new Vector3D()); __publicField(this, "_crossProductTo", (a, b) => { this._w.x = a.y * b.z - a.z * b.y; this._w.y = a.z * b.x - a.x * b.z; this._w.z = a.x * b.y - a.y * b.x; this._w.w = 1; a.copyFrom(this._w); }); } } class FPConfig { } __publicField(FPConfig, "stageWidth", 800); __publicField(FPConfig, "stageHeight", 600); __publicField(FPConfig, "autoSize", false); __publicField(FPConfig, "startTime", 0); __publicField(FPConfig, "drawCounter"); __publicField(FPConfig, "batDrawCounter"); __publicField(FPConfig, "debug", false); __publicField(FPConfig, "rootHTMLElement"); __publicField(FPConfig, "renderer"); __publicField(FPConfig, "canvasKit"); __publicField(FPConfig, "dirtyGraphics", true); __publicField(FPConfig, "highDPI", false); __publicField(FPConfig, "images", {}); __publicField(FPConfig, "sounds", {}); __publicField(FPConfig, "videos", {}); __publicField(FPConfig, "fonts", {}); __publicField(FPConfig, "requestAnimationFrame", window["requestAnimationFrame"] || window["webkitRequestAnimationFrame"] || window["mozRequestAnimationFrame"] || window["oRequestAnimationFrame"] || window["msRequestAnimationFrame"] || function(callback) { window["setTimeout"](callback, 1e3 / 60); }); class ColorTransform extends Object { constructor(redMultiplier = 1, greenMultiplier = 1, blueMultiplier = 1, alphaMultiplier = 1, redOffset = 0, greenOffset = 0, blueOffset = 0, alphaOffset = 0) { super(); __publicField(this, "_hexColor"); __publicField(this, "_redMultiplier"); __publicField(this, "_greenMultiplier"); __publicField(this, "_blueMultiplier"); __publicField(this, "_alphaMultiplier"); __publicField(this, "_rgba"); __publicField(this, "redOffset"); __publicField(this, "greenOffset"); __publicField(this, "blueOffset"); __publicField(this, "alphaOffset"); __publicField(this, "tint", 4294967295); __publicField(this, "updateRGBA", () => { this._rgba = FPConfig.canvasKit.Color( this.color >> 16 & 255, this.color >> 8 & 255, this.color & 255, this.alphaOffset ); }); this.redMultiplier = redMultiplier; this.greenMultiplier = greenMultiplier; this.blueMultiplier = blueMultiplier; this.alphaMultiplier = alphaMultiplier; this.redOffset = redOffset; this.greenOffset = greenOffset; this.blueOffset = blueOffset; this.alphaOffset = alphaOffset; this.updateRGBA(); } get color() { return this.redOffset << 16 | this.greenOffset << 8 | this.blueOffset; } set color(newColor) { this.redMultiplier = this.greenMultiplier = this.blueMultiplier = 0; this.redOffset = newColor >> 16 & 255; this.greenOffset = newColor >> 8 & 255; this.blueOffset = newColor & 255; this.updateRGBA(); } get rgba() { return this._rgba; } get redMultiplier() { return this._redMultiplier; } set redMultiplier(value) { this._redMultiplier = value; this.tint = this._redMultiplier * 255 << 0 | this._greenMultiplier * 255 << 8 | this._blueMultiplier * 255 << 16 | this._alphaMultiplier * 255 << 24; this.updateRGBA(); } get greenMultiplier() { return this._greenMultiplier; } set greenMultiplier(value) { this._greenMultiplier = value; this.tint = this._redMultiplier * 255 << 0 | this._greenMultiplier * 255 << 8 | this._blueMultiplier * 255 << 16 | this._alphaMultiplier * 255 << 24; this.updateRGBA(); } get blueMultiplier() { return this._blueMultiplier; } set blueMultiplier(value) { this._blueMultiplier = value; this.tint = this._redMultiplier * 255 << 0 | this._greenMultiplier * 255 << 8 | this._blueMultiplier * 255 << 16 | this._alphaMultiplier * 255 << 24; this.updateRGBA(); } get alphaMultiplier() { return this._alphaMultiplier; } set alphaMultiplier(value) { this._alphaMultiplier = value; this.tint = this._redMultiplier * 255 << 0 | this._greenMultiplier * 255 << 8 | this._blueMultiplier * 255 << 16 | this._alphaMultiplier * 255 << 24; this.updateRGBA(); } concat(second) { this.alphaOffset = this.alphaOffset + this.alphaMultiplier * second.alphaOffset; this.alphaMultiplier = this.alphaMultiplier * second.alphaMultiplier; this.redOffset = this.redOffset + this.redMultiplier * second.redOffset; this.redMultiplier = this.redMultiplier * second.redMultiplier; this.greenOffset = this.greenOffset + this.greenMultiplier * second.greenOffset; this.greenMultiplier = this.greenMultiplier * second.greenMultiplier; this.blueOffset = this.blueOffset + this.blueMultiplier * second.blueOffset; this.blueMultiplier = this.blueMultiplier * second.blueMultiplier; this.updateRGBA(); } toString() { return "(redMultiplier=" + this.redMultiplier + ", greenMultiplier=" + this.greenMultiplier + ", blueMultiplier=" + this.blueMultiplier + ", alphaMultiplier=" + this.alphaMultiplier + ", redOffset=" + this.redOffset + ", greenOffset=" + this.greenOffset + ", blueOffset=" + this.blueOffset + ", alphaOffset=" + this.alphaOffset + ")"; } } class BitmapFilter extends Object { constructor() { super(); __publicField(this, "_offsetX", 0); __publicField(this, "_offsetY", 0); } _applyFilter(ctx, path, blurPaint, paragraphBuilder, textStyle, paraText) { return null; } clone() { return null; } get offsetX() { return this._offsetX; } get offsetY() { return this._offsetY; } } class ColorMatrixFilter extends BitmapFilter { get matrix() { return null; } set matrix(value) { } constructor(matrix = null) { super(); } } class AuxFunctions { } __publicField(AuxFunctions, "numberToR", (p_num) => { return (p_num & 16711680) >> 16; }); __publicField(AuxFunctions, "numberToG", (p_num) => { return (p_num & 65280) >> 8; }); __publicField(AuxFunctions, "numberToB", (p_num) => { return p_num & 255; }); __publicField(AuxFunctions, "getObjectLength", (p_object) => { var totalProperties = 0; for (let pName in p_object) totalProperties++; return totalProperties; }); __publicField(AuxFunctions, "concatObjects", (...args) => { var finalObject = {}; var currentObject; for (var i = 0; i < args.length; i++) { currentObject = args[i]; for (let prop in currentObject) { if (currentObject[prop] == null) { delete finalObject[prop]; } else { finalObject[prop] = currentObject[prop]; } } } return finalObject; }); const _TweenListObj = class { constructor(p_scope, p_timeStart, p_timeComplete, p_useFrames, p_transition, p_transitionParams) { __publicField(this, "scope"); __publicField(this, "properties"); __publicField(this, "timeStart"); __publicField(this, "timeComplete"); __publicField(this, "useFrames"); __publicField(this, "transition"); __publicField(this, "transitionParams"); __publicField(this, "onStart"); __publicField(this, "onUpdate"); __publicField(this, "onComplete"); __publicField(this, "onOverwrite"); __publicField(this, "onError"); __publicField(this, "onStartParams"); __publicField(this, "onUpdateParams"); __publicField(this, "onCompleteParams"); __publicField(this, "onOverwriteParams"); __publicField(this, "onStartScope"); __publicField(this, "onUpdateScope"); __publicField(this, "onCompleteScope"); __publicField(this, "onOverwriteScope"); __publicField(this, "onErrorScope"); __publicField(this, "rounded"); __publicField(this, "isPaused"); __publicField(this, "timePaused"); __publicField(this, "isCaller"); __publicField(this, "count"); __publicField(this, "timesCalled"); __publicField(this, "waitFrames"); __publicField(this, "skipUpdates"); __publicField(this, "updatesSkipped"); __publicField(this, "hasStarted"); __publicField(this, "isComplete"); __publicField(this, "clone", (omitEvents) => { var nTween = new _TweenListObj(this.scope, this.timeStart, this.timeComplete, this.useFrames, this.transition, this.transitionParams); nTween.properties = new Array(); for (var pName in this.properties) { nTween.properties[pName] = this.properties[pName].clone(); } nTween.skipUpdates = this.skipUpdates; nTween.updatesSkipped = this.updatesSkipped; if (!omitEvents) { nTween.onStart = this.onStart; nTween.onUpdate = this.onUpdate; nTween.onComplete = this.onComplete; nTween.onOverwrite = this.onOverwrite; nTween.onError = this.onError; nTween.onStartParams = this.onStartParams; nTween.onUpdateParams = this.onUpdateParams; nTween.onCompleteParams = this.onCompleteParams; nTween.onOverwriteParams = this.onOverwriteParams; nTween.onStartScope = this.onStartScope; nTween.onUpdateScope = this.onUpdateScope; nTween.onCompleteScope = this.onCompleteScope; nTween.onOverwriteScope = this.onOverwriteScope; nTween.onErrorScope = this.onErrorScope; } nTween.rounded = this.rounded; nTween.isPaused = this.isPaused; nTween.timePaused = this.timePaused; nTween.isCaller = this.isCaller; nTween.count = this.count; nTween.timesCalled = this.timesCalled; nTween.waitFrames = this.waitFrames; nTween.hasStarted = this.hasStarted; return nTween; }); __publicField(this, "toString", () => { var returnStr = "\n[TweenListObj "; returnStr += "scope:" + String(this.scope); returnStr += ", properties:"; var isFirst = true; for (var i in this.properties) { if (!isFirst) returnStr += ","; returnStr += "[name:" + this.properties[i].name; returnStr += ",valueStart:" + this.properties[i].valueStart; returnStr += ",valueComplete:" + this.properties[i].valueComplete; returnStr += "]"; isFirst = false; } returnStr += ", timeStart:" + String(this.timeStart); returnStr += ", timeComplete:" + String(this.timeComplete); returnStr += ", useFrames:" + String(this.useFrames); returnStr += ", transition:" + String(this.transition); returnStr += ", transitionParams:" + String(this.transitionParams); if (this.skipUpdates) returnStr += ", skipUpdates:" + String(this.skipUpdates); if (this.updatesSkipped) returnStr += ", updatesSkipped:" + String(this.updatesSkipped); if (Boolean(this.onStart)) returnStr += ", onStart:" + String(this.onStart); if (Boolean(this.onUpdate)) returnStr += ", onUpdate:" + String(this.onUpdate); if (Boolean(this.onComplete)) returnStr += ", onComplete:" + String(this.onComplete); if (Boolean(this.onOverwrite)) returnStr += ", onOverwrite:" + String(this.onOverwrite); if (Boolean(this.onError)) returnStr += ", onError:" + String(this.onError); if (this.onStartParams) returnStr += ", onStartParams:" + String(this.onStartParams); if (this.onUpdateParams) returnStr += ", onUpdateParams:" + String(this.onUpdateParams); if (this.onCompleteParams) returnStr += ", onCompleteParams:" + String(this.onCompleteParams); if (this.onOverwriteParams) returnStr += ", onOverwriteParams:" + String(this.onOverwriteParams); if (this.onStartScope) returnStr += ", onStartScope:" + String(this.onStartScope); if (this.onUpdateScope) returnStr += ", onUpdateScope:" + String(this.onUpdateScope); if (this.onCompleteScope) returnStr += ", onCompleteScope:" + String(this.onCompleteScope); if (this.onOverwriteScope) returnStr += ", onOverwriteScope:" + String(this.onOverwriteScope); if (this.onErrorScope) returnStr += ", onErrorScope:" + String(this.onErrorScope); if (this.rounded) returnStr += ", rounded:" + String(this.rounded); if (this.isPaused) returnStr += ", isPaused:" + String(this.isPaused); if (this.timePaused) returnStr += ", timePaused:" + String(this.timePaused); if (this.isCaller) returnStr += ", isCaller:" + String(this.isCaller); if (this.count) returnStr += ", count:" + String(this.count); if (this.timesCalled) returnStr += ", timesCalled:" + String(this.timesCalled); if (this.waitFrames) returnStr += ", waitFrames:" + String(this.waitFrames); if (this.hasStarted) returnStr += ", hasStarted:" + String(this.hasStarted); returnStr += "]\n"; return returnStr; }); this.scope = p_scope; this.timeStart = p_timeStart; this.timeComplete = p_timeComplete; this.useFrames = p_useFrames; this.transition = p_transition; this.transitionParams = p_transitionParams; this.properties = new Object(); this.isPaused = false; this.timePaused = void 0; this.isCaller = false; this.updatesSkipped = 0; this.timesCalled = 0; this.skipUpdates = 0; this.hasStarted = false; } }; let TweenListObj = _TweenListObj; __publicField(TweenListObj, "makePropertiesChain", (p_obj) => { var baseObject = p_obj.base; if (baseObject) { var chainedObject = {}; var chain; if (baseObject instanceof Array) { chain = []; for (var k = 0; k < baseObject.length; k++) chain.push(baseObject[k]); } else { chain = [baseObject]; } chain.push(p_obj); var currChainObj; var len = chain.length; for (var i = 0; i < len; i++) { if (chain[i]["base"]) { currChainObj = AuxFunctions.concatObjects(_TweenListObj.makePropertiesChain(chain[i]["base"]), chain[i]); } else { currChainObj = chain[i]; } chainedObject = AuxFunctions.concatObjects(chainedObject, currChainObj); } if (chainedObject["base"]) { delete chainedObject["base"]; } return chainedObject; } else { return p_obj; } }); class PropertyInfoObj { constructor(p_valueStart, p_valueComplete, p_originalValueComplete, p_arrayIndex, p_extra, p_isSpecialProperty, p_modifierFunction, p_modifierParameters) { __publicField(this, "valueStart"); __publicField(this, "valueComplete"); __publicField(this, "originalValueComplete"); __publicField(this, "arrayIndex"); __publicField(this, "extra"); __publicField(this, "isSpecialProperty"); __publicField(this, "hasModifier"); __publicField(this, "modifierFunction"); __publicField(this, "modifierParameters"); __publicField(this, "clone", () => { var nProperty = new PropertyInfoObj(this.valueStart, this.valueComplete, this.originalValueComplete, this.arrayIndex, this.extra, this.isSpecialProperty, this.modifierFunction, this.modifierParameters); return nProperty; }); __publicField(this, "toString", () => { var returnStr = "\n[PropertyInfoObj "; returnStr += "valueStart:" + String(this.valueStart); returnStr += ", "; returnStr += "valueComplete:" + String(this.valueComplete); returnStr += ", "; returnStr += "originalValueComplete:" + String(this.originalValueComplete); returnStr += ", "; returnStr += "arrayIndex:" + String(this.arrayIndex); returnStr += ", "; returnStr += "extra:" + String(this.extra); returnStr += ", "; returnStr += "isSpecialProperty:" + String(this.isSpecialProperty); returnStr += ", "; returnStr += "hasModifier:" + String(this.hasModifier); returnStr += ", "; returnStr += "modifierFunction:" + String(this.modifierFunction); returnStr += ", "; returnStr += "modifierParameters:" + String(this.modifierParameters); returnStr += "]\n"; return returnStr; }); this.valueStart = p_valueStart; this.valueComplete = p_valueComplete; this.originalValueComplete = p_originalValueComplete; this.arrayIndex = p_arrayIndex; this.extra = p_extra; this.isSpecialProperty = p_isSpecialProperty; this.hasModifier = Boolean(p_modifierFunction); this.modifierFunction = p_modifierFunction;