@galacean/engine-spine 1.0.0-test.4 → 1.0.0-test.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sources":["../node_modules/_@swc_helpers@0.5.1@@swc/helpers/esm/_create_class.js","../node_modules/_@swc_helpers@0.5.1@@swc/helpers/esm/_extends.js","../node_modules/_@swc_helpers@0.5.1@@swc/helpers/esm/_set_prototype_of.js","../node_modules/_@swc_helpers@0.5.1@@swc/helpers/esm/_inherits.js","../node_modules/_tslib@2.6.0@tslib/tslib.es6.js","../node_modules/_@swc_helpers@0.5.1@@swc/helpers/esm/_instanceof.js","../src/spine-core/Utils.ts","../src/spine-core/BoneData.ts","../src/spine-core/Bone.ts","../src/spine-core/PathConstraintData.ts","../src/spine-core/Slot.ts","../src/spine-core/IkConstraint.ts","../src/spine-core/TransformConstraint.ts","../src/spine-core/ConstraintData.ts","../src/spine-core/attachments/Attachment.ts","../node_modules/_@swc_helpers@0.5.1@@swc/helpers/esm/_assert_this_initialized.js","../src/spine-core/attachments/PathAttachment.ts","../src/spine-core/PathConstraint.ts","../src/spine-core/attachments/RegionAttachment.ts","../src/spine-core/Texture.ts","../src/spine-core/Animation.ts","../src/spine-core/TextureAtlas.ts","../src/spine-core/attachments/MeshAttachment.ts","../src/spine-core/Skeleton.ts","../src/spine-core/AnimationState.ts","../src/spine-core/AnimationStateData.ts","../src/spine-core/attachments/ClippingAttachment.ts","../src/spine-core/Triangulator.ts","../src/spine-core/SkeletonClipping.ts","../src/core/SpineMesh.ts","../src/core/MeshGenerator.ts","../src/SpineMaterial.ts","../src/SpineAnimation.ts","../node_modules/_@swc_helpers@0.5.1@@swc/helpers/esm/_array_like_to_array.js","../node_modules/_@swc_helpers@0.5.1@@swc/helpers/esm/_create_for_of_iterator_helper_loose.js","../node_modules/_@swc_helpers@0.5.1@@swc/helpers/esm/_unsupported_iterable_to_array.js","../src/spine-core/AssetManager.ts","../src/spine-core/BlendMode.ts","../src/spine-core/attachments/BoundingBoxAttachment.ts","../src/spine-core/attachments/PointAttachment.ts","../src/spine-core/AtlasAttachmentLoader.ts","../src/spine-core/SkeletonData.ts","../src/spine-core/SlotData.ts","../src/spine-core/IkConstraintData.ts","../src/spine-core/TransformConstraintData.ts","../src/spine-core/Skin.ts","../src/spine-core/EventData.ts","../src/spine-core/Event.ts","../src/spine-core/attachments/AttachmentType.ts","../src/spine-core/SkeletonJson.ts","../src/spine-core/SkeletonBinary.ts","../src/SpineLoader.ts","../src/AntGSpineLoader.ts","../src/index.ts"],"sourcesContent":["function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n\n if (\"value\" in descriptor) descriptor.writable = true;\n\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\nexport function _create_class(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n\n return Constructor;\n}\nexport { _create_class as _ };\n","export function _extends() {\n _extends = Object.assign || function assign(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\nexport { _extends as _ };\n","export function _set_prototype_of(o, p) {\n _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {\n o.__proto__ = p;\n\n return o;\n };\n\n return _set_prototype_of(o, p);\n}\nexport { _set_prototype_of as _ };\n","import { _set_prototype_of } from \"./_set_prototype_of.js\";\n\nexport function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });\n\n if (superClass) _set_prototype_of(subClass, superClass);\n}\nexport { _inherits as _ };\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\") throw new TypeError(\"Object expected.\");\r\n var dispose;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n function next() {\r\n while (env.stack.length) {\r\n var rec = env.stack.pop();\r\n try {\r\n var result = rec.dispose && rec.dispose.call(rec.value);\r\n if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport default {\r\n __extends,\r\n __assign,\r\n __rest,\r\n __decorate,\r\n __param,\r\n __metadata,\r\n __awaiter,\r\n __generator,\r\n __createBinding,\r\n __exportStar,\r\n __values,\r\n __read,\r\n __spread,\r\n __spreadArrays,\r\n __spreadArray,\r\n __await,\r\n __asyncGenerator,\r\n __asyncDelegator,\r\n __asyncValues,\r\n __makeTemplateObject,\r\n __importStar,\r\n __importDefault,\r\n __classPrivateFieldGet,\r\n __classPrivateFieldSet,\r\n __classPrivateFieldIn,\r\n __addDisposableResource,\r\n __disposeResources,\r\n};\r\n","export function _instanceof(left, right) {\n if (right != null && typeof Symbol !== \"undefined\" && right[Symbol.hasInstance]) {\n return !!right[Symbol.hasInstance](left);\n } else return left instanceof right;\n}\nexport { _instanceof as _ };\n","\r\n\r\nimport { MixBlend } from \"./Animation\";\r\nimport { Skeleton } from \"./Skeleton\";\r\n\r\n\r\nexport interface Map<T> {\r\n\t[key: string]: T;\r\n}\r\n\r\nexport class IntSet {\r\n\tarray = new Array<number>();\r\n\r\n\tadd (value: number): boolean {\r\n\t\tlet contains = this.contains(value);\r\n\t\tthis.array[value | 0] = value | 0;\r\n\t\treturn !contains;\r\n\t}\r\n\r\n\tcontains (value: number) {\r\n\t\treturn this.array[value | 0] != undefined;\r\n\t}\r\n\r\n\tremove (value: number) {\r\n\t\tthis.array[value | 0] = undefined;\r\n\t}\r\n\r\n\tclear () {\r\n\t\tthis.array.length = 0;\r\n\t}\r\n}\r\n\r\nexport interface Disposable {\r\n\tdispose (): void;\r\n}\r\n\r\nexport interface Restorable {\r\n\trestore (): void;\r\n}\r\n\r\nexport class Color {\r\n\tpublic static WHITE = new Color(1, 1, 1, 1);\r\n\tpublic static RED = new Color(1, 0, 0, 1);\r\n\tpublic static GREEN = new Color(0, 1, 0, 1);\r\n\tpublic static BLUE = new Color(0, 0, 1, 1);\r\n\tpublic static MAGENTA = new Color(1, 0, 1, 1);\r\n\r\n\tconstructor (public r: number = 0, public g: number = 0, public b: number = 0, public a: number = 0) {\r\n\t}\r\n\r\n\tset (r: number, g: number, b: number, a: number) {\r\n\t\tthis.r = r;\r\n\t\tthis.g = g;\r\n\t\tthis.b = b;\r\n\t\tthis.a = a;\r\n\t\tthis.clamp();\r\n\t\treturn this;\r\n\t}\r\n\r\n\tsetFromColor (c: Color) {\r\n\t\tthis.r = c.r;\r\n\t\tthis.g = c.g;\r\n\t\tthis.b = c.b;\r\n\t\tthis.a = c.a;\r\n\t\treturn this;\r\n\t}\r\n\r\n\tsetFromString (hex: string) {\r\n\t\thex = hex.charAt(0) == '#' ? hex.substr(1) : hex;\r\n\t\tthis.r = parseInt(hex.substr(0, 2), 16) / 255.0;\r\n\t\tthis.g = parseInt(hex.substr(2, 2), 16) / 255.0;\r\n\t\tthis.b = parseInt(hex.substr(4, 2), 16) / 255.0;\r\n\t\tthis.a = (hex.length != 8 ? 255 : parseInt(hex.substr(6, 2), 16)) / 255.0;\r\n\t\treturn this;\r\n\t}\r\n\r\n\tadd (r: number, g: number, b: number, a: number) {\r\n\t\tthis.r += r;\r\n\t\tthis.g += g;\r\n\t\tthis.b += b;\r\n\t\tthis.a += a;\r\n\t\tthis.clamp();\r\n\t\treturn this;\r\n\t}\r\n\r\n\tclamp () {\r\n\t\tif (this.r < 0) this.r = 0;\r\n\t\telse if (this.r > 1) this.r = 1;\r\n\r\n\t\tif (this.g < 0) this.g = 0;\r\n\t\telse if (this.g > 1) this.g = 1;\r\n\r\n\t\tif (this.b < 0) this.b = 0;\r\n\t\telse if (this.b > 1) this.b = 1;\r\n\r\n\t\tif (this.a < 0) this.a = 0;\r\n\t\telse if (this.a > 1) this.a = 1;\r\n\t\treturn this;\r\n\t}\r\n\r\n\tstatic rgba8888ToColor(color: Color, value: number) {\r\n\t\tcolor.r = ((value & 0xff000000) >>> 24) / 255;\r\n\t\tcolor.g = ((value & 0x00ff0000) >>> 16) / 255;\r\n\t\tcolor.b = ((value & 0x0000ff00) >>> 8) / 255;\r\n\t\tcolor.a = ((value & 0x000000ff)) / 255;\r\n\t}\r\n\r\n\tstatic rgb888ToColor (color: Color, value: number) {\r\n\t\tcolor.r = ((value & 0x00ff0000) >>> 16) / 255;\r\n\t\tcolor.g = ((value & 0x0000ff00) >>> 8) / 255;\r\n\t\tcolor.b = ((value & 0x000000ff)) / 255;\r\n\t}\r\n}\r\n\r\nexport class MathUtils {\r\n\tstatic PI = 3.1415927;\r\n\tstatic PI2 = MathUtils.PI * 2;\r\n\tstatic radiansToDegrees = 180 / MathUtils.PI;\r\n\tstatic radDeg = MathUtils.radiansToDegrees;\r\n\tstatic degreesToRadians = MathUtils.PI / 180;\r\n\tstatic degRad = MathUtils.degreesToRadians;\r\n\r\n\tstatic clamp (value: number, min: number, max: number) {\r\n\t\tif (value < min) return min;\r\n\t\tif (value > max) return max;\r\n\t\treturn value;\r\n\t}\r\n\r\n\tstatic cosDeg (degrees: number) {\r\n\t\treturn Math.cos(degrees * MathUtils.degRad);\r\n\t}\r\n\r\n\tstatic sinDeg (degrees: number) {\r\n\t\treturn Math.sin(degrees * MathUtils.degRad);\r\n\t}\r\n\r\n\tstatic signum (value: number): number {\r\n\t\treturn value > 0 ? 1 : value < 0 ? -1 : 0;\r\n\t}\r\n\r\n\tstatic toInt (x: number) {\r\n\t\treturn x > 0 ? Math.floor(x) : Math.ceil(x);\r\n\t}\r\n\r\n\tstatic cbrt (x: number) {\r\n\t\tlet y = Math.pow(Math.abs(x), 1/3);\r\n\t\treturn x < 0 ? -y : y;\r\n\t}\r\n\r\n\tstatic randomTriangular (min: number, max: number): number {\r\n\t\treturn MathUtils.randomTriangularWith(min, max, (min + max) * 0.5);\r\n\t}\r\n\r\n\tstatic randomTriangularWith (min: number, max: number, mode: number): number {\r\n\t\tlet u = Math.random();\r\n\t\tlet d = max - min;\r\n\t\tif (u <= (mode - min) / d) return min + Math.sqrt(u * d * (mode - min));\r\n\t\treturn max - Math.sqrt((1 - u) * d * (max - mode));\r\n\t}\r\n}\r\n\r\nexport abstract class Interpolation {\r\n\tprotected abstract applyInternal (a: number): number;\r\n\tapply(start: number, end: number, a: number): number {\r\n\t\treturn start + (end - start) * this.applyInternal(a);\r\n\t}\r\n}\r\n\r\nexport class Pow extends Interpolation {\r\n\tprotected power = 2;\r\n\r\n\tconstructor (power: number) {\r\n\t\tsuper();\r\n\t\tthis.power = power;\r\n\t}\r\n\r\n\tapplyInternal (a: number): number {\r\n\t\tif (a <= 0.5) return Math.pow(a * 2, this.power) / 2;\r\n\t\treturn Math.pow((a - 1) * 2, this.power) / (this.power % 2 == 0 ? -2 : 2) + 1;\r\n\t}\r\n}\r\n\r\nexport class PowOut extends Pow {\r\n\tconstructor (power: number) {\r\n\t\tsuper(power);\r\n\t}\r\n\r\n\tapplyInternal (a: number) : number {\r\n\t\treturn Math.pow(a - 1, this.power) * (this.power % 2 == 0 ? -1 : 1) + 1;\r\n\t}\r\n}\r\n\r\nexport class Utils {\r\n\tstatic SUPPORTS_TYPED_ARRAYS = typeof(Float32Array) !== \"undefined\";\r\n\r\n\tstatic arrayCopy<T> (source: ArrayLike<T>, sourceStart: number, dest: ArrayLike<T>, destStart: number, numElements: number) {\r\n\t\tfor (let i = sourceStart, j = destStart; i < sourceStart + numElements; i++, j++) {\r\n\t\t\tdest[j] = source[i];\r\n\t\t}\r\n\t}\r\n\r\n\tstatic setArraySize<T> (array: Array<T>, size: number, value: any = 0): Array<T> {\r\n\t\tlet oldSize = array.length;\r\n\t\tif (oldSize == size) return array;\r\n\t\tarray.length = size;\r\n\t\tif (oldSize < size) {\r\n\t\t\tfor (let i = oldSize; i < size; i++) array[i] = value;\r\n\t\t}\r\n\t\treturn array;\r\n\t}\r\n\r\n\tstatic ensureArrayCapacity<T> (array: Array<T>, size: number, value: any = 0): Array<T> {\r\n\t\tif (array.length >= size) return array;\r\n\t\treturn Utils.setArraySize(array, size, value);\r\n\t}\r\n\r\n\tstatic newArray<T> (size: number, defaultValue: T): Array<T> {\r\n\t\tlet array = new Array<T>(size);\r\n\t\tfor (let i = 0; i < size; i++) array[i] = defaultValue;\r\n\t\treturn array;\r\n\t}\r\n\r\n\tstatic newFloatArray (size: number): ArrayLike<number> {\r\n\t\tif (Utils.SUPPORTS_TYPED_ARRAYS) {\r\n\t\t\treturn new Float32Array(size)\r\n\t\t} else {\r\n\t\t\t\tlet array = new Array<number>(size);\r\n\t\t\t\tfor (let i = 0; i < array.length; i++) array[i] = 0;\r\n\t\t\t\treturn array;\r\n\t\t}\r\n\t}\r\n\r\n\tstatic newShortArray (size: number): ArrayLike<number> {\r\n\t\tif (Utils.SUPPORTS_TYPED_ARRAYS) {\r\n\t\t\treturn new Int16Array(size)\r\n\t\t} else {\r\n\t\t\t\tlet array = new Array<number>(size);\r\n\t\t\t\tfor (let i = 0; i < array.length; i++) array[i] = 0;\r\n\t\t\t\treturn array;\r\n\t\t}\r\n\t}\r\n\r\n\tstatic toFloatArray (array: Array<number>) {\r\n\t\treturn Utils.SUPPORTS_TYPED_ARRAYS ? new Float32Array(array) : array;\r\n\t}\r\n\r\n\tstatic toSinglePrecision (value: number) {\r\n\t\treturn Utils.SUPPORTS_TYPED_ARRAYS ? Math.fround(value) : value;\r\n\t}\r\n\r\n\t// This function is used to fix WebKit 602 specific issue described at http://esotericsoftware.com/forum/iOS-10-disappearing-graphics-10109\r\n\tstatic webkit602BugfixHelper (alpha: number, blend: MixBlend) {\r\n\r\n\t}\r\n\r\n\tstatic contains<T> (array: Array<T>, element: T, identity = true) {\r\n\t\tfor (var i = 0; i < array.length; i++) {\r\n\t\t\tif (array[i] == element) return true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nexport class DebugUtils {\r\n\tstatic logBones(skeleton: Skeleton) {\r\n\t\tfor (let i = 0; i < skeleton.bones.length; i++) {\r\n\t\t\tlet bone = skeleton.bones[i];\r\n\t\t\tconsole.log(bone.data.name + \", \" + bone.a + \", \" + bone.b + \", \" + bone.c + \", \" + bone.d + \", \" + bone.worldX + \", \" + bone.worldY);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport class Pool<T> {\r\n\tprivate items = new Array<T>();\r\n\tprivate instantiator: () => T;\r\n\r\n\tconstructor (instantiator: () => T) {\r\n\t\tthis.instantiator = instantiator;\r\n\t}\r\n\r\n\tobtain () {\r\n\t\treturn this.items.length > 0 ? this.items.pop() : this.instantiator();\r\n\t}\r\n\r\n\tfree (item: T) {\r\n\t\tif ((item as any).reset) (item as any).reset();\r\n\t\tthis.items.push(item);\r\n\t}\r\n\r\n\tfreeAll (items: ArrayLike<T>) {\r\n\t\tfor (let i = 0; i < items.length; i++) {\r\n\t\t\tthis.free(items[i]);\r\n\t\t}\r\n\t}\r\n\r\n\tclear () {\r\n\t\tthis.items.length = 0;\r\n\t}\r\n}\r\n\r\nexport class Vector2 {\r\n\tconstructor (public x = 0, public y = 0) {\r\n\t}\r\n\r\n\tset (x: number, y: number): Vector2 {\r\n\t\tthis.x = x;\r\n\t\tthis.y = y;\r\n\t\treturn this;\r\n\t}\r\n\r\n\tlength () {\r\n\t\tlet x = this.x;\r\n\t\tlet y = this.y;\r\n\t\treturn Math.sqrt(x * x + y * y);\r\n\t}\r\n\r\n\tnormalize () {\r\n\t\tlet len = this.length();\r\n\t\tif (len != 0) {\r\n\t\t\tthis.x /= len;\r\n\t\t\tthis.y /= len;\r\n\t\t}\r\n\t\treturn this;\r\n\t}\r\n}\r\n\r\nexport class TimeKeeper {\r\n\tmaxDelta = 0.064;\r\n\tframesPerSecond = 0;\r\n\tdelta = 0;\r\n\ttotalTime = 0;\r\n\r\n\tprivate lastTime = Date.now() / 1000;\r\n\tprivate frameCount = 0;\r\n\tprivate frameTime = 0;\r\n\r\n\tupdate () {\r\n\t\tlet now = Date.now() / 1000;\r\n\t\tthis.delta = now - this.lastTime;\r\n\t\tthis.frameTime += this.delta;\r\n\t\tthis.totalTime += this.delta;\r\n\t\tif (this.delta > this.maxDelta) this.delta = this.maxDelta;\r\n\t\tthis.lastTime = now;\r\n\r\n\t\tthis.frameCount++;\r\n\t\tif (this.frameTime > 1) {\r\n\t\t\tthis.framesPerSecond = this.frameCount / this.frameTime;\r\n\t\t\tthis.frameTime = 0;\r\n\t\t\tthis.frameCount = 0;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport interface ArrayLike<T> {\r\n\tlength: number;\r\n\t[n: number]: T;\r\n}\r\n\r\nexport class WindowedMean {\r\n\tvalues: Array<number>;\r\n\taddedValues = 0;\r\n\tlastValue = 0;\r\n\tmean = 0;\r\n\tdirty = true;\r\n\r\n\tconstructor (windowSize: number = 32) {\r\n\t\tthis.values = new Array<number>(windowSize);\r\n\t}\r\n\r\n\thasEnoughData () {\r\n\t\treturn this.addedValues >= this.values.length;\r\n\t}\r\n\r\n\taddValue (value: number) {\r\n\t\tif (this.addedValues < this.values.length)\r\n\t\t\tthis.addedValues++;\r\n\t\tthis.values[this.lastValue++] = value;\r\n\t\tif (this.lastValue > this.values.length - 1) this.lastValue = 0;\r\n\t\tthis.dirty = true;\r\n\t}\r\n\r\n\tgetMean () {\r\n\t\tif (this.hasEnoughData()) {\r\n\t\t\tif (this.dirty) {\r\n\t\t\t\tlet mean = 0;\r\n\t\t\t\tfor (let i = 0; i < this.values.length; i++) {\r\n\t\t\t\t\tmean += this.values[i];\r\n\t\t\t\t}\r\n\t\t\t\tthis.mean = mean / this.values.length;\r\n\t\t\t\tthis.dirty = false;\r\n\t\t\t}\r\n\t\t\treturn this.mean;\r\n\t\t} else {\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t}\r\n}\r\n","\r\n\r\nimport { Color } from \"./Utils\";\r\n\r\n\r\n\r\n\t/** Stores the setup pose for a {@link Bone}. */\r\n\texport class BoneData {\r\n\t\t/** The index of the bone in {@link Skeleton#getBones()}. */\r\n\t\tindex: number;\r\n\r\n\t\t/** The name of the bone, which is unique across all bones in the skeleton. */\r\n\t\tname: string;\r\n\r\n\t\t/** @returns May be null. */\r\n\t\tparent: BoneData;\r\n\r\n\t\t/** The bone's length. */\r\n\t\tlength: number;\r\n\r\n\t\t/** The local x translation. */\r\n\t\tx = 0;\r\n\r\n\t\t/** The local y translation. */\r\n\t\ty = 0;\r\n\r\n\t\t/** The local rotation. */\r\n\t\trotation = 0;\r\n\r\n\t\t/** The local scaleX. */\r\n\t\tscaleX = 1;\r\n\r\n\t\t/** The local scaleY. */\r\n\t\tscaleY = 1;\r\n\r\n\t\t/** The local shearX. */\r\n\t\tshearX = 0;\r\n\r\n\t\t/** The local shearX. */\r\n\t\tshearY = 0;\r\n\r\n\t\t/** The transform mode for how parent world transforms affect this bone. */\r\n\t\ttransformMode = TransformMode.Normal;\r\n\r\n\t\t/** When true, {@link Skeleton#updateWorldTransform()} only updates this bone if the {@link Skeleton#skin} contains this\r\n\t \t* bone.\r\n\t \t* @see Skin#bones */\r\n\t\tskinRequired = false;\r\n\r\n\t\t/** The color of the bone as it was in Spine. Available only when nonessential data was exported. Bones are not usually\r\n\t\t * rendered at runtime. */\r\n\t\tcolor = new Color();\r\n\r\n\t\tconstructor (index: number, name: string, parent: BoneData) {\r\n\t\t\tif (index < 0) throw new Error(\"index must be >= 0.\");\r\n\t\t\tif (name == null) throw new Error(\"name cannot be null.\");\r\n\t\t\tthis.index = index;\r\n\t\t\tthis.name = name;\r\n\t\t\tthis.parent = parent;\r\n\t\t}\r\n\t}\r\n\r\n\t/** Determines how a bone inherits world transforms from parent bones. */\r\n\texport enum TransformMode {\r\n\t\tNormal, OnlyTranslation, NoRotationOrReflection, NoScale, NoScaleOrReflection\r\n\t}\r\n","\r\n\r\nimport { Updatable } from \"./Updatable\";\r\nimport { BoneData, TransformMode } from \"./BoneData\";\r\nimport { Skeleton } from \"./Skeleton\";\r\nimport { MathUtils, Vector2 } from \"./Utils\";\r\n\r\n\r\n/** Stores a bone's current pose.\r\n *\r\n * A bone has a local transform which is used to compute its world transform. A bone also has an applied transform, which is a\r\n * local transform that can be applied to compute the world transform. The local transform and applied transform may differ if a\r\n * constraint or application code modifies the world transform after it was computed from the local transform. */\r\nexport class Bone implements Updatable {\r\n\t/** The bone's setup pose data. */\r\n\tdata: BoneData;\r\n\r\n\t/** The skeleton this bone belongs to. */\r\n\tskeleton: Skeleton;\r\n\r\n\t/** The parent bone, or null if this is the root bone. */\r\n\tparent: Bone;\r\n\r\n\t/** The immediate children of this bone. */\r\n\tchildren = new Array<Bone>();\r\n\r\n\t/** The local x translation. */\r\n\tx = 0;\r\n\r\n\t/** The local y translation. */\r\n\ty = 0;\r\n\r\n\t/** The local rotation in degrees, counter clockwise. */\r\n\trotation = 0;\r\n\r\n\t/** The local scaleX. */\r\n\tscaleX = 0;\r\n\r\n\t/** The local scaleY. */\r\n\tscaleY = 0;\r\n\r\n\t/** The local shearX. */\r\n\tshearX = 0;\r\n\r\n\t/** The local shearY. */\r\n\tshearY = 0;\r\n\r\n\t/** The applied local x translation. */\r\n\tax = 0;\r\n\r\n\t/** The applied local y translation. */\r\n\tay = 0;\r\n\r\n\t/** The applied local rotation in degrees, counter clockwise. */\r\n\tarotation = 0;\r\n\r\n\t/** The applied local scaleX. */\r\n\tascaleX = 0;\r\n\r\n\t/** The applied local scaleY. */\r\n\tascaleY = 0;\r\n\r\n\t/** The applied local shearX. */\r\n\tashearX = 0;\r\n\r\n\t/** The applied local shearY. */\r\n\tashearY = 0;\r\n\r\n\t/** If true, the applied transform matches the world transform. If false, the world transform has been modified since it was\r\n\t* computed and {@link #updateAppliedTransform()} must be called before accessing the applied transform. */\r\n\tappliedValid = false;\r\n\r\n\t/** Part of the world transform matrix for the X axis. If changed, {@link #appliedValid} should be set to false. */\r\n\ta = 0;\r\n\r\n\t/** Part of the world transform matrix for the Y axis. If changed, {@link #appliedValid} should be set to false. */\r\n\tb = 0;\r\n\r\n\t/** Part of the world transform matrix for the X axis. If changed, {@link #appliedValid} should be set to false. */\r\n\tc = 0;\r\n\r\n\t/** Part of the world transform matrix for the Y axis. If changed, {@link #appliedValid} should be set to false. */\r\n\td = 0;\r\n\r\n\t/** The world X position. If changed, {@link #appliedValid} should be set to false. */\r\n\tworldY = 0;\r\n\r\n\t/** The world Y position. If changed, {@link #appliedValid} should be set to false. */\r\n\tworldX = 0;\r\n\r\n\tsorted = false;\r\n\tactive = false;\r\n\r\n\t/** @param parent May be null. */\r\n\tconstructor (data: BoneData, skeleton: Skeleton, parent: Bone) {\r\n\t\tif (data == null) throw new Error(\"data cannot be null.\");\r\n\t\tif (skeleton == null) throw new Error(\"skeleton cannot be null.\");\r\n\t\tthis.data = data;\r\n\t\tthis.skeleton = skeleton;\r\n\t\tthis.parent = parent;\r\n\t\tthis.setToSetupPose();\r\n\t}\r\n\r\n\t/** Returns false when the bone has not been computed because {@link BoneData#skinRequired} is true and the\r\n\t* {@link Skeleton#skin active skin} does not {@link Skin#bones contain} this bone. */\r\n\tisActive () {\r\n\t\treturn this.active;\r\n\t}\r\n\r\n\t/** Same as {@link #updateWorldTransform()}. This method exists for Bone to implement {@link Updatable}. */\r\n\tupdate () {\r\n\t\tthis.updateWorldTransformWith(this.x, this.y, this.rotation, this.scaleX, this.scaleY, this.shearX, this.shearY);\r\n\t}\r\n\r\n\t/** Computes the world transform using the parent bone and this bone's local transform.\r\n\t *\r\n\t * See {@link #updateWorldTransformWith()}. */\r\n\tupdateWorldTransform () {\r\n\t\tthis.updateWorldTransformWith(this.x, this.y, this.rotation, this.scaleX, this.scaleY, this.shearX, this.shearY);\r\n\t}\r\n\r\n\t/** Computes the world transform using the parent bone and the specified local transform. Child bones are not updated.\r\n\t *\r\n\t * See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine\r\n\t * Runtimes Guide. */\r\n\tupdateWorldTransformWith (x: number, y: number, rotation: number, scaleX: number, scaleY: number, shearX: number, shearY: number) {\r\n\t\tthis.ax = x;\r\n\t\tthis.ay = y;\r\n\t\tthis.arotation = rotation;\r\n\t\tthis.ascaleX = scaleX;\r\n\t\tthis.ascaleY = scaleY;\r\n\t\tthis.ashearX = shearX;\r\n\t\tthis.ashearY = shearY;\r\n\t\tthis.appliedValid = true;\r\n\r\n\t\tlet parent = this.parent;\r\n\t\tif (parent == null) { // Root bone.\r\n\t\t\tlet skeleton = this.skeleton;\r\n\t\t\tlet rotationY = rotation + 90 + shearY;\r\n\t\t\tlet sx = skeleton.scaleX;\r\n\t\t\tlet sy = skeleton.scaleY;\r\n\t\t\tthis.a = MathUtils.cosDeg(rotation + shearX) * scaleX * sx;\r\n\t\t\tthis.b = MathUtils.cosDeg(rotationY) * scaleY * sx;\r\n\t\t\tthis.c = MathUtils.sinDeg(rotation + shearX) * scaleX * sy;\r\n\t\t\tthis.d = MathUtils.sinDeg(rotationY) * scaleY * sy;\r\n\t\t\tthis.worldX = x * sx + skeleton.x;\r\n\t\t\tthis.worldY = y * sy + skeleton.y;\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;\r\n\t\tthis.worldX = pa * x + pb * y + parent.worldX;\r\n\t\tthis.worldY = pc * x + pd * y + parent.worldY;\r\n\r\n\t\tswitch (this.data.transformMode) {\r\n\t\tcase TransformMode.Normal: {\r\n\t\t\tlet rotationY = rotation + 90 + shearY;\r\n\t\t\tlet la = MathUtils.cosDeg(rotation + shearX) * scaleX;\r\n\t\t\tlet lb = MathUtils.cosDeg(rotationY) * scaleY;\r\n\t\t\tlet lc = MathUtils.sinDeg(rotation + shearX) * scaleX;\r\n\t\t\tlet ld = MathUtils.sinDeg(rotationY) * scaleY;\r\n\t\t\tthis.a = pa * la + pb * lc;\r\n\t\t\tthis.b = pa * lb + pb * ld;\r\n\t\t\tthis.c = pc * la + pd * lc;\r\n\t\t\tthis.d = pc * lb + pd * ld;\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tcase TransformMode.OnlyTranslation: {\r\n\t\t\tlet rotationY = rotation + 90 + shearY;\r\n\t\t\tthis.a = MathUtils.cosDeg(rotation + shearX) * scaleX;\r\n\t\t\tthis.b = MathUtils.cosDeg(rotationY) * scaleY;\r\n\t\t\tthis.c = MathUtils.sinDeg(rotation + shearX) * scaleX;\r\n\t\t\tthis.d = MathUtils.sinDeg(rotationY) * scaleY;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase TransformMode.NoRotationOrReflection: {\r\n\t\t\tlet s = pa * pa + pc * pc;\r\n\t\t\tlet prx = 0;\r\n\t\t\tif (s > 0.0001) {\r\n\t\t\t\ts = Math.abs(pa * pd - pb * pc) / s;\r\n\t\t\t\tpa /= this.skeleton.scaleX;\r\n\t\t\t\tpc /= this.skeleton.scaleY;\r\n\t\t\t\tpb = pc * s;\r\n\t\t\t\tpd = pa * s;\r\n\t\t\t\tprx = Math.atan2(pc, pa) * MathUtils.radDeg;\r\n\t\t\t} else {\r\n\t\t\t\tpa = 0;\r\n\t\t\t\tpc = 0;\r\n\t\t\t\tprx = 90 - Math.atan2(pd, pb) * MathUtils.radDeg;\r\n\t\t\t}\r\n\t\t\tlet rx = rotation + shearX - prx;\r\n\t\t\tlet ry = rotation + shearY - prx + 90;\r\n\t\t\tlet la = MathUtils.cosDeg(rx) * scaleX;\r\n\t\t\tlet lb = MathUtils.cosDeg(ry) * scaleY;\r\n\t\t\tlet lc = MathUtils.sinDeg(rx) * scaleX;\r\n\t\t\tlet ld = MathUtils.sinDeg(ry) * scaleY;\r\n\t\t\tthis.a = pa * la - pb * lc;\r\n\t\t\tthis.b = pa * lb - pb * ld;\r\n\t\t\tthis.c = pc * la + pd * lc;\r\n\t\t\tthis.d = pc * lb + pd * ld;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase TransformMode.NoScale:\r\n\t\tcase TransformMode.NoScaleOrReflection: {\r\n\t\t\tlet cos = MathUtils.cosDeg(rotation);\r\n\t\t\tlet sin = MathUtils.sinDeg(rotation);\r\n\t\t\tlet za = (pa * cos + pb * sin) / this.skeleton.scaleX;\r\n\t\t\tlet zc = (pc * cos + pd * sin) / this.skeleton.scaleY;\r\n\t\t\tlet s = Math.sqrt(za * za + zc * zc);\r\n\t\t\tif (s > 0.00001) s = 1 / s;\r\n\t\t\tza *= s;\r\n\t\t\tzc *= s;\r\n\t\t\ts = Math.sqrt(za * za + zc * zc);\r\n\t\t\tif (this.data.transformMode == TransformMode.NoScale\r\n\t\t\t\t&& (pa * pd - pb * pc < 0) != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0)) s = -s;\r\n\t\t\tlet r = Math.PI / 2 + Math.atan2(zc, za);\r\n\t\t\tlet zb = Math.cos(r) * s;\r\n\t\t\tlet zd = Math.sin(r) * s;\r\n\t\t\tlet la = MathUtils.cosDeg(shearX) * scaleX;\r\n\t\t\tlet lb = MathUtils.cosDeg(90 + shearY) * scaleY;\r\n\t\t\tlet lc = MathUtils.sinDeg(shearX) * scaleX;\r\n\t\t\tlet ld = MathUtils.sinDeg(90 + shearY) * scaleY;\r\n\t\t\tthis.a = za * la + zb * lc;\r\n\t\t\tthis.b = za * lb + zb * ld;\r\n\t\t\tthis.c = zc * la + zd * lc;\r\n\t\t\tthis.d = zc * lb + zd * ld;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\t}\r\n\t\tthis.a *= this.skeleton.scaleX;\r\n\t\tthis.b *= this.skeleton.scaleX;\r\n\t\tthis.c *= this.skeleton.scaleY;\r\n\t\tthis.d *= this.skeleton.scaleY;\r\n\t}\r\n\r\n\t/** Sets this bone's local transform to the setup pose. */\r\n\tsetToSetupPose () {\r\n\t\tlet data = this.data;\r\n\t\tthis.x = data.x;\r\n\t\tthis.y = data.y;\r\n\t\tthis.rotation = data.rotation;\r\n\t\tthis.scaleX = data.scaleX;\r\n\t\tthis.scaleY = data.scaleY;\r\n\t\tthis.shearX = data.shearX;\r\n\t\tthis.shearY = data.shearY;\r\n\t}\r\n\r\n\t/** The world rotation for the X axis, calculated using {@link #a} and {@link #c}. */\r\n\tgetWorldRotationX () {\r\n\t\treturn Math.atan2(this.c, this.a) * MathUtils.radDeg;\r\n\t}\r\n\r\n\t/** The world rotation for the Y axis, calculated using {@link #b} and {@link #d}. */\r\n\tgetWorldRotationY () {\r\n\t\treturn Math.atan2(this.d, this.b) * MathUtils.radDeg;\r\n\t}\r\n\r\n\t/** The magnitude (always positive) of the world scale X, calculated using {@link #a} and {@link #c}. */\r\n\tgetWorldScaleX () {\r\n\t\treturn Math.sqrt(this.a * this.a + this.c * this.c);\r\n\t}\r\n\r\n\t/** The magnitude (always positive) of the world scale Y, calculated using {@link #b} and {@link #d}. */\r\n\tgetWorldScaleY () {\r\n\t\treturn Math.sqrt(this.b * this.b + this.d * this.d);\r\n\t}\r\n\r\n\t/** Computes the applied transform values from the world transform. This allows the applied transform to be accessed after the\r\n\t * world transform has been modified (by a constraint, {@link #rotateWorld()}, etc).\r\n\t *\r\n\t * If {@link #updateWorldTransform()} has been called for a bone and {@link #appliedValid} is false, then\r\n\t * {@link #updateAppliedTransform()} must be called before accessing the applied transform.\r\n\t *\r\n\t * Some information is ambiguous in the world transform, such as -1,-1 scale versus 180 rotation. The applied transform after\r\n\t * calling this method is equivalent to the local tranform used to compute the world transform, but may not be identical. */\r\n\tupdateAppliedTransform () {\r\n\t\tthis.appliedValid = true;\r\n\t\tlet parent = this.parent;\r\n\t\tif (parent == null) {\r\n\t\t\tthis.ax = this.worldX;\r\n\t\t\tthis.ay = this.worldY;\r\n\t\t\tthis.arotation = Math.atan2(this.c, this.a) * MathUtils.radDeg;\r\n\t\t\tthis.ascaleX = Math.sqrt(this.a * this.a + this.c * this.c);\r\n\t\t\tthis.ascaleY = Math.sqrt(this.b * this.b + this.d * this.d);\r\n\t\t\tthis.ashearX = 0;\r\n\t\t\tthis.ashearY = Math.atan2(this.a * this.b + this.c * this.d, this.a * this.d - this.b * this.c) * MathUtils.radDeg;\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tlet pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;\r\n\t\tlet pid = 1 / (pa * pd - pb * pc);\r\n\t\tlet dx = this.worldX - parent.worldX, dy = this.worldY - parent.worldY;\r\n\t\tthis.ax = (dx * pd * pid - dy * pb * pid);\r\n\t\tthis.ay = (dy * pa * pid - dx * pc * pid);\r\n\t\tlet ia = pid * pd;\r\n\t\tlet id = pid * pa;\r\n\t\tlet ib = pid * pb;\r\n\t\tlet ic = pid * pc;\r\n\t\tlet ra = ia * this.a - ib * this.c;\r\n\t\tlet rb = ia * this.b - ib * this.d;\r\n\t\tlet rc = id * this.c - ic * this.a;\r\n\t\tlet rd = id * this.d - ic * this.b;\r\n\t\tthis.ashearX = 0;\r\n\t\tthis.ascaleX = Math.sqrt(ra * ra + rc * rc);\r\n\t\tif (this.ascaleX > 0.0001) {\r\n\t\t\tlet det = ra * rd - rb * rc;\r\n\t\t\tthis.ascaleY = det / this.ascaleX;\r\n\t\t\tthis.ashearY = Math.atan2(ra * rb + rc * rd, det) * MathUtils.radDeg;\r\n\t\t\tthis.arotation = Math.atan2(rc, ra) * MathUtils.radDeg;\r\n\t\t} else {\r\n\t\t\tthis.ascaleX = 0;\r\n\t\t\tthis.ascaleY = Math.sqrt(rb * rb + rd * rd);\r\n\t\t\tthis.ashearY = 0;\r\n\t\t\tthis.arotation = 90 - Math.atan2(rd, rb) * MathUtils.radDeg;\r\n\t\t}\r\n\t}\r\n\r\n\t/** Transforms a point from world coordinates to the bone's local coordinates. */\r\n\tworldToLocal (world: Vector2) {\r\n\t\tlet a = this.a, b = this.b, c = this.c, d = this.d;\r\n\t\tlet invDet = 1 / (a * d - b * c);\r\n\t\tlet x = world.x - this.worldX, y = world.y - this.worldY;\r\n\t\tworld.x = (x * d * invDet - y * b * invDet);\r\n\t\tworld.y = (y * a * invDet - x * c * invDet);\r\n\t\treturn world;\r\n\t}\r\n\r\n\t/** Transforms a point from the bone's local coordinates to world coordinates. */\r\n\tlocalToWorld (local: Vector2) {\r\n\t\tlet x = local.x, y = local.y;\r\n\t\tlocal.x = x * this.a + y * this.b + this.worldX;\r\n\t\tlocal.y = x * this.c + y * this.d + this.worldY;\r\n\t\treturn local;\r\n\t}\r\n\r\n\t/** Transforms a world rotation to a local rotation. */\r\n\tworldToLocalRotation (worldRotation: number) {\r\n\t\tlet sin = MathUtils.sinDeg(worldRotation), cos = MathUtils.cosDeg(worldRotation);\r\n\t\treturn Math.atan2(this.a * sin - this.c * cos, this.d * cos - this.b * sin) * MathUtils.radDeg + this.rotation - this.shearX;\r\n\t}\r\n\r\n\t/** Transforms a local rotation to a world rotation. */\r\n\tlocalToWorldRotation (localRotation: number) {\r\n\t\tlocalRotation -= this.rotation - this.shearX;\r\n\t\tlet sin = MathUtils.sinDeg(localRotation), cos = MathUtils.cosDeg(localRotation);\r\n\t\treturn Math.atan2(cos * this.c + sin * this.d, cos * this.a + sin * this.b) * MathUtils.radDeg;\r\n\t}\r\n\r\n\t/** Rotates the world transform the specified amount and sets {@link #appliedValid} to false.\r\n\t * {@link #updateWorldTransform()} will need to be called on any child bones, recursively, and any constraints reapplied. */\r\n\trotateWorld (degrees: number) {\r\n\t\tlet a = this.a, b = this.b, c = this.c, d = this.d;\r\n\t\tlet cos = MathUtils.cosDeg(degrees), sin = MathUtils.sinDeg(degrees);\r\n\t\tthis.a = cos * a - sin * c;\r\n\t\tthis.b = cos * b - sin * d;\r\n\t\tthis.c = sin * a + cos * c;\r\n\t\tthis.d = sin * b + cos * d;\r\n\t\tthis.appliedValid = false;\r\n\t}\r\n}\r\n","\r\n\r\nimport { ConstraintData } from \"./ConstraintData\";\r\nimport { BoneData } from \"./BoneData\";\r\nimport { SlotData } from \"./SlotData\";\r\n\r\n\r\n\r\n\t/** Stores the setup pose for a {@link PathConstraint}.\r\n\t *\r\n\t * See [Path constraints](http://esotericsoftware.com/spine-path-constraints) in the Spine User Guide. */\r\n\texport class PathConstraintData extends ConstraintData {\r\n\r\n\t\t/** The bones that will be modified by this path constraint. */\r\n\t\tbones = new Array<BoneData>();\r\n\r\n\t\t/** The slot whose path attachment will be used to constrained the bones. */\r\n\t\ttarget: SlotData;\r\n\r\n\t\t/** The mode for positioning the first bone on the path. */\r\n\t\tpositionMode: PositionMode;\r\n\r\n\t\t/** The mode for positioning the bones after the first bone on the path. */\r\n\t\tspacingMode: SpacingMode;\r\n\r\n\t\t/** The mode for adjusting the rotation of the bones. */\r\n\t\trotateMode: RotateMode;\r\n\r\n\t\t/** An offset added to the constrained bone rotation. */\r\n\t\toffsetRotation: number;\r\n\r\n\t\t/** The position along the path. */\r\n\t\tposition: number;\r\n\r\n\t\t/** The spacing between bones. */\r\n\t\tspacing: number;\r\n\r\n\t\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */\r\n\t\trotateMix: number;\r\n\r\n\t\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained translations. */\r\n\t\ttranslateMix: number;\r\n\r\n\t\tconstructor (name: string) {\r\n\t\t\tsuper(name, 0, false);\r\n\t\t}\r\n\t}\r\n\r\n\t/** Controls how the first bone is positioned along the path.\r\n\t *\r\n\t * See [Position mode](http://esotericsoftware.com/spine-path-constraints#Position-mode) in the Spine User Guide. */\r\n\texport enum PositionMode {\r\n\t\tFixed, Percent\r\n\t}\r\n\r\n\t/** Controls how bones after the first bone are positioned along the path.\r\n\t *\r\n\t * [Spacing mode](http://esotericsoftware.com/spine-path-constraints#Spacing-mode) in the Spine User Guide. */\r\n\texport enum SpacingMode {\r\n\t\tLength, Fixed, Percent\r\n\t}\r\n\r\n\t/** Controls how bones are rotated, translated, and scaled to match the path.\r\n\t *\r\n\t * [Rotate mode](http://esotericsoftware.com/spine-path-constraints#Rotate-mod) in the Spine User Guide. */\r\n\texport enum RotateMode {\r\n\t\tTangent, Chain, ChainScale\r\n\t}\r\n","\r\n\r\nimport { SlotData } from \"./SlotData\";\r\nimport { Bone } from \"./Bone\";\r\nimport { Color } from \"./Utils\";\r\nimport { Attachment } from \"./attachments/Attachment\";\r\nimport { Skeleton } from \"./Skeleton\";\r\n\r\n\r\n\r\n/** Stores a slot's current pose. Slots organize attachments for {@link Skeleton#drawOrder} purposes and provide a place to store\r\n * state for an attachment. State cannot be stored in an attachment itself because attachments are stateless and may be shared\r\n * across multiple skeletons. */\r\nexport class Slot {\r\n\t/** The slot's setup pose data. */\r\n\tdata: SlotData;\r\n\r\n\t/** The bone this slot belongs to. */\r\n\tbone: Bone;\r\n\r\n\t/** The color used to tint the slot's attachment. If {@link #getDarkColor()} is set, this is used as the light color for two\r\n\t * color tinting. */\r\n\tcolor: Color;\r\n\r\n\t/** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark\r\n\t * color's alpha is not used. */\r\n\tdarkColor: Color;\r\n\r\n\tattachment: Attachment;\r\n\r\n\tprivate attachmentTime: number;\r\n\r\n\tattachmentState: number;\r\n\r\n\t/** Values to deform the slot's attachment. For an unweighted mesh, the entries are local positions for each vertex. For a\r\n\t * weighted mesh, the entries are an offset for each vertex which will be added to the mesh's local vertex positions.\r\n\t *\r\n\t * See {@link VertexAttachment#computeWorldVertices()} and {@link DeformTimeline}. */\r\n\tdeform = new Array<number>();\r\n\r\n\tconstructor (data: SlotData, bone: Bone) {\r\n\t\tif (data == null) throw new Error(\"data cannot be null.\");\r\n\t\tif (bone == null) throw new Error(\"bone cannot be null.\");\r\n\t\tthis.data = data;\r\n\t\tthis.bone = bone;\r\n\t\tthis.color = new Color();\r\n\t\tthis.darkColor = data.darkColor == null ? null : new Color();\r\n\t\tthis.setToSetupPose();\r\n\t}\r\n\r\n\t/** The skeleton this slot belongs to. */\r\n\tgetSkeleton (): Skeleton {\r\n\t\treturn this.bone.skeleton;\r\n\t}\r\n\r\n\t/** The current attachment for the slot, or null if the slot has no attachment. */\r\n\tgetAttachment (): Attachment {\r\n\t\treturn this.attachment;\r\n\t}\r\n\r\n\t/** Sets the slot's attachment and, if the attachment changed, resets {@link #attachmentTime} and clears {@link #deform}.\r\n\t * @param attachment May be null. */\r\n\tsetAttachment (attachment: Attachment) {\r\n\t\tif (this.attachment == attachment) return;\r\n\t\tthis.attachment = attachment;\r\n\t\tthis.attachmentTime = this.bone.skeleton.time;\r\n\t\tthis.deform.length = 0;\r\n\t}\r\n\r\n\tsetAttachmentTime (time: number) {\r\n\t\tthis.attachmentTime = this.bone.skeleton.time - time;\r\n\t}\r\n\r\n\t/** The time that has elapsed since the last time the attachment was set or cleared. Relies on Skeleton\r\n\t * {@link Skeleton#time}. */\r\n\tgetAttachmentTime (): number {\r\n\t\treturn this.bone.skeleton.time - this.attachmentTime;\r\n\t}\r\n\r\n\t/** Sets this slot to the setup pose. */\r\n\tsetToSetupPose () {\r\n\t\tthis.color.setFromColor(this.data.color);\r\n\t\tif (this.darkColor != null) this.darkColor.setFromColor(this.data.darkColor);\r\n\t\tif (this.data.attachmentName == null)\r\n\t\t\tthis.attachment = null;\r\n\t\telse {\r\n\t\t\tthis.attachment = null;\r\n\t\t\tthis.setAttachment(this.bone.skeleton.getAttachment(this.data.index, this.data.attachmentName));\r\n\t\t}\r\n\t}\r\n}\r\n","\r\n\r\nimport { Updatable } from \"./Updatable\";\r\nimport { IkConstraintData } from \"./IkConstraintData\";\r\nimport { Bone } from \"./Bone\";\r\nimport { Skeleton } from \"./Skeleton\";\r\nimport { TransformMode } from \"./BoneData\";\r\nimport { MathUtils } from \"./Utils\";\r\n\r\n\r\n\r\n\t/** Stores the current pose for an IK constraint. An IK constraint adjusts the rotation of 1 or 2 constrained bones so the tip of\r\n\t * the last bone is as close to the target bone as possible.\r\n\t *\r\n\t * See [IK constraints](http://esotericsoftware.com/spine-ik-constraints) in the Spine User Guide. */\r\n\texport class IkConstraint implements Updatable {\r\n\t\t/** The IK constraint's setup pose data. */\r\n\t\tdata: IkConstraintData;\r\n\r\n\t\t/** The bones that will be modified by this IK constraint. */\r\n\t\tbones: Array<Bone>;\r\n\r\n\t\t/** The bone that is the IK target. */\r\n\t\ttarget: Bone;\r\n\r\n\t\t/** Controls the bend direction of the IK bones, either 1 or -1. */\r\n\t\tbendDirection = 0;\r\n\r\n\t\t/** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */\r\n\t\tcompress = false;\r\n\r\n\t\t/** When true, if the target is out of range, the parent bone is scaled to reach it. If more than one bone is being constrained\r\n\t\t * and the parent bone has local nonuniform scale, stretch is not applied. */\r\n\t\tstretch = false;\r\n\r\n\t\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */\r\n\t\tmix = 1;\r\n\r\n\t\t/** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */\r\n\t\tsoftness = 0;\r\n\t\tactive = false;\r\n\r\n\t\tconstructor (data: IkConstraintData, skeleton: Skeleton) {\r\n\t\t\tif (data == null) throw new Error(\"data cannot be null.\");\r\n\t\t\tif (skeleton == null) throw new Error(\"skeleton cannot be null.\");\r\n\t\t\tthis.data = data;\r\n\t\t\tthis.mix = data.mix;\r\n\t\t\tthis.softness = data.softness;\r\n\t\t\tthis.bendDirection = data.bendDirection;\r\n\t\t\tthis.compress = data.compress;\r\n\t\t\tthis.stretch = data.stretch;\r\n\r\n\t\t\tthis.bones = new Array<Bone>();\r\n\t\t\tfor (let i = 0; i < data.bones.length; i++)\r\n\t\t\t\tthis.bones.push(skeleton.findBone(data.bones[i].name));\r\n\t\t\tthis.target = skeleton.findBone(data.target.name);\r\n\t\t}\r\n\r\n\t\tisActive () {\r\n\t\t\treturn this.active;\r\n\t\t}\r\n\r\n\t\t/** Applies the constraint to the constrained bones. */\r\n\t\tapply () {\r\n\t\t\tthis.update();\r\n\t\t}\r\n\r\n\t\tupdate () {\r\n\t\t\tlet target = this.target;\r\n\t\t\tlet bones = this.bones;\r\n\t\t\tswitch (bones.length) {\r\n\t\t\tcase 1:\r\n\t\t\t\tthis.apply1(bones[0], target.worldX, target.worldY, this.compress, this.stretch, this.data.uniform, this.mix);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 2:\r\n\t\t\t\tthis.apply2(bones[0], bones[1], target.worldX, target.worldY, this.bendDirection, this.stretch, this.softness, this.mix);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t/** Applies 1 bone IK. The target is specified in the world coordinate system. */\r\n\t\tapply1 (bone: Bone, targetX: number, targetY: number, compress: boolean, stretch: boolean, uniform: boolean, alpha: number) {\r\n\t\t\tif (!bone.appliedValid) bone.updateAppliedTransform();\r\n\t\t\tlet p = bone.parent;\r\n\r\n\t\t\tlet pa = p.a, pb = p.b, pc = p.c, pd = p.d;\r\n\t\t\tlet rotationIK = -bone.ashearX - bone.arotation, tx = 0, ty = 0;\r\n\r\n\t\t\tswitch(bone.data.transformMode) {\r\n\t\t\t\tcase TransformMode.OnlyTranslation:\r\n\t\t\t\t\ttx = targetX - bone.worldX;\r\n\t\t\t\t\tty = targetY - bone.worldY;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase TransformMode.NoRotationOrReflection:\r\n\t\t\t\t\tlet s = Math.abs(pa * pd - pb * pc) / (pa * pa + pc * pc);\r\n\t\t\t\t\tlet sa = pa / bone.skeleton.scaleX;\r\n\t\t\t\t\tlet sc = pc / bone.skeleton.scaleY;\r\n\t\t\t\t\tpb = -sc * s * bone.skeleton.scaleX;\r\n\t\t\t\t\tpd = sa * s * bone.skeleton.scaleY;\r\n\t\t\t\t\trotationIK += Math.atan2(sc, sa) * MathUtils.radDeg;\r\n\t\t\t\t\t// Fall through\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tlet x = targetX - p.worldX, y = targetY - p.worldY;\r\n\t\t\t\t\tlet d = pa * pd - pb * pc;\r\n\t\t\t\t\ttx = (x * pd - y * pb) / d - bone.ax;\r\n\t\t\t\t\tty = (y * pa - x * pc) / d - bone.ay;\r\n\t\t\t}\r\n\t\t\trotationIK += Math.atan2(ty, tx) * MathUtils.radDeg;\r\n\t\t\tif (bone.ascaleX < 0) rotationIK += 180;\r\n\t\t\tif (rotationIK > 180)\r\n\t\t\t\trotationIK -= 360;\r\n\t\t\telse if (rotationIK < -180) rotationIK += 360;\r\n\t\t\tlet sx = bone.ascaleX, sy = bone.ascaleY;\r\n\t\t\tif (compress || stretch) {\r\n\t\t\t\tswitch (bone.data.transformMode) {\r\n\t\t\t\t\tcase TransformMode.NoScale:\r\n\t\t\t\t\tcase TransformMode.NoScaleOrReflection:\r\n\t\t\t\t\t\ttx = targetX - bone.worldX;\r\n\t\t\t\t\t\tty = targetY - bone.worldY;\r\n\t\t\t\t}\r\n\t\t\t\tlet b = bone.data.length * sx, dd = Math.sqrt(tx * tx + ty * ty);\r\n\t\t\t\tif ((compress && dd < b) || (stretch && dd > b) && b > 0.0001) {\r\n\t\t\t\t\tlet s = (dd / b - 1) * alpha + 1;\r\n\t\t\t\t\tsx *= s;\r\n\t\t\t\t\tif (uniform) sy *= s;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbone.updateWorldTransformWith(bone.ax, bone.ay, bone.arotation + rotationIK * alpha, sx, sy, bone.ashearX,\r\n\t\t\t\tbone.ashearY);\r\n\t\t}\r\n\r\n\t\t/** Applies 2 bone IK. The target is specified in the world coordinate system.\r\n\t\t * @param child A direct descendant of the parent bone. */\r\n\t\tapply2 (parent: Bone, child: Bone, targetX: number, targetY: number, bendDir: number, stretch: boolean, softness: number, alpha: number) {\r\n\t\t\tif (alpha == 0) {\r\n\t\t\t\tchild.updateWorldTransform();\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tif (!parent.appliedValid) parent.updateAppliedTransform();\r\n\t\t\tif (!child.appliedValid) child.updateAppliedTransform();\r\n\t\t\tlet px = parent.ax, py = parent.ay, psx = parent.ascaleX, sx = psx, psy = parent.ascaleY, csx = child.ascaleX;\r\n\t\t\tlet os1 = 0, os2 = 0, s2 = 0;\r\n\t\t\tif (psx < 0) {\r\n\t\t\t\tpsx = -psx;\r\n\t\t\t\tos1 = 180;\r\n\t\t\t\ts2 = -1;\r\n\t\t\t} else {\r\n\t\t\t\tos1 = 0;\r\n\t\t\t\ts2 = 1;\r\n\t\t\t}\r\n\t\t\tif (psy < 0) {\r\n\t\t\t\tpsy = -psy;\r\n\t\t\t\ts2 = -s2;\r\n\t\t\t}\r\n\t\t\tif (csx < 0) {\r\n\t\t\t\tcsx = -csx;\r\n\t\t\t\tos2 = 180;\r\n\t\t\t} else\r\n\t\t\t\tos2 = 0;\r\n\t\t\tlet cx = child.ax, cy = 0, cwx = 0, cwy = 0, a = parent.a, b = parent.b, c = parent.c, d = parent.d;\r\n\t\t\tlet u = Math.abs(psx - psy) <= 0.0001;\r\n\t\t\tif (!u) {\r\n\t\t\t\tcy = 0;\r\n\t\t\t\tcwx = a * cx + parent.worldX;\r\n\t\t\t\tcwy = c * cx + parent.worldY;\r\n\t\t\t} else {\r\n\t\t\t\tcy = child.ay;\r\n\t\t\t\tcwx = a * cx + b * cy + parent.worldX;\r\n\t\t\t\tcwy = c * cx + d * cy + parent.worldY;\r\n\t\t\t}\r\n\t\t\tlet pp = parent.parent;\r\n\t\t\ta = pp.a;\r\n\t\t\tb = pp.b;\r\n\t\t\tc = pp.c;\r\n\t\t\td = pp.d;\r\n\t\t\tlet id = 1 / (a * d - b * c), x = cwx - pp.worldX, y = cwy - pp.worldY;\r\n\t\t\tlet dx = (x * d - y * b) * id - px, dy = (y * a - x * c) * id - py;\r\n\t\t\tlet l1 = Math.sqrt(dx * dx + dy * dy), l2 = child.data.length * csx, a1, a2;\r\n\t\t\tif (l1 < 0.0001) {\r\n\t\t\t\tthis.apply1(parent, targetX, targetY, false, stretch, false, alpha);\r\n\t\t\t\tchild.updateWorldTransformWith(cx, cy, 0, child.ascaleX, child.ascaleY, child.ashearX, child.ashearY);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tx = targetX - pp.worldX;\r\n\t\t\ty = targetY - pp.worldY;\r\n\t\t\tlet tx = (x * d - y * b) * id - px, ty = (y * a - x * c) * id - py;\r\n\t\t\tlet dd = tx * tx + ty * ty;\r\n\t\t\tif (softness != 0) {\r\n\t\t\t\tsoftness *= psx * (csx + 1) / 2;\r\n\t\t\t\tlet td = Math.sqrt(dd), sd = td - l1 - l2 * psx + softness;\r\n\t\t\t\tif (sd > 0) {\r\n\t\t\t\t\tlet p = Math.min(1, sd / (softness * 2)) - 1;\r\n\t\t\t\t\tp = (sd - softness * (1 - p * p)) / td;\r\n\t\t\t\t\ttx -= p * tx;\r\n\t\t\t\t\tty -= p * ty;\r\n\t\t\t\t\tdd = tx * tx + ty * ty;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\touter:\r\n\t\t\tif (u) {\r\n\t\t\t\tl2 *= psx;\r\n\t\t\t\tlet cos = (dd - l1 * l1 - l2 * l2) / (2 * l1 * l2);\r\n\t\t\t\tif (cos < -1)\r\n\t\t\t\t\tcos = -1;\r\n\t\t\t\telse if (cos > 1) {\r\n\t\t\t\t\tcos = 1;\r\n\t\t\t\t\tif (stretch) sx *= (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;\r\n\t\t\t\t}\r\n\t\t\t\ta2 = Math.acos(cos) * bendDir;\r\n\t\t\t\ta = l1 + l2 * cos;\r\n\t\t\t\tb = l2 * Math.sin(a2);\r\n\t\t\t\ta1 = Math.atan2(ty * a - tx * b, tx * a + ty * b);\r\n\t\t\t} else {\r\n\t\t\t\ta = psx * l2;\r\n\t\t\t\tb = psy * l2;\r\n\t\t\t\tlet aa = a * a, bb = b * b, ta = Math.atan2(ty, tx);\r\n\t\t\t\tc = bb * l1 * l1 + aa * dd - aa * bb;\r\n\t\t\t\tlet c1 = -2 * bb * l1, c2 = bb - aa;\r\n\t\t\t\td = c1 * c1 - 4 * c2 * c;\r\n\t\t\t\tif (d >= 0) {\r\n\t\t\t\t\tlet q = Math.sqrt(d);\r\n\t\t\t\t\tif (c1 < 0) q = -q;\r\n\t\t\t\t\tq = -(c1 + q) / 2;\r\n\t\t\t\t\tlet r0 = q / c2, r1 = c / q;\r\n\t\t\t\t\tlet r = Math.abs(r0) < Math.abs(r1) ? r0 : r1;\r\n\t\t\t\t\tif (r * r <= dd) {\r\n\t\t\t\t\t\ty = Math.sqrt(dd - r * r) * bendDir;\r\n\t\t\t\t\t\ta1 = ta - Math.atan2(y, r);\r\n\t\t\t\t\t\ta2 = Math.atan2(y / psy, (r - l1) / psx);\r\n\t\t\t\t\t\tbreak outer;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tlet minAngle = MathUtils.PI, minX = l1 - a, minDist = minX * minX, minY = 0;\r\n\t\t\t\tlet maxAngle = 0, maxX = l1 + a, maxDist = maxX * maxX, maxY = 0;\r\n\t\t\t\tc = -a * l1 / (aa - bb);\r\n\t\t\t\tif (c >= -1 && c <= 1) {\r\n\t\t\t\t\tc = Math.acos(c);\r\n\t\t\t\t\tx = a * Math.cos(c) + l1;\r\n\t\t\t\t\ty = b * Math.sin(c);\r\n\t\t\t\t\td = x * x + y * y;\r\n\t\t\t\t\tif (d < minDist) {\r\n\t\t\t\t\t\tminAngle = c;\r\n\t\t\t\t\t\tminDist = d;\r\n\t\t\t\t\t\tminX = x;\r\n\t\t\t\t\t\tminY = y;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (d > maxDist) {\r\n\t\t\t\t\t\tmaxAngle = c;\r\n\t\t\t\t\t\tmaxDist = d;\r\n\t\t\t\t\t\tmaxX = x;\r\n\t\t\t\t\t\tmaxY = y;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif (dd <= (minDist + maxDist) / 2) {\r\n\t\t\t\t\ta1 = ta - Math.atan2(minY * bendDir, minX);\r\n\t\t\t\t\ta2 = minAngle * bendDir;\r\n\t\t\t\t} else {\r\n\t\t\t\t\ta1 = ta - Math.atan2(maxY * bendDir, maxX);\r\n\t\t\t\t\ta2 = maxAngle * bendDir;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tlet os = Math.atan2(cy, cx) * s2;\r\n\t\t\tlet rotation = parent.arotation;\r\n\t\t\ta1 = (a1 - os) * MathUtils.radDeg + os1 - rotation;\r\n\t\t\tif (a1 > 180)\r\n\t\t\t\ta1 -= 360;\r\n\t\t\telse if (a1 < -180) a1 += 360;\r\n\t\t\tparent.updateWorldTransformWith(px, py, rotation + a1 * alpha, sx, parent.ascaleY, 0, 0);\r\n\t\t\trotation = child.arotation;\r\n\t\t\ta2 = ((a2 + os) * MathUtils.radDeg - child.ashearX) * s2 + os2 - rotation;\r\n\t\t\tif (a2 > 180)\r\n\t\t\t\ta2 -= 360;\r\n\t\t\telse if (a2 < -180) a2 += 360;\r\n\t\t\tchild.updateWorldTransformWith(cx, cy, rotation + a2 * alpha, child.ascaleX, child.ascaleY, child.ashearX, child.ashearY);\r\n\t\t}\r\n\t}\r\n","\r\n\r\nimport { Updatable } from \"./Updatable\";\r\nimport { TransformConstraintData } from \"./TransformConstraintData\";\r\nimport { Bone } from \"./Bone\";\r\nimport { Skeleton } from \"./Skeleton\";\r\nimport { MathUtils, Vector2 } from \"./Utils\";\r\n\r\n\r\n\r\n/** Stores the current pose for a transform constraint. A transform constraint adjusts the world transform of the constrained\r\n * bones to match that of the target bone.\r\n *\r\n * See [Transform constraints](http://esotericsoftware.com/spine-transform-constraints) in the Spine User Guide. */\r\nexport class TransformConstraint implements Updatable {\r\n\r\n\t/** The transform constraint's setup pose data. */\r\n\tdata: TransformConstraintData;\r\n\r\n\t/** The bones that will be modified by this transform constraint. */\r\n\tbones: Array<Bone>;\r\n\r\n\t/** The target bone whose world transform will be copied to the constrained bones. */\r\n\ttarget: Bone;\r\n\r\n\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */\r\n\trotateMix = 0;\r\n\r\n\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained translations. */\r\n\ttranslateMix = 0;\r\n\r\n\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained scales. */\r\n\tscaleMix = 0;\r\n\r\n\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained scales. */\r\n\tshearMix = 0;\r\n\r\n\ttemp = new Vector2();\r\n\tactive = false;\r\n\r\n\tconstructor (data: TransformConstraintData, skeleton: Skeleton) {\r\n\t\tif (data == null) throw new Error(\"data cannot be null.\");\r\n\t\tif (skeleton == null) throw new Error(\"skeleton cannot be null.\");\r\n\t\tthis.data = data;\r\n\t\tthis.rotateMix = data.rotateMix;\r\n\t\tthis.translateMix = data.translateMix;\r\n\t\tthis.scaleMix = data.scaleMix;\r\n\t\tthis.shearMix = data.shearMix;\r\n\t\tthis.bones = new Array<Bone>();\r\n\t\tfor (let i = 0; i < data.bones.length; i++)\r\n\t\t\tthis.bones.push(skeleton.findBone(data.bones[i].name));\r\n\t\tthis.target = skeleton.findBone(data.target.name);\r\n\t}\r\n\r\n\tisActive () {\r\n\t\treturn this.active;\r\n\t}\r\n\r\n\t/** Applies the constraint to the constrained bones. */\r\n\tapply () {\r\n\t\tthis.update();\r\n\t}\r\n\r\n\tupdate () {\r\n\t\tif (this.data.local) {\r\n\t\t\tif (this.data.relative)\r\n\t\t\t\tthis.applyRelativeLocal();\r\n\t\t\telse\r\n\t\t\t\tthis.applyAbsoluteLocal();\r\n\r\n\t\t} else {\r\n\t\t\tif (this.data.relative)\r\n\t\t\t\tthis.applyRelativeWorld();\r\n\t\t\telse\r\n\t\t\t\tthis.applyAbsoluteWorld();\r\n\t\t}\r\n\t}\r\n\r\n\tapplyAbsoluteWorld () {\r\n\t\tlet rotateMix = this.rotateMix, translateMix = this.translateMix, scaleMix = this.scaleMix, shearMix = this.shearMix;\r\n\t\tlet target = this.target;\r\n\t\tlet ta = target.a, tb = target.b, tc = target.c, td = target.d;\r\n\t\tlet degRadReflect = ta * td - tb * tc > 0 ? MathUtils.degRad : -MathUtils.degRad;\r\n\t\tlet offsetRotation = this.data.offsetRotation * degRadReflect;\r\n\t\tlet offsetShearY = this.data.offsetShearY * degRadReflect;\r\n\t\tlet bones = this.bones;\r\n\t\tfor (let i = 0, n = bones.length; i < n; i++) {\r\n\t\t\tlet bone = bones[i];\r\n\t\t\tlet modified = false;\r\n\r\n\t\t\tif (rotateMix != 0) {\r\n\t\t\t\tlet a = bone.a, b = bone.b, c = bone.c, d = bone.d;\r\n\t\t\t\tlet r = Math.atan2(tc, ta) - Math.atan2(c, a) + offsetRotation;\r\n\t\t\t\tif (r > MathUtils.PI)\r\n\t\t\t\t\tr -= MathUtils.PI2;\r\n\t\t\t\telse if (r < -MathUtils.PI)\r\n\t\t\t\t\tr += MathUtils.PI2;\r\n\t\t\t\tr *= rotateMix;\r\n\t\t\t\tlet cos = Math.cos(r), sin = Math.sin(r);\r\n\t\t\t\tbone.a = cos * a - sin * c;\r\n\t\t\t\tbone.b = cos * b - sin * d;\r\n\t\t\t\tbone.c = sin * a + cos * c;\r\n\t\t\t\tbone.d = sin * b + cos * d;\r\n\t\t\t\tmodified = true;\r\n\t\t\t}\r\n\r\n\t\t\tif (translateMix != 0) {\r\n\t\t\t\tlet temp = this.temp;\r\n\t\t\t\ttarget.localToWorld(temp.set(this.data.offsetX, this.data.offsetY));\r\n\t\t\t\tbone.worldX += (temp.x - bone.worldX) * translateMix;\r\n\t\t\t\tbone.worldY += (temp.y - bone.worldY) * translateMix;\r\n\t\t\t\tmodified = true;\r\n\t\t\t}\r\n\r\n\t\t\tif (scaleMix > 0) {\r\n\t\t\t\tlet s = Math.sqrt(bone.a * bone.a + bone.c * bone.c);\r\n\t\t\t\tlet ts = Math.sqrt(ta * ta + tc * tc);\r\n\t\t\t\tif (s > 0.00001) s = (s + (ts - s + this.data.offsetScaleX) * scaleMix) / s;\r\n\t\t\t\tbone.a *= s;\r\n\t\t\t\tbone.c *= s;\r\n\t\t\t\ts = Math.sqrt(bone.b * bone.b + bone.d * bone.d);\r\n\t\t\t\tts = Math.sqrt(tb * tb + td * td);\r\n\t\t\t\tif (s > 0.00001) s = (s + (ts - s + this.data.offsetScaleY) * scaleMix) / s;\r\n\t\t\t\tbone.b *= s;\r\n\t\t\t\tbone.d *= s;\r\n\t\t\t\tmodified = true;\r\n\t\t\t}\r\n\r\n\t\t\tif (shearMix > 0) {\r\n\t\t\t\tlet b = bone.b, d = bone.d;\r\n\t\t\t\tlet by = Math.atan2(d, b);\r\n\t\t\t\tlet r = Math.atan2(td, tb) - Math.atan2(tc, ta) - (by - Math.atan2(bone.c, bone.a));\r\n\t\t\t\tif (r > MathUtils.PI)\r\n\t\t\t\t\tr -= MathUtils.PI2;\r\n\t\t\t\telse if (r < -MathUtils.PI)\r\n\t\t\t\t\tr += MathUtils.PI2;\r\n\t\t\t\tr = by + (r + offsetShearY) * shearMix;\r\n\t\t\t\tlet s = Math.sqrt(b * b + d * d);\r\n\t\t\t\tbone.b = Math.cos(r) * s;\r\n\t\t\t\tbone.d = Math.sin(r) * s;\r\n\t\t\t\tmodified = true;\r\n\t\t\t}\r\n\r\n\t\t\tif (modified) bone.appliedValid = false;\r\n\t\t}\r\n\t}\r\n\r\n\tapplyRelativeWorld () {\r\n\t\tlet rotateMix = this.rotateMix, translateMix = this.translateMix, scaleMix = this.scaleMix, shearMix = this.shearMix;\r\n\t\tlet target = this.target;\r\n\t\tlet ta = target.a, tb = target.b, tc = target.c, td = target.d;\r\n\t\tlet degRadReflect = ta * td - tb * tc > 0 ? MathUtils.degRad : -MathUtils.degRad;\r\n\t\tlet offsetRotation = this.data.offsetRotation * degRadReflect, offsetShearY = this.data.offsetShearY * degRadReflect;\r\n\t\tlet bones = this.bones;\r\n\t\tfor (let i = 0, n = bones.length; i < n; i++) {\r\n\t\t\tlet bone = bones[i];\r\n\t\t\tlet modified = false;\r\n\r\n\t\t\tif (rotateMix != 0) {\r\n\t\t\t\tlet a = bone.a, b = bone.b, c = bone.c, d = bone.d;\r\n\t\t\t\tlet r = Math.atan2(tc, ta) + offsetRotation;\r\n\t\t\t\tif (r > MathUtils.PI)\r\n\t\t\t\t\tr -= MathUtils.PI2;\r\n\t\t\t\telse if (r < -MathUtils.PI) r += MathUtils.PI2;\r\n\t\t\t\tr *= rotateMix;\r\n\t\t\t\tlet cos = Math.cos(r), sin = Math.sin(r);\r\n\t\t\t\tbone.a = cos * a - sin * c;\r\n\t\t\t\tbone.b = cos * b - sin * d;\r\n\t\t\t\tbone.c = sin * a + cos * c;\r\n\t\t\t\tbone.d = sin * b + cos * d;\r\n\t\t\t\tmodified = true;\r\n\t\t\t}\r\n\r\n\t\t\tif (translateMix != 0) {\r\n\t\t\t\tlet temp = this.temp;\r\n\t\t\t\ttarget.localToWorld(temp.set(this.data.offsetX, this.data.offsetY));\r\n\t\t\t\tbone.worldX += temp.x * translateMix;\r\n\t\t\t\tbone.worldY += temp.y * translateMix;\r\n\t\t\t\tmodified = true;\r\n\t\t\t}\r\n\r\n\t\t\tif (scaleMix > 0) {\r\n\t\t\t\tlet s = (Math.sqrt(ta * ta + tc * tc) - 1 + this.data.offsetScaleX) * scaleMix + 1;\r\n\t\t\t\tbone.a *= s;\r\n\t\t\t\tbone.c *= s;\r\n\t\t\t\ts = (Math.sqrt(tb * tb + td * td) - 1 + this.data.offsetScaleY) * scaleMix + 1;\r\n\t\t\t\tbone.b *= s;\r\n\t\t\t\tbone.d *= s;\r\n\t\t\t\tmodified = true;\r\n\t\t\t}\r\n\r\n\t\t\tif (shearMix > 0) {\r\n\t\t\t\tlet r = Math.atan2(td, tb) - Math.atan2(tc, ta);\r\n\t\t\t\tif (r > MathUtils.PI)\r\n\t\t\t\t\tr -= MathUtils.PI2;\r\n\t\t\t\telse if (r < -MathUtils.PI) r += MathUtils.PI2;\r\n\t\t\t\tlet b = bone.b, d = bone.d;\r\n\t\t\t\tr = Math.atan2(d, b) + (r - MathUtils.PI / 2 + offsetShearY) * shearMix;\r\n\t\t\t\tlet s = Math.sqrt(b * b + d * d);\r\n\t\t\t\tbone.b = Math.cos(r) * s;\r\n\t\t\t\tbone.d = Math.sin(r) * s;\r\n\t\t\t\tmodified = true;\r\n\t\t\t}\r\n\r\n\t\t\tif (modified) bone.appliedValid = false;\r\n\t\t}\r\n\t}\r\n\r\n\tapplyAbsoluteLocal () {\r\n\t\tlet rotateMix = this.rotateMix, translateMix = this.translateMix, scaleMix = this.scaleMix, shearMix = this.shearMix;\r\n\t\tlet target = this.target;\r\n\t\tif (!target.appliedValid) target.updateAppliedTransform();\r\n\t\tlet bones = this.bones;\r\n\t\tfor (let i = 0, n = bones.length; i < n; i++) {\r\n\t\t\tlet bone = bones[i];\r\n\t\t\tif (!bone.appliedValid) bone.updateAppliedTransform();\r\n\r\n\t\t\tlet rotation = bone.arotation;\r\n\t\t\tif (rotateMix != 0) {\r\n\t\t\t\tlet r = target.arotation - rotation + this.data.offsetRotation;\r\n\t\t\t\tr -= (16384 - ((16384.499999999996 - r / 360) | 0)) * 360;\r\n\t\t\t\trotation += r * rotateMix;\r\n\t\t\t}\r\n\r\n\t\t\tlet x = bone.ax, y = bone.ay;\r\n\t\t\tif (translateMix != 0) {\r\n\t\t\t\tx += (target.ax - x + this.data.offsetX) * translateMix;\r\n\t\t\t\ty += (target.ay - y + this.data.offsetY) * translateMix;\r\n\t\t\t}\r\n\r\n\t\t\tlet scaleX = bone.ascaleX, scaleY = bone.ascaleY;\r\n\t\t\tif (scaleMix != 0) {\r\n\t\t\t\tif (scaleX > 0.00001) scaleX = (scaleX + (target.ascaleX - scaleX + this.data.offsetScaleX) * scaleMix) / scaleX;\r\n\t\t\t\tif (scaleY > 0.00001) scaleY = (scaleY + (target.ascaleY - scaleY + this.data.offsetScaleY) * scaleMix) / scaleY;\r\n\t\t\t}\r\n\r\n\t\t\tlet shearY = bone.ashearY;\r\n\t\t\tif (shearMix != 0) {\r\n\t\t\t\tlet r = target.ashearY - shearY + this.data.offsetShearY;\r\n\t\t\t\tr -= (16384 - ((16384.499999999996 - r / 360) | 0)) * 360;\r\n\t\t\t\tbone.shearY += r * shearMix;\r\n\t\t\t}\r\n\r\n\t\t\tbone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);\r\n\t\t}\r\n\t}\r\n\r\n\tapplyRelativeLocal () {\r\n\t\tlet rotateMix = this.rotateMix, translateMix = this.translateMix, scaleMix = this.scaleMix, shearMix = this.shearMix;\r\n\t\tlet target = this.target;\r\n\t\tif (!target.appliedValid) target.updateAppliedTransform();\r\n\t\tlet bones = this.bones;\r\n\t\tfor (let i = 0, n = bones.length; i < n; i++) {\r\n\t\t\tlet bone = bones[i];\r\n\t\t\tif (!bone.appliedValid) bone.updateAppliedTransform();\r\n\r\n\t\t\tlet rotation = bone.arotation;\r\n\t\t\tif (rotateMix != 0) rotation += (target.arotation + this.data.offsetRotation) * rotateMix;\r\n\r\n\t\t\tlet x = bone.ax, y = bone.ay;\r\n\t\t\tif (translateMix != 0) {\r\n\t\t\t\tx += (target.ax + this.data.offsetX) * translateMix;\r\n\t\t\t\ty += (target.ay + this.data.offsetY) * translateMix;\r\n\t\t\t}\r\n\r\n\t\t\tlet scaleX = bone.ascaleX, scaleY = bone.ascaleY;\r\n\t\t\tif (scaleMix != 0) {\r\n\t\t\t\tif (scaleX > 0.00001) scaleX *= ((target.ascaleX - 1 + this.data.offsetScaleX) * scaleMix) + 1;\r\n\t\t\t\tif (scaleY > 0.00001) scaleY *= ((target.ascaleY - 1 + this.data.offsetScaleY) * scaleMix) + 1;\r\n\t\t\t}\r\n\r\n\t\t\tlet shearY = bone.ashearY;\r\n\t\t\tif (shearMix != 0) shearY += (target.ashearY + this.data.offsetShearY) * shearMix;\r\n\r\n\t\t\tbone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);\r\n\t\t}\r\n\t}\r\n}\r\n","\n\n\n\t/** The base class for all constraint datas. */\n\texport abstract class ConstraintData {\n\t\tconstructor(public name: string, public order: number, public skinRequired: boolean) { }\n\t}\n","\r\n\r\nimport { Slot } from \"../Slot\";\r\nimport { Utils, ArrayLike } from \"../Utils\";\r\n\r\n/** The base class for all attachments. */\r\nexport abstract class Attachment {\r\n\tname: string;\r\n\r\n\tconstructor (name: string) {\r\n\t\tif (name == null) throw new Error(\"name cannot be null.\");\r\n\t\tthis.name = name;\r\n\t}\r\n\r\n\tabstract copy (): Attachment;\r\n}\r\n\r\n/** Base class for an attachment with vertices that are transformed by one or more bones and can be deformed by a slot's\r\n * {@link Slot#deform}. */\r\nexport abstract class VertexAttachment extends Attachment {\r\n\tprivate static nextID = 0;\r\n\r\n\t/** The unique ID for this attachment. */\r\n\tid = (VertexAttachment.nextID++ & 65535) << 11;\r\n\r\n\t/** The bones which affect the {@link #getVertices()}. The array entries are, for each vertex, the number of bones affecting\r\n\t * the vertex followed by that many bone indices, which is the index of the bone in {@link Skeleton#bones}. Will be null\r\n\t * if this attachment has no weights. */\r\n\tbones: Array<number>;\r\n\r\n\t/** The vertex positions in the bone's coordinate system. For a non-weighted attachment, the values are `x,y`\r\n\t * entries for each vertex. For a weighted attachment, the values are `x,y,weight` entries for each bone affecting\r\n\t * each vertex. */\r\n\tvertices: ArrayLike<number>;\r\n\r\n\t/** The maximum number of world vertex values that can be output by\r\n\t * {@link #computeWorldVertices()} using the `count` parameter. */\r\n\tworldVerticesLength = 0;\r\n\r\n\t/** Deform keys for the deform attachment are also applied to this attachment. May be null if no deform keys should be applied. */\r\n\tdeformAttachment: VertexAttachment = this;\r\n\r\n\tconstructor (name: string) {\r\n\t\tsuper(name);\r\n\t}\r\n\r\n\t/** Transforms the attachment's local {@link vertices} to world coordinates. If the slot's {@link Slot#deform} is\r\n\t * not empty, it is used to deform the vertices.\r\n\t *\r\n\t * See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine\r\n\t * Runtimes Guide.\r\n\t * @param start The index of the first {@link #vertices} value to transform. Each vertex has 2 values, x and y.\r\n\t * @param count The number of world vertex values to output. Must be <= {@link #worldVerticesLength} - `start`.\r\n\t * @param worldVertices The output world vertices. Must have a length >= `offset` + `count` *\r\n\t * `stride` / 2.\r\n\t * @param offset The `worldVertices` index to begin writing values.\r\n\t * @param stride The number of `worldVertices` entries between the value pairs written. */\r\n\tcomputeWorldVertices (slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number, stride: number) {\r\n\t\tcount = offset + (count >> 1) * stride;\r\n\t\tlet skeleton = slot.bone.skeleton;\r\n\t\tlet deformArray = slot.deform;\r\n\t\tlet vertices = this.vertices;\r\n\t\tlet bones = this.bones;\r\n\t\tif (bones == null) {\r\n\t\t\tif (deformArray.length > 0) vertices = deformArray;\r\n\t\t\tlet bone = slot.bone;\r\n\t\t\tlet x = bone.worldX;\r\n\t\t\tlet y = bone.worldY;\r\n\t\t\tlet a = bone.a, b = bone.b, c = bone.c, d = bone.d;\r\n\t\t\tfor (let v = start, w = offset; w < count; v += 2, w += stride) {\r\n\t\t\t\tlet vx = vertices[v], vy = vertices[v + 1];\r\n\t\t\t\tworldVertices[w] = vx * a + vy * b + x;\r\n\t\t\t\tworldVertices[w + 1] = vx * c + vy * d + y;\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tlet v = 0, skip = 0;\r\n\t\tfor (let i = 0; i < start; i += 2) {\r\n\t\t\tlet n = bones[v];\r\n\t\t\tv += n + 1;\r\n\t\t\tskip += n;\r\n\t\t}\r\n\t\tlet skeletonBones = skeleton.bones;\r\n\t\tif (deformArray.length == 0) {\r\n\t\t\tfor (let w = offset, b = skip * 3; w < count; w += stride) {\r\n\t\t\t\tlet wx = 0, wy = 0;\r\n\t\t\t\tlet n = bones[v++];\r\n\t\t\t\tn += v;\r\n\t\t\t\tfor (; v < n; v++, b += 3) {\r\n\t\t\t\t\tlet bone = skeletonBones[bones[v]];\r\n\t\t\t\t\tlet vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];\r\n\t\t\t\t\twx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;\r\n\t\t\t\t\twy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;\r\n\t\t\t\t}\r\n\t\t\t\tworldVertices[w] = wx;\r\n\t\t\t\tworldVertices[w + 1] = wy;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tlet deform = deformArray;\r\n\t\t\tfor (let w = offset, b = skip * 3, f = skip << 1; w < count; w += stride) {\r\n\t\t\t\tlet wx = 0, wy = 0;\r\n\t\t\t\tlet n = bones[v++];\r\n\t\t\t\tn += v;\r\n\t\t\t\tfor (; v < n; v++, b += 3, f += 2) {\r\n\t\t\t\t\tlet bone = skeletonBones[bones[v]];\r\n\t\t\t\t\tlet vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];\r\n\t\t\t\t\twx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;\r\n\t\t\t\t\twy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;\r\n\t\t\t\t}\r\n\t\t\t\tworldVertices[w] = wx;\r\n\t\t\t\tworldVertices[w + 1] = wy;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/** Does not copy id (generated) or name (set on construction). **/\r\n\tcopyTo (attachment: VertexAttachment) {\r\n\t\tif (this.bones != null) {\r\n\t\t\tattachment.bones = new Array<number>(this.bones.length);\r\n\t\t\tUtils.arrayCopy(this.bones, 0, attachment.bones, 0, this.bones.length);\r\n\t\t} else\r\n\t\t\tattachment.bones = null;\r\n\r\n\t\tif (this.vertices != null) {\r\n\t\t\tattachment.vertices = Utils.newFloatArray(this.vertices.length);\r\n\t\t\tUtils.arrayCopy(this.vertices, 0, attachment.vertices, 0, this.vertices.length);\r\n\t\t} else\r\n\t\t\tattachment.vertices = null;\r\n\r\n\t\tattachment.worldVerticesLength = this.worldVerticesLength;\r\n\t\tattachment.deformAttachment = this.deformAttachment;\r\n\t}\r\n}\r\n","export function _assert_this_initialized(self) {\n if (self === void 0) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n\n return self;\n}\nexport { _assert_this_initialized as _ };\n","\r\n\r\nimport { VertexAttachment, Attachment } from \"./Attachment\";\r\nimport { Color, Utils } from \"../Utils\";\r\n\r\n\r\n\r\n/** An attachment whose vertices make up a composite Bezier curve.\r\n *\r\n * See {@link PathConstraint} and [Paths](http://esotericsoftware.com/spine-paths) in the Spine User Guide. */\r\nexport class PathAttachment extends VertexAttachment {\r\n\r\n\t/** The lengths along the path in the setup pose from the start of the path to the end of each Bezier curve. */\r\n\tlengths: Array<number>;\r\n\r\n\t/** If true, the start and end knots are connected. */\r\n\tclosed = false;\r\n\r\n\t/** If true, additional calculations are performed to make calculating positions along the path more accurate. If false, fewer\r\n\t * calculations are performed but calculating positions along the path is less accurate. */\r\n\tconstantSpeed = false;\r\n\r\n\t/** The color of the path as it was in Spine. Available only when nonessential data was exported. Paths are not usually\r\n\t * rendered at runtime. */\r\n\tcolor = new Color(1, 1, 1, 1);\r\n\r\n\tconstructor (name: string) {\r\n\t\tsuper(name);\r\n\t}\r\n\r\n\tcopy (): Attachment {\r\n\t\tlet copy = new PathAttachment(this.name);\r\n\t\tthis.copyTo(copy);\r\n\t\tcopy.lengths = new Array<number>(this.lengths.length);\r\n\t\tUtils.arrayCopy(this.lengths, 0, copy.lengths, 0, this.lengths.length);\r\n\t\tcopy.closed = closed;\r\n\t\tcopy.constantSpeed = this.constantSpeed;\r\n\t\tcopy.color.setFromColor(this.color);\r\n\t\treturn copy;\r\n\t}\r\n}\r\n","\r\n\r\nimport { Updatable } from \"./Updatable\";\r\nimport { PathConstraintData, SpacingMode, RotateMode, PositionMode } from \"./PathConstraintData\";\r\nimport { Bone } from \"./Bone\";\r\nimport { Slot } from \"./Slot\";\r\nimport { Skeleton } from \"./Skeleton\";\r\nimport { PathAttachment } from \"./attachments/PathAttachment\";\r\nimport { Utils, MathUtils } from \"./Utils\";\r\n\r\n\r\n\r\n/** Stores the current pose for a path constraint. A path constraint adjusts the rotation, translation, and scale of the\r\n * constrained bones so they follow a {@link PathAttachment}.\r\n *\r\n * See [Path constraints](http://esotericsoftware.com/spine-path-constraints) in the Spine User Guide. */\r\nexport class PathConstraint implements Updatable {\r\n\tstatic NONE = -1; static BEFORE = -2; static AFTER = -3;\r\n\tstatic epsilon = 0.00001;\r\n\r\n\t/** The path constraint's setup pose data. */\r\n\tdata: PathConstraintData;\r\n\r\n\t/** The bones that will be modified by this path constraint. */\r\n\tbones: Array<Bone>;\r\n\r\n\t/** The slot whose path attachment will be used to constrained the bones. */\r\n\ttarget: Slot;\r\n\r\n\t/** The position along the path. */\r\n\tposition = 0;\r\n\r\n\t/** The spacing between bones. */\r\n\tspacing = 0;\r\n\r\n\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */\r\n\trotateMix = 0;\r\n\r\n\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained translations. */\r\n\ttranslateMix = 0;\r\n\r\n\tspaces = new Array<number>(); positions = new Array<number>();\r\n\tworld = new Array<number>(); curves = new Array<number>(); lengths = new Array<number>();\r\n\tsegments = new Array<number>();\r\n\r\n\tactive = false;\r\n\r\n\tconstructor (data: PathConstraintData, skeleton: Skeleton) {\r\n\t\tif (data == null) throw new Error(\"data cannot be null.\");\r\n\t\tif (skeleton == null) throw new Error(\"skeleton cannot be null.\");\r\n\t\tthis.data = data;\r\n\t\tthis.bones = new Array<Bone>();\r\n\t\tfor (let i = 0, n = data.bones.length; i < n; i++)\r\n\t\t\tthis.bones.push(skeleton.findBone(data.bones[i].name));\r\n\t\tthis.target = skeleton.findSlot(data.target.name);\r\n\t\tthis.position = data.position;\r\n\t\tthis.spacing = data.spacing;\r\n\t\tthis.rotateMix = data.rotateMix;\r\n\t\tthis.translateMix = data.translateMix;\r\n\t}\r\n\r\n\tisActive () {\r\n\t\treturn this.active;\r\n\t}\r\n\r\n\t/** Applies the constraint to the constrained bones. */\r\n\tapply () {\r\n\t\tthis.update();\r\n\t}\r\n\r\n\tupdate () {\r\n\t\tlet attachment = this.target.getAttachment();\r\n\t\tif (!(attachment instanceof PathAttachment)) return;\r\n\r\n\t\tlet rotateMix = this.rotateMix, translateMix = this.translateMix;\r\n\t\tlet translate = translateMix > 0, rotate = rotateMix > 0;\r\n\t\tif (!translate && !rotate) return;\r\n\r\n\t\tlet data = this.data;\r\n\t\tlet percentSpacing = data.spacingMode == SpacingMode.Percent;\r\n\t\tlet rotateMode = data.rotateMode;\r\n\t\tlet tangents = rotateMode == RotateMode.Tangent, scale = rotateMode == RotateMode.ChainScale;\r\n\t\tlet boneCount = this.bones.length, spacesCount = tangents ? boneCount : boneCount + 1;\r\n\t\tlet bones = this.bones;\r\n\t\tlet spaces = Utils.setArraySize(this.spaces, spacesCount), lengths: Array<number> = null;\r\n\t\tlet spacing = this.spacing;\r\n\t\tif (scale || !percentSpacing) {\r\n\t\t\tif (scale) lengths = Utils.setArraySize(this.lengths, boneCount);\r\n\t\t\tlet lengthSpacing = data.spacingMode == SpacingMode.Length;\r\n\t\t\tfor (let i = 0, n = spacesCount - 1; i < n;) {\r\n\t\t\t\tlet bone = bones[i];\r\n\t\t\t\tlet setupLength = bone.data.length;\r\n\t\t\t\tif (setupLength < PathConstraint.epsilon) {\r\n\t\t\t\t\tif (scale) lengths[i] = 0;\r\n\t\t\t\t\tspaces[++i] = 0;\r\n\t\t\t\t} else if (percentSpacing) {\r\n\t\t\t\t\tif (scale) {\r\n\t\t\t\t\t\tlet x = setupLength * bone.a, y = setupLength * bone.c;\r\n\t\t\t\t\t\tlet length = Math.sqrt(x * x + y * y);\r\n\t\t\t\t\t\tlengths[i] = length;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tspaces[++i] = spacing;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tlet x = setupLength * bone.a, y = setupLength * bone.c;\r\n\t\t\t\t\tlet length = Math.sqrt(x * x + y * y);\r\n\t\t\t\t\tif (scale) lengths[i] = length;\r\n\t\t\t\t\tspaces[++i] = (lengthSpacing ? setupLength + spacing : spacing) * length / setupLength;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tfor (let i = 1; i < spacesCount; i++)\r\n\t\t\t\tspaces[i] = spacing;\r\n\t\t}\r\n\r\n\t\tlet positions = this.computeWorldPositions(<PathAttachment>attachment, spacesCount, tangents,\r\n\t\t\tdata.positionMode == PositionMode.Percent, percentSpacing);\r\n\t\tlet boneX = positions[0], boneY = positions[1], offsetRotation = data.offsetRotation;\r\n\t\tlet tip = false;\r\n\t\tif (offsetRotation == 0)\r\n\t\t\ttip = rotateMode == RotateMode.Chain;\r\n\t\telse {\r\n\t\t\ttip = false;\r\n\t\t\tlet p = this.target.bone;\r\n\t\t\toffsetRotation *= p.a * p.d - p.b * p.c > 0 ? MathUtils.degRad : -MathUtils.degRad;\r\n\t\t}\r\n\t\tfor (let i = 0, p = 3; i < boneCount; i++, p += 3) {\r\n\t\t\tlet bone = bones[i];\r\n\t\t\tbone.worldX += (boneX - bone.worldX) * translateMix;\r\n\t\t\tbone.worldY += (boneY - bone.worldY) * translateMix;\r\n\t\t\tlet x = positions[p], y = positions[p + 1], dx = x - boneX, dy = y - boneY;\r\n\t\t\tif (scale) {\r\n\t\t\t\tlet length = lengths[i];\r\n\t\t\t\tif (length != 0) {\r\n\t\t\t\t\tlet s = (Math.sqrt(dx * dx + dy * dy) / length - 1) * rotateMix + 1;\r\n\t\t\t\t\tbone.a *= s;\r\n\t\t\t\t\tbone.c *= s;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tboneX = x;\r\n\t\t\tboneY = y;\r\n\t\t\tif (rotate) {\r\n\t\t\t\tlet a = bone.a, b = bone.b, c = bone.c, d = bone.d, r = 0, cos = 0, sin = 0;\r\n\t\t\t\tif (tangents)\r\n\t\t\t\t\tr = positions[p - 1];\r\n\t\t\t\telse if (spaces[i + 1] == 0)\r\n\t\t\t\t\tr = positions[p + 2];\r\n\t\t\t\telse\r\n\t\t\t\t\tr = Math.atan2(dy, dx);\r\n\t\t\t\tr -= Math.atan2(c, a);\r\n\t\t\t\tif (tip) {\r\n\t\t\t\t\tcos = Math.cos(r);\r\n\t\t\t\t\tsin = Math.sin(r);\r\n\t\t\t\t\tlet length = bone.data.length;\r\n\t\t\t\t\tboneX += (length * (cos * a - sin * c) - dx) * rotateMix;\r\n\t\t\t\t\tboneY += (length * (sin * a + cos * c) - dy) * rotateMix;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tr += offsetRotation;\r\n\t\t\t\t}\r\n\t\t\t\tif (r > MathUtils.PI)\r\n\t\t\t\t\tr -= MathUtils.PI2;\r\n\t\t\t\telse if (r < -MathUtils.PI) //\r\n\t\t\t\t\tr += MathUtils.PI2;\r\n\t\t\t\tr *= rotateMix;\r\n\t\t\t\tcos = Math.cos(r);\r\n\t\t\t\tsin = Math.sin(r);\r\n\t\t\t\tbone.a = cos * a - sin * c;\r\n\t\t\t\tbone.b = cos * b - sin * d;\r\n\t\t\t\tbone.c = sin * a + cos * c;\r\n\t\t\t\tbone.d = sin * b + cos * d;\r\n\t\t\t}\r\n\t\t\tbone.appliedValid = false;\r\n\t\t}\r\n\t}\r\n\r\n\tcomputeWorldPositions (path: PathAttachment, spacesCount: number, tangents: boolean, percentPosition: boolean,\r\n\t\tpercentSpacing: boolean) {\r\n\t\tlet target = this.target;\r\n\t\tlet position = this.position;\r\n\t\tlet spaces = this.spaces, out = Utils.setArraySize(this.positions, spacesCount * 3 + 2), world: Array<number> = null;\r\n\t\tlet closed = path.closed;\r\n\t\tlet verticesLength = path.worldVerticesLength, curveCount = verticesLength / 6, prevCurve = PathConstraint.NONE;\r\n\r\n\t\tif (!path.constantSpeed) {\r\n\t\t\tlet lengths = path.lengths;\r\n\t\t\tcurveCount -= closed ? 1 : 2;\r\n\t\t\tlet pathLength = lengths[curveCount];\r\n\t\t\tif (percentPosition) position *= pathLength;\r\n\t\t\tif (percentSpacing) {\r\n\t\t\t\tfor (let i = 1; i < spacesCount; i++)\r\n\t\t\t\t\tspaces[i] *= pathLength;\r\n\t\t\t}\r\n\t\t\tworld = Utils.setArraySize(this.world, 8);\r\n\t\t\tfor (let i = 0, o = 0, curve = 0; i < spacesCount; i++, o += 3) {\r\n\t\t\t\tlet space = spaces[i];\r\n\t\t\t\tposition += space;\r\n\t\t\t\tlet p = position;\r\n\r\n\t\t\t\tif (closed) {\r\n\t\t\t\t\tp %= pathLength;\r\n\t\t\t\t\tif (p < 0) p += pathLength;\r\n\t\t\t\t\tcurve = 0;\r\n\t\t\t\t} else if (p < 0) {\r\n\t\t\t\t\tif (prevCurve != PathConstraint.BEFORE) {\r\n\t\t\t\t\t\tprevCurve = PathConstraint.BEFORE;\r\n\t\t\t\t\t\tpath.computeWorldVertices(target, 2, 4, world, 0, 2);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.addBeforePosition(p, world, 0, out, o);\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t} else if (p > pathLength) {\r\n\t\t\t\t\tif (prevCurve != PathConstraint.AFTER) {\r\n\t\t\t\t\t\tprevCurve = PathConstraint.AFTER;\r\n\t\t\t\t\t\tpath.computeWorldVertices(target, verticesLength - 6, 4, world, 0, 2);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.addAfterPosition(p - pathLength, world, 0, out, o);\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Determine curve containing position.\r\n\t\t\t\tfor (;; curve++) {\r\n\t\t\t\t\tlet length = lengths[curve];\r\n\t\t\t\t\tif (p > length) continue;\r\n\t\t\t\t\tif (curve == 0)\r\n\t\t\t\t\t\tp /= length;\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tlet prev = lengths[curve - 1];\r\n\t\t\t\t\t\tp = (p - prev) / (length - prev);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tif (curve != prevCurve) {\r\n\t\t\t\t\tprevCurve = curve;\r\n\t\t\t\t\tif (closed && curve == curveCount) {\r\n\t\t\t\t\t\tpath.computeWorldVertices(target, verticesLength - 4, 4, world, 0, 2);\r\n\t\t\t\t\t\tpath.computeWorldVertices(target, 0, 4, world, 4, 2);\r\n\t\t\t\t\t} else\r\n\t\t\t\t\t\tpath.computeWorldVertices(target, curve * 6 + 2, 8, world, 0, 2);\r\n\t\t\t\t}\r\n\t\t\t\tthis.addCurvePosition(p, world[0], world[1], world[2], world[3], world[4], world[5], world[6], world[7], out, o,\r\n\t\t\t\t\ttangents || (i > 0 && space == 0));\r\n\t\t\t}\r\n\t\t\treturn out;\r\n\t\t}\r\n\r\n\t\t// World vertices.\r\n\t\tif (closed) {\r\n\t\t\tverticesLength += 2;\r\n\t\t\tworld = Utils.setArraySize(this.world, verticesLength);\r\n\t\t\tpath.computeWorldVertices(target, 2, verticesLength - 4, world, 0, 2);\r\n\t\t\tpath.computeWorldVertices(target, 0, 2, world, verticesLength - 4, 2);\r\n\t\t\tworld[verticesLength - 2] = world[0];\r\n\t\t\tworld[verticesLength - 1] = world[1];\r\n\t\t} else {\r\n\t\t\tcurveCount--;\r\n\t\t\tverticesLength -= 4;\r\n\t\t\tworld = Utils.setArraySize(this.world, verticesLength);\r\n\t\t\tpath.computeWorldVertices(target, 2, verticesLength, world, 0, 2);\r\n\t\t}\r\n\r\n\t\t// Curve lengths.\r\n\t\tlet curves = Utils.setArraySize(this.curves, curveCount);\r\n\t\tlet pathLength = 0;\r\n\t\tlet x1 = world[0], y1 = world[1], cx1 = 0, cy1 = 0, cx2 = 0, cy2 = 0, x2 = 0, y2 = 0;\r\n\t\tlet tmpx = 0, tmpy = 0, dddfx = 0, dddfy = 0, ddfx = 0, ddfy = 0, dfx = 0, dfy = 0;\r\n\t\tfor (let i = 0, w = 2; i < curveCount; i++, w += 6) {\r\n\t\t\tcx1 = world[w];\r\n\t\t\tcy1 = world[w + 1];\r\n\t\t\tcx2 = world[w + 2];\r\n\t\t\tcy2 = world[w + 3];\r\n\t\t\tx2 = world[w + 4];\r\n\t\t\ty2 = world[w + 5];\r\n\t\t\ttmpx = (x1 - cx1 * 2 + cx2) * 0.1875;\r\n\t\t\ttmpy = (y1 - cy1 * 2 + cy2) * 0.1875;\r\n\t\t\tdddfx = ((cx1 - cx2) * 3 - x1 + x2) * 0.09375;\r\n\t\t\tdddfy = ((cy1 - cy2) * 3 - y1 + y2) * 0.09375;\r\n\t\t\tddfx = tmpx * 2 + dddfx;\r\n\t\t\tddfy = tmpy * 2 + dddfy;\r\n\t\t\tdfx = (cx1 - x1) * 0.75 + tmpx + dddfx * 0.16666667;\r\n\t\t\tdfy = (cy1 - y1) * 0.75 + tmpy + dddfy * 0.16666667;\r\n\t\t\tpathLength += Math.sqrt(dfx * dfx + dfy * dfy);\r\n\t\t\tdfx += ddfx;\r\n\t\t\tdfy += ddfy;\r\n\t\t\tddfx += dddfx;\r\n\t\t\tddfy += dddfy;\r\n\t\t\tpathLength += Math.sqrt(dfx * dfx + dfy * dfy);\r\n\t\t\tdfx += ddfx;\r\n\t\t\tdfy += ddfy;\r\n\t\t\tpathLength += Math.sqrt(dfx * dfx + dfy * dfy);\r\n\t\t\tdfx += ddfx + dddfx;\r\n\t\t\tdfy += ddfy + dddfy;\r\n\t\t\tpathLength += Math.sqrt(dfx * dfx + dfy * dfy);\r\n\t\t\tcurves[i] = pathLength;\r\n\t\t\tx1 = x2;\r\n\t\t\ty1 = y2;\r\n\t\t}\r\n\t\tif (percentPosition)\r\n\t\t\tposition *= pathLength;\r\n\t\telse\r\n\t\t\tposition *= pathLength / path.lengths[curveCount - 1];\r\n\t\tif (percentSpacing) {\r\n\t\t\tfor (let i = 1; i < spacesCount; i++)\r\n\t\t\t\tspaces[i] *= pathLength;\r\n\t\t}\r\n\r\n\t\tlet segments = this.segments;\r\n\t\tlet curveLength = 0;\r\n\t\tfor (let i = 0, o = 0, curve = 0, segment = 0; i < spacesCount; i++, o += 3) {\r\n\t\t\tlet space = spaces[i];\r\n\t\t\tposition += space;\r\n\t\t\tlet p = position;\r\n\r\n\t\t\tif (closed) {\r\n\t\t\t\tp %= pathLength;\r\n\t\t\t\tif (p < 0) p += pathLength;\r\n\t\t\t\tcurve = 0;\r\n\t\t\t} else if (p < 0) {\r\n\t\t\t\tthis.addBeforePosition(p, world, 0, out, o);\r\n\t\t\t\tcontinue;\r\n\t\t\t} else if (p > pathLength) {\r\n\t\t\t\tthis.addAfterPosition(p - pathLength, world, verticesLength - 4, out, o);\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\t// Determine curve containing position.\r\n\t\t\tfor (;; curve++) {\r\n\t\t\t\tlet length = curves[curve];\r\n\t\t\t\tif (p > length) continue;\r\n\t\t\t\tif (curve == 0)\r\n\t\t\t\t\tp /= length;\r\n\t\t\t\telse {\r\n\t\t\t\t\tlet prev = curves[curve - 1];\r\n\t\t\t\t\tp = (p - prev) / (length - prev);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\t// Curve segment lengths.\r\n\t\t\tif (curve != prevCurve) {\r\n\t\t\t\tprevCurve = curve;\r\n\t\t\t\tlet ii = curve * 6;\r\n\t\t\t\tx1 = world[ii];\r\n\t\t\t\ty1 = world[ii + 1];\r\n\t\t\t\tcx1 = world[ii + 2];\r\n\t\t\t\tcy1 = world[ii + 3];\r\n\t\t\t\tcx2 = world[ii + 4];\r\n\t\t\t\tcy2 = world[ii + 5];\r\n\t\t\t\tx2 = world[ii + 6];\r\n\t\t\t\ty2 = world[ii + 7];\r\n\t\t\t\ttmpx = (x1 - cx1 * 2 + cx2) * 0.03;\r\n\t\t\t\ttmpy = (y1 - cy1 * 2 + cy2) * 0.03;\r\n\t\t\t\tdddfx = ((cx1 - cx2) * 3 - x1 + x2) * 0.006;\r\n\t\t\t\tdddfy = ((cy1 - cy2) * 3 - y1 + y2) * 0.006;\r\n\t\t\t\tddfx = tmpx * 2 + dddfx;\r\n\t\t\t\tddfy = tmpy * 2 + dddfy;\r\n\t\t\t\tdfx = (cx1 - x1) * 0.3 + tmpx + dddfx * 0.16666667;\r\n\t\t\t\tdfy = (cy1 - y1) * 0.3 + tmpy + dddfy * 0.16666667;\r\n\t\t\t\tcurveLength = Math.sqrt(dfx * dfx + dfy * dfy);\r\n\t\t\t\tsegments[0] = curveLength;\r\n\t\t\t\tfor (ii = 1; ii < 8; ii++) {\r\n\t\t\t\t\tdfx += ddfx;\r\n\t\t\t\t\tdfy += ddfy;\r\n\t\t\t\t\tddfx += dddfx;\r\n\t\t\t\t\tddfy += dddfy;\r\n\t\t\t\t\tcurveLength += Math.sqrt(dfx * dfx + dfy * dfy);\r\n\t\t\t\t\tsegments[ii] = curveLength;\r\n\t\t\t\t}\r\n\t\t\t\tdfx += ddfx;\r\n\t\t\t\tdfy += ddfy;\r\n\t\t\t\tcurveLength += Math.sqrt(dfx * dfx + dfy * dfy);\r\n\t\t\t\tsegments[8] = curveLength;\r\n\t\t\t\tdfx += ddfx + dddfx;\r\n\t\t\t\tdfy += ddfy + dddfy;\r\n\t\t\t\tcurveLength += Math.sqrt(dfx * dfx + dfy * dfy);\r\n\t\t\t\tsegments[9] = curveLength;\r\n\t\t\t\tsegment = 0;\r\n\t\t\t}\r\n\r\n\t\t\t// Weight by segment length.\r\n\t\t\tp *= curveLength;\r\n\t\t\tfor (;; segment++) {\r\n\t\t\t\tlet length = segments[segment];\r\n\t\t\t\tif (p > length) continue;\r\n\t\t\t\tif (segment == 0)\r\n\t\t\t\t\tp /= length;\r\n\t\t\t\telse {\r\n\t\t\t\t\tlet prev = segments[segment - 1];\r\n\t\t\t\t\tp = segment + (p - prev) / (length - prev);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tthis.addCurvePosition(p * 0.1, x1, y1, cx1, cy1, cx2, cy2, x2, y2, out, o, tangents || (i > 0 && space == 0));\r\n\t\t}\r\n\t\treturn out;\r\n\t}\r\n\r\n\taddBeforePosition (p: number, temp: Array<number>, i: number, out: Array<number>, o: number) {\r\n\t\tlet x1 = temp[i], y1 = temp[i + 1], dx = temp[i + 2] - x1, dy = temp[i + 3] - y1, r = Math.atan2(dy, dx);\r\n\t\tout[o] = x1 + p * Math.cos(r);\r\n\t\tout[o + 1] = y1 + p * Math.sin(r);\r\n\t\tout[o + 2] = r;\r\n\t}\r\n\r\n\taddAfterPosition (p: number, temp: Array<number>, i: number, out: Array<number>, o: number) {\r\n\t\tlet x1 = temp[i + 2], y1 = temp[i + 3], dx = x1 - temp[i], dy = y1 - temp[i + 1], r = Math.atan2(dy, dx);\r\n\t\tout[o] = x1 + p * Math.cos(r);\r\n\t\tout[o + 1] = y1 + p * Math.sin(r);\r\n\t\tout[o + 2] = r;\r\n\t}\r\n\r\n\taddCurvePosition (p: number, x1: number, y1: number, cx1: number, cy1: number, cx2: number, cy2: number, x2: number, y2: number,\r\n\t\tout: Array<number>, o: number, tangents: boolean) {\r\n\t\tif (p == 0 || isNaN(p)) {\r\n\t\t\tout[o] = x1;\r\n\t\t\tout[o + 1] = y1;\r\n\t\t\tout[o + 2] = Math.atan2(cy1 - y1, cx1 - x1);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tlet tt = p * p, ttt = tt * p, u = 1 - p, uu = u * u, uuu = uu * u;\r\n\t\tlet ut = u * p, ut3 = ut * 3, uut3 = u * ut3, utt3 = ut3 * p;\r\n\t\tlet x = x1 * uuu + cx1 * uut3 + cx2 * utt3 + x2 * ttt, y = y1 * uuu + cy1 * uut3 + cy2 * utt3 + y2 * ttt;\r\n\t\tout[o] = x;\r\n\t\tout[o + 1] = y;\r\n\t\tif (tangents) {\r\n\t\t\tif (p < 0.001)\r\n\t\t\t\tout[o + 2] = Math.atan2(cy1 - y1, cx1 - x1);\r\n\t\t\telse\r\n\t\t\t\tout[o + 2] = Math.atan2(y - (y1 * uu + cy1 * ut * 2 + cy2 * tt), x - (x1 * uu + cx1 * ut * 2 + cx2 * tt));\r\n\t\t}\r\n\t}\r\n}\r\n","\r\n\r\nimport { Attachment } from \"./Attachment\";\r\nimport { Color, Utils, ArrayLike } from \"../Utils\";\r\nimport { TextureRegion } from \"../Texture\";\r\nimport { Bone } from \"../Bone\";\r\n\r\n\r\n\r\n/** An attachment that displays a textured quadrilateral.\r\n *\r\n * See [Region attachments](http://esotericsoftware.com/spine-regions) in the Spine User Guide. */\r\nexport class RegionAttachment extends Attachment {\r\n\tstatic OX1 = 0;\r\n\tstatic OY1 = 1;\r\n\tstatic OX2 = 2;\r\n\tstatic OY2 = 3;\r\n\tstatic OX3 = 4;\r\n\tstatic OY3 = 5;\r\n\tstatic OX4 = 6;\r\n\tstatic OY4 = 7;\r\n\r\n\tstatic X1 = 0;\r\n\tstatic Y1 = 1;\r\n\tstatic C1R = 2;\r\n\tstatic C1G = 3;\r\n\tstatic C1B = 4;\r\n\tstatic C1A = 5;\r\n\tstatic U1 = 6;\r\n\tstatic V1 = 7;\r\n\r\n\tstatic X2 = 8;\r\n\tstatic Y2 = 9;\r\n\tstatic C2R = 10;\r\n\tstatic C2G = 11;\r\n\tstatic C2B = 12;\r\n\tstatic C2A = 13;\r\n\tstatic U2 = 14;\r\n\tstatic V2 = 15;\r\n\r\n\tstatic X3 = 16;\r\n\tstatic Y3 = 17;\r\n\tstatic C3R = 18;\r\n\tstatic C3G = 19;\r\n\tstatic C3B = 20;\r\n\tstatic C3A = 21;\r\n\tstatic U3 = 22;\r\n\tstatic V3 = 23;\r\n\r\n\tstatic X4 = 24;\r\n\tstatic Y4 = 25;\r\n\tstatic C4R = 26;\r\n\tstatic C4G = 27;\r\n\tstatic C4B = 28;\r\n\tstatic C4A = 29;\r\n\tstatic U4 = 30;\r\n\tstatic V4 = 31;\r\n\r\n\t/** The local x translation. */\r\n\tx = 0;\r\n\r\n\t/** The local y translation. */\r\n\ty = 0;\r\n\r\n\t/** The local scaleX. */\r\n\tscaleX = 1;\r\n\r\n\t/** The local scaleY. */\r\n\tscaleY = 1;\r\n\r\n\t/** The local rotation. */\r\n\trotation = 0;\r\n\r\n\t/** The width of the region attachment in Spine. */\r\n\twidth = 0;\r\n\r\n\t/** The height of the region attachment in Spine. */\r\n\theight = 0;\r\n\r\n\t/** The color to tint the region attachment. */\r\n\tcolor = new Color(1, 1, 1, 1);\r\n\r\n\t/** The name of the texture region for this attachment. */\r\n\tpath: string;\r\n\r\n\trendererObject: any;\r\n\tregion: TextureRegion;\r\n\r\n\t/** For each of the 4 vertices, a pair of <code>x,y</code> values that is the local position of the vertex.\r\n\t *\r\n\t * See {@link #updateOffset()}. */\r\n\toffset = Utils.newFloatArray(8);\r\n\r\n\r\n\tuvs = Utils.newFloatArray(8);\r\n\r\n\ttempColor = new Color(1, 1, 1, 1);\r\n\r\n\tconstructor (name:string) {\r\n\t\tsuper(name);\r\n\t}\r\n\r\n\t/** Calculates the {@link #offset} using the region settings. Must be called after changing region settings. */\r\n\tupdateOffset () : void {\r\n\t\tlet regionScaleX = this.width / this.region.originalWidth * this.scaleX;\r\n\t\tlet regionScaleY = this.height / this.region.originalHeight * this.scaleY;\r\n\t\tlet localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;\r\n\t\tlet localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;\r\n\t\tlet localX2 = localX + this.region.width * regionScaleX;\r\n\t\tlet localY2 = localY + this.region.height * regionScaleY;\r\n\t\tlet radians = this.rotation * Math.PI / 180;\r\n\t\tlet cos = Math.cos(radians);\r\n\t\tlet sin = Math.sin(radians);\r\n\t\tlet localXCos = localX * cos + this.x;\r\n\t\tlet localXSin = localX * sin;\r\n\t\tlet localYCos = localY * cos + this.y;\r\n\t\tlet localYSin = localY * sin;\r\n\t\tlet localX2Cos = localX2 * cos + this.x;\r\n\t\tlet localX2Sin = localX2 * sin;\r\n\t\tlet localY2Cos = localY2 * cos + this.y;\r\n\t\tlet localY2Sin = localY2 * sin;\r\n\t\tlet offset = this.offset;\r\n\t\toffset[RegionAttachment.OX1] = localXCos - localYSin;\r\n\t\toffset[RegionAttachment.OY1] = localYCos + localXSin;\r\n\t\toffset[RegionAttachment.OX2] = localXCos - localY2Sin;\r\n\t\toffset[RegionAttachment.OY2] = localY2Cos + localXSin;\r\n\t\toffset[RegionAttachment.OX3] = localX2Cos - localY2Sin;\r\n\t\toffset[RegionAttachment.OY3] = localY2Cos + localX2Sin;\r\n\t\toffset[RegionAttachment.OX4] = localX2Cos - localYSin;\r\n\t\toffset[RegionAttachment.OY4] = localYCos + localX2Sin;\r\n\t}\r\n\r\n\tsetRegion (region: TextureRegion) : void {\r\n\t\tthis.region = region;\r\n\t\tlet uvs = this.uvs;\r\n\t\tif (region.rotate) {\r\n\t\t\tuvs[2] = region.u;\r\n\t\t\tuvs[3] = region.v2;\r\n\t\t\tuvs[4] = region.u;\r\n\t\t\tuvs[5] = region.v;\r\n\t\t\tuvs[6] = region.u2;\r\n\t\t\tuvs[7] = region.v;\r\n\t\t\tuvs[0] = region.u2;\r\n\t\t\tuvs[1] = region.v2;\r\n\t\t} else {\r\n\t\t\tuvs[0] = region.u;\r\n\t\t\tuvs[1] = region.v2;\r\n\t\t\tuvs[2] = region.u;\r\n\t\t\tuvs[3] = region.v;\r\n\t\t\tuvs[4] = region.u2;\r\n\t\t\tuvs[5] = region.v;\r\n\t\t\tuvs[6] = region.u2;\r\n\t\t\tuvs[7] = region.v2;\r\n\t\t}\r\n\t}\r\n\r\n\t/** Transforms the attachment's four vertices to world coordinates.\r\n\t *\r\n\t * See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine\r\n\t * Runtimes Guide.\r\n\t * @param worldVertices The output world vertices. Must have a length >= `offset` + 8.\r\n\t * @param offset The `worldVertices` index to begin writing values.\r\n\t * @param stride The number of `worldVertices` entries between the value pairs written. */\r\n\tcomputeWorldVertices (bone: Bone, worldVertices: ArrayLike<number>, offset: number, stride: number) {\r\n\t\tlet vertexOffset = this.offset;\r\n\t\tlet x = bone.worldX, y = bone.worldY;\r\n\t\tlet a = bone.a, b = bone.b, c = bone.c, d = bone.d;\r\n\t\tlet offsetX = 0, offsetY = 0;\r\n\r\n\t\toffsetX = vertexOffset[RegionAttachment.OX1];\r\n\t\toffsetY = vertexOffset[RegionAttachment.OY1];\r\n\t\tworldVertices[offset] = offsetX * a + offsetY * b + x; // br\r\n\t\tworldVertices[offset + 1] = offsetX * c + offsetY * d + y;\r\n\t\toffset += stride;\r\n\r\n\t\toffsetX = vertexOffset[RegionAttachment.OX2];\r\n\t\toffsetY = vertexOffset[RegionAttachment.OY2];\r\n\t\tworldVertices[offset] = offsetX * a + offsetY * b + x; // bl\r\n\t\tworldVertices[offset + 1] = offsetX * c + offsetY * d + y;\r\n\t\toffset += stride;\r\n\r\n\t\toffsetX = vertexOffset[RegionAttachment.OX3];\r\n\t\toffsetY = vertexOffset[RegionAttachment.OY3];\r\n\t\tworldVertices[offset] = offsetX * a + offsetY * b + x; // ul\r\n\t\tworldVertices[offset + 1] = offsetX * c + offsetY * d + y;\r\n\t\toffset += stride;\r\n\r\n\t\toffsetX = vertexOffset[RegionAttachment.OX4];\r\n\t\toffsetY = vertexOffset[RegionAttachment.OY4];\r\n\t\tworldVertices[offset] = offsetX * a + offsetY * b + x; // ur\r\n\t\tworldVertices[offset + 1] = offsetX * c + offsetY * d + y;\r\n\t}\r\n\r\n\tcopy (): Attachment {\r\n\t\tlet copy = new RegionAttachment(this.name);\r\n\t\tcopy.region = this.region;\r\n\t\tcopy.rendererObject = this.rendererObject;\r\n\t\tcopy.path = this.path;\r\n\t\tcopy.x = this.x;\r\n\t\tcopy.y = this.y;\r\n\t\tcopy.scaleX = this.scaleX;\r\n\t\tcopy.scaleY = this.scaleY;\r\n\t\tcopy.rotation = this.rotation;\r\n\t\tcopy.width = this.width;\r\n\t\tcopy.height = this.height;\r\n\t\tUtils.arrayCopy(this.uvs, 0, copy.uvs, 0, 8);\r\n\t\tUtils.arrayCopy(this.offset, 0, copy.offset, 0, 8);\r\n\t\tcopy.color.setFromColor(this.color);\r\n\t\treturn copy;\r\n\t}\r\n}\r\n","export abstract class Texture {\r\n\tprotected _image: HTMLImageElement | ImageBitmap;\r\n\r\n\tconstructor (image: HTMLImageElement | ImageBitmap) {\r\n\t\tthis._image = image;\r\n\t}\r\n\r\n\tgetImage (): HTMLImageElement | ImageBitmap {\r\n\t\treturn this._image;\r\n\t}\r\n\r\n\tabstract setFilters (minFilter: TextureFilter, magFilter: TextureFilter): void;\r\n\tabstract setWraps (uWrap: TextureWrap, vWrap: TextureWrap): void;\r\n\tabstract dispose (): void;\r\n\r\n\tpublic static filterFromString (text: string): TextureFilter {\r\n\t\tswitch (text.toLowerCase()) {\r\n\t\t\tcase \"nearest\": return TextureFilter.Nearest;\r\n\t\t\tcase \"linear\": return TextureFilter.Linear;\r\n\t\t\tcase \"mipmap\": return TextureFilter.MipMap;\r\n\t\t\tcase \"mipmapnearestnearest\": return TextureFilter.MipMapNearestNearest;\r\n\t\t\tcase \"mipmaplinearnearest\": return TextureFilter.MipMapLinearNearest;\r\n\t\t\tcase \"mipmapnearestlinear\": return TextureFilter.MipMapNearestLinear;\r\n\t\t\tcase \"mipmaplinearlinear\": return TextureFilter.MipMapLinearLinear;\r\n\t\t\tdefault: throw new Error(`Unknown texture filter ${text}`);\r\n\t\t}\r\n\t}\r\n\r\n\tpublic static wrapFromString (text: string): TextureWrap {\r\n\t\tswitch (text.toLowerCase()) {\r\n\t\t\tcase \"mirroredtepeat\": return TextureWrap.MirroredRepeat;\r\n\t\t\tcase \"clamptoedge\": return TextureWrap.ClampToEdge;\r\n\t\t\tcase \"repeat\": return TextureWrap.Repeat;\r\n\t\t\tdefault: throw new Error(`Unknown texture wrap ${text}`);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport enum TextureFilter {\r\n\tNearest = 9728, // WebGLRenderingContext.NEAREST\r\n\tLinear = 9729, // WebGLRenderingContext.LINEAR\r\n\tMipMap = 9987, // WebGLRenderingContext.LINEAR_MIPMAP_LINEAR\r\n\tMipMapNearestNearest = 9984, // WebGLRenderingContext.NEAREST_MIPMAP_NEAREST\r\n\tMipMapLinearNearest = 9985, // WebGLRenderingContext.LINEAR_MIPMAP_NEAREST\r\n\tMipMapNearestLinear = 9986, // WebGLRenderingContext.NEAREST_MIPMAP_LINEAR\r\n\tMipMapLinearLinear = 9987 // WebGLRenderingContext.LINEAR_MIPMAP_LINEAR\r\n}\r\n\r\nexport enum TextureWrap {\r\n\tMirroredRepeat = 33648, // WebGLRenderingContext.MIRRORED_REPEAT\r\n\tClampToEdge = 33071, // WebGLRenderingContext.CLAMP_TO_EDGE\r\n\tRepeat = 10497 // WebGLRenderingContext.REPEAT\r\n}\r\n\r\nexport class TextureRegion {\r\n\trenderObject: any;\r\n\tu = 0; v = 0;\r\n\tu2 = 0; v2 = 0;\r\n\twidth = 0; height = 0;\r\n\trotate = false;\r\n\toffsetX = 0; offsetY = 0;\r\n\toriginalWidth = 0; originalHeight = 0;\r\n}\r\n\r\nexport class FakeTexture extends Texture {\r\n\tsetFilters(minFilter: TextureFilter, magFilter: TextureFilter) { }\r\n\tsetWraps(uWrap: TextureWrap, vWrap: TextureWrap) { }\r\n\tdispose() { }\r\n}\r\n","\r\n\r\nimport { Skeleton } from \"./Skeleton\";\r\nimport { Utils, MathUtils, ArrayLike } from \"./Utils\";\r\nimport { Slot } from \"./Slot\";\r\nimport { VertexAttachment, Attachment } from \"./attachments/Attachment\";\r\nimport { IkConstraint } from \"./IkConstraint\";\r\nimport { TransformConstraint } from \"./TransformConstraint\";\r\nimport { PathConstraint } from \"./PathConstraint\";\r\nimport { Event } from \"./Event\";\r\n\r\n\r\n\r\n/** A simple container for a list of timelines and a name. */\r\nexport class Animation {\r\n\t/** The animation's name, which is unique across all animations in the skeleton. */\r\n\tname: string;\r\n\ttimelines: Array<Timeline>;\r\n\ttimelineIds: Array<boolean>;\r\n\r\n\t/** The duration of the animation in seconds, which is the highest time of all keys in the timeline. */\r\n\tduration: number;\r\n\r\n\tconstructor (name: string, timelines: Array<Timeline>, duration: number) {\r\n\t\tif (name == null) throw new Error(\"name cannot be null.\");\r\n\t\tif (timelines == null) throw new Error(\"timelines cannot be null.\");\r\n\t\tthis.name = name;\r\n\t\tthis.timelines = timelines;\r\n\t\tthis.timelineIds = [];\r\n\t\tfor (var i = 0; i < timelines.length; i++)\r\n\t\t\tthis.timelineIds[timelines[i].getPropertyId()] = true;\r\n\t\tthis.duration = duration;\r\n\t}\r\n\r\n\thasTimeline (id: number) {\r\n\t\treturn this.timelineIds[id] == true;\r\n\t}\r\n\r\n\t/** Applies all the animation's timelines to the specified skeleton.\r\n\t *\r\n\t * See Timeline {@link Timeline#apply(Skeleton, float, float, Array, float, MixBlend, MixDirection)}.\r\n\t * @param loop If true, the animation repeats after {@link #getDuration()}.\r\n\t * @param events May be null to ignore fired events. */\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, loop: boolean, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tif (skeleton == null) throw new Error(\"skeleton cannot be null.\");\r\n\r\n\t\tif (loop && this.duration != 0) {\r\n\t\t\ttime %= this.duration;\r\n\t\t\tif (lastTime > 0) lastTime %= this.duration;\r\n\t\t}\r\n\r\n\t\tlet timelines = this.timelines;\r\n\t\tfor (let i = 0, n = timelines.length; i < n; i++)\r\n\t\t\ttimelines[i].apply(skeleton, lastTime, time, events, alpha, blend, direction);\r\n\t}\r\n\r\n\t/** @param target After the first and before the last value.\r\n\t * @returns index of first value greater than the target. */\r\n\tstatic binarySearch (values: ArrayLike<number>, target: number, step: number = 1) {\r\n\t\tlet low = 0;\r\n\t\tlet high = values.length / step - 2;\r\n\t\tif (high == 0) return step;\r\n\t\tlet current = high >>> 1;\r\n\t\twhile (true) {\r\n\t\t\tif (values[(current + 1) * step] <= target)\r\n\t\t\t\tlow = current + 1;\r\n\t\t\telse\r\n\t\t\t\thigh = current;\r\n\t\t\tif (low == high) return (low + 1) * step;\r\n\t\t\tcurrent = (low + high) >>> 1;\r\n\t\t}\r\n\t}\r\n\r\n\tstatic linearSearch (values: ArrayLike<number>, target: number, step: number) {\r\n\t\tfor (let i = 0, last = values.length - step; i <= last; i += step)\r\n\t\t\tif (values[i] > target) return i;\r\n\t\treturn -1;\r\n\t}\r\n}\r\n\r\n/** The interface for all timelines. */\r\nexport interface Timeline {\r\n\t/** Applies this timeline to the skeleton.\r\n\t * @param skeleton The skeleton the timeline is being applied to. This provides access to the bones, slots, and other\r\n\t * skeleton components the timeline may change.\r\n\t * @param lastTime The time this timeline was last applied. Timelines such as {@link EventTimeline}} trigger only at specific\r\n\t * times rather than every frame. In that case, the timeline triggers everything between `lastTime`\r\n\t * (exclusive) and `time` (inclusive).\r\n\t * @param time The time within the animation. Most timelines find the key before and the key after this time so they can\r\n\t * interpolate between the keys.\r\n\t * @param events If any events are fired, they are added to this list. Can be null to ignore fired events or if the timeline\r\n\t * does not fire events.\r\n\t * @param alpha 0 applies the current or setup value (depending on `blend`). 1 applies the timeline value.\r\n\t * Between 0 and 1 applies a value between the current or setup value and the timeline value. By adjusting\r\n\t * `alpha` over time, an animation can be mixed in or out. `alpha` can also be useful to\r\n\t * apply animations on top of each other (layering).\r\n\t * @param blend Controls how mixing is applied when `alpha` < 1.\r\n\t * @param direction Indicates whether the timeline is mixing in or out. Used by timelines which perform instant transitions,\r\n\t * such as {@link DrawOrderTimeline} or {@link AttachmentTimeline}. */\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;\r\n\r\n\t/** Uniquely encodes both the type of this timeline and the skeleton property that it affects. */\r\n\tgetPropertyId (): number;\r\n}\r\n\r\n/** Controls how a timeline value is mixed with the setup pose value or current pose value when a timeline's `alpha`\r\n * < 1.\r\n *\r\n * See Timeline {@link Timeline#apply(Skeleton, float, float, Array, float, MixBlend, MixDirection)}. */\r\nexport enum MixBlend {\r\n\t/** Transitions from the setup value to the timeline value (the current value is not used). Before the first key, the setup\r\n\t * value is set. */\r\n\tsetup,\r\n\t/** Transitions from the current value to the timeline value. Before the first key, transitions from the current value to\r\n\t * the setup value. Timelines which perform instant transitions, such as {@link DrawOrderTimeline} or\r\n\t * {@link AttachmentTimeline}, use the setup value before the first key.\r\n\t *\r\n\t * `first` is intended for the first animations applied, not for animations layered on top of those. */\r\n\tfirst,\r\n\t/** Transitions from the current value to the timeline value. No change is made before the first key (the current value is\r\n\t * kept until the first key).\r\n\t *\r\n\t * `replace` is intended for animations layered on top of others, not for the first animations applied. */\r\n\treplace,\r\n\t/** Transitions from the current value to the current value plus the timeline value. No change is made before the first key\r\n\t * (the current value is kept until the first key).\r\n\t *\r\n\t * `add` is intended for animations layered on top of others, not for the first animations applied. Properties\r\n\t * keyed by additive animations must be set manually or by another animation before applying the additive animations, else\r\n\t * the property values will increase continually. */\r\n\tadd\r\n}\r\n\r\n/** Indicates whether a timeline's `alpha` is mixing out over time toward 0 (the setup or current pose value) or\r\n * mixing in toward 1 (the timeline's value).\r\n *\r\n * See Timeline {@link Timeline#apply(Skeleton, float, float, Array, float, MixBlend, MixDirection)}. */\r\nexport enum MixDirection {\r\n\tmixIn, mixOut\r\n}\r\n\r\nexport enum TimelineType {\r\n\trotate, translate, scale, shear,\r\n\tattachment, color, deform,\r\n\tevent, drawOrder,\r\n\tikConstraint, transformConstraint,\r\n\tpathConstraintPosition, pathConstraintSpacing, pathConstraintMix,\r\n\ttwoColor\r\n}\r\n\r\n/** The base class for timelines that use interpolation between key frame values. */\r\nexport abstract class CurveTimeline implements Timeline {\r\n\tstatic LINEAR = 0; static STEPPED = 1; static BEZIER = 2;\r\n\tstatic BEZIER_SIZE = 10 * 2 - 1;\r\n\r\n\tprivate curves: ArrayLike<number>; // type, x, y, ...\r\n\r\n\tabstract getPropertyId(): number;\r\n\r\n\tconstructor (frameCount: number) {\r\n\t\tif (frameCount <= 0) throw new Error(\"frameCount must be > 0: \" + frameCount);\r\n\t\tthis.curves = Utils.newFloatArray((frameCount - 1) * CurveTimeline.BEZIER_SIZE);\r\n\t}\r\n\r\n\t/** The number of key frames for this timeline. */\r\n\tgetFrameCount () {\r\n\t\treturn this.curves.length / CurveTimeline.BEZIER_SIZE + 1;\r\n\t}\r\n\r\n\t/** Sets the specified key frame to linear interpolation. */\r\n\tsetLinear (frameIndex: number) {\r\n\t\tthis.curves[frameIndex * CurveTimeline.BEZIER_SIZE] = CurveTimeline.LINEAR;\r\n\t}\r\n\r\n\t/** Sets the specified key frame to stepped interpolation. */\r\n\tsetStepped (frameIndex: number) {\r\n\t\tthis.curves[frameIndex * CurveTimeline.BEZIER_SIZE] = CurveTimeline.STEPPED;\r\n\t}\r\n\r\n\t/** Returns the interpolation type for the specified key frame.\r\n\t * @returns Linear is 0, stepped is 1, Bezier is 2. */\r\n\tgetCurveType (frameIndex: number): number {\r\n\t\tlet index = frameIndex * CurveTimeline.BEZIER_SIZE;\r\n\t\tif (index == this.curves.length) return CurveTimeline.LINEAR;\r\n\t\tlet type = this.curves[index];\r\n\t\tif (type == CurveTimeline.LINEAR) return CurveTimeline.LINEAR;\r\n\t\tif (type == CurveTimeline.STEPPED) return CurveTimeline.STEPPED;\r\n\t\treturn CurveTimeline.BEZIER;\r\n\t}\r\n\r\n\t/** Sets the specified key frame to Bezier interpolation. `cx1` and `cx2` are from 0 to 1,\r\n\t * representing the percent of time between the two key frames. `cy1` and `cy2` are the percent of the\r\n\t * difference between the key frame's values. */\r\n\tsetCurve (frameIndex: number, cx1: number, cy1: number, cx2: number, cy2: number) {\r\n\t\tlet tmpx = (-cx1 * 2 + cx2) * 0.03, tmpy = (-cy1 * 2 + cy2) * 0.03;\r\n\t\tlet dddfx = ((cx1 - cx2) * 3 + 1) * 0.006, dddfy = ((cy1 - cy2) * 3 + 1) * 0.006;\r\n\t\tlet ddfx = tmpx * 2 + dddfx, ddfy = tmpy * 2 + dddfy;\r\n\t\tlet dfx = cx1 * 0.3 + tmpx + dddfx * 0.16666667, dfy = cy1 * 0.3 + tmpy + dddfy * 0.16666667;\r\n\r\n\t\tlet i = frameIndex * CurveTimeline.BEZIER_SIZE;\r\n\t\tlet curves = this.curves;\r\n\t\tcurves[i++] = CurveTimeline.BEZIER;\r\n\r\n\t\tlet x = dfx, y = dfy;\r\n\t\tfor (let n = i + CurveTimeline.BEZIER_SIZE - 1; i < n; i += 2) {\r\n\t\t\tcurves[i] = x;\r\n\t\t\tcurves[i + 1] = y;\r\n\t\t\tdfx += ddfx;\r\n\t\t\tdfy += ddfy;\r\n\t\t\tddfx += dddfx;\r\n\t\t\tddfy += dddfy;\r\n\t\t\tx += dfx;\r\n\t\t\ty += dfy;\r\n\t\t}\r\n\t}\r\n\r\n\t/** Returns the interpolated percentage for the specified key frame and linear percentage. */\r\n\tgetCurvePercent (frameIndex: number, percent: number) {\r\n\t\tpercent = MathUtils.clamp(percent, 0, 1);\r\n\t\tlet curves = this.curves;\r\n\t\tlet i = frameIndex * CurveTimeline.BEZIER_SIZE;\r\n\t\tlet type = curves[i];\r\n\t\tif (type == CurveTimeline.LINEAR) return percent;\r\n\t\tif (type == CurveTimeline.STEPPED) return 0;\r\n\t\ti++;\r\n\t\tlet x = 0;\r\n\t\tfor (let start = i, n = i + CurveTimeline.BEZIER_SIZE - 1; i < n; i += 2) {\r\n\t\t\tx = curves[i];\r\n\t\t\tif (x >= percent) {\r\n\t\t\t\tlet prevX: number, prevY: number;\r\n\t\t\t\tif (i == start) {\r\n\t\t\t\t\tprevX = 0;\r\n\t\t\t\t\tprevY = 0;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tprevX = curves[i - 2];\r\n\t\t\t\t\tprevY = curves[i - 1];\r\n\t\t\t\t}\r\n\t\t\t\treturn prevY + (curves[i + 1] - prevY) * (percent - prevX) / (x - prevX);\r\n\t\t\t}\r\n\t\t}\r\n\t\tlet y = curves[i - 1];\r\n\t\treturn y + (1 - y) * (percent - x) / (1 - x); // Last point is 1,1.\r\n\t}\r\n\r\n\tabstract apply (skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;\r\n}\r\n\r\n/** Changes a bone's local {@link Bone#rotation}. */\r\nexport class RotateTimeline extends CurveTimeline {\r\n\tstatic ENTRIES = 2;\r\n\tstatic PREV_TIME = -2; static PREV_ROTATION = -1;\r\n\tstatic ROTATION = 1;\r\n\r\n\t/** The index of the bone in {@link Skeleton#bones} that will be changed. */\r\n\tboneIndex: number;\r\n\r\n\t/** The time in seconds and rotation in degrees for each key frame. */\r\n\tframes: ArrayLike<number>; // time, degrees, ...\r\n\r\n\tconstructor (frameCount: number) {\r\n\t\tsuper(frameCount);\r\n\t\tthis.frames = Utils.newFloatArray(frameCount << 1);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn (TimelineType.rotate << 24) + this.boneIndex;\r\n\t}\r\n\r\n\t/** Sets the time and angle of the specified keyframe. */\r\n\tsetFrame (frameIndex: number, time: number, degrees: number) {\r\n\t\tframeIndex <<= 1;\r\n\t\tthis.frames[frameIndex] = time;\r\n\t\tthis.frames[frameIndex + RotateTimeline.ROTATION] = degrees;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet frames = this.frames;\r\n\r\n\t\tlet bone = skeleton.bones[this.boneIndex];\r\n\t\tif (!bone.active) return;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup:\r\n\t\t\t\tbone.rotation = bone.data.rotation;\r\n\t\t\t\treturn;\r\n\t\t\tcase MixBlend.first:\r\n\t\t\t\tlet r = bone.data.rotation - bone.rotation;\r\n\t\t\t\tbone.rotation += (r - (16384 - ((16384.499999999996 - r / 360) | 0)) * 360) * alpha;\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (time >= frames[frames.length - RotateTimeline.ENTRIES]) { // Time is after last frame.\r\n\t\t\tlet r = frames[frames.length + RotateTimeline.PREV_ROTATION];\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup:\r\n\t\t\t\tbone.rotation = bone.data.rotation + r * alpha;\r\n\t\t\t\tbreak;\r\n\t\t\tcase MixBlend.first:\r\n\t\t\tcase MixBlend.replace:\r\n\t\t\t\tr += bone.data.rotation - bone.rotation;\r\n\t\t\t\tr -= (16384 - ((16384.499999999996 - r / 360) | 0)) * 360; // Wrap within -180 and 180.\r\n\t\t\tcase MixBlend.add:\r\n\t\t\t\tbone.rotation += r * alpha;\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Interpolate between the previous frame and the current frame.\r\n\t\tlet frame = Animation.binarySearch(frames, time, RotateTimeline.ENTRIES);\r\n\t\tlet prevRotation = frames[frame + RotateTimeline.PREV_ROTATION];\r\n\t\tlet frameTime = frames[frame];\r\n\t\tlet percent = this.getCurvePercent((frame >> 1) - 1,\r\n\t\t\t1 - (time - frameTime) / (frames[frame + RotateTimeline.PREV_TIME] - frameTime));\r\n\r\n\t\tlet r = frames[frame + RotateTimeline.ROTATION] - prevRotation;\r\n\t\tr = prevRotation + (r - (16384 - ((16384.499999999996 - r / 360) | 0)) * 360) * percent;\r\n\t\tswitch (blend) {\r\n\t\tcase MixBlend.setup:\r\n\t\t\tbone.rotation = bone.data.rotation + (r - (16384 - ((16384.499999999996 - r / 360) | 0)) * 360) * alpha;\r\n\t\t\tbreak;\r\n\t\tcase MixBlend.first:\r\n\t\tcase MixBlend.replace:\r\n\t\t\tr += bone.data.rotation - bone.rotation;\r\n\t\tcase MixBlend.add:\r\n\t\t\tbone.rotation += (r - (16384 - ((16384.499999999996 - r / 360) | 0)) * 360) * alpha;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/** Changes a bone's local {@link Bone#x} and {@link Bone#y}. */\r\nexport class TranslateTimeline extends CurveTimeline {\r\n\tstatic ENTRIES = 3;\r\n\tstatic PREV_TIME = -3; static PREV_X = -2; static PREV_Y = -1;\r\n\tstatic X = 1; static Y = 2;\r\n\r\n\t/** The index of the bone in {@link Skeleton#bones} that will be changed. */\r\n\tboneIndex: number;\r\n\r\n\t/** The time in seconds, x, and y values for each key frame. */\r\n\tframes: ArrayLike<number>; // time, x, y, ...\r\n\r\n\tconstructor (frameCount: number) {\r\n\t\tsuper(frameCount);\r\n\t\tthis.frames = Utils.newFloatArray(frameCount * TranslateTimeline.ENTRIES);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn (TimelineType.translate << 24) + this.boneIndex;\r\n\t}\r\n\r\n\t/** Sets the time in seconds, x, and y values for the specified key frame. */\r\n\tsetFrame (frameIndex: number, time: number, x: number, y: number) {\r\n\t\tframeIndex *= TranslateTimeline.ENTRIES;\r\n\t\tthis.frames[frameIndex] = time;\r\n\t\tthis.frames[frameIndex + TranslateTimeline.X] = x;\r\n\t\tthis.frames[frameIndex + TranslateTimeline.Y] = y;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet frames = this.frames;\r\n\r\n\t\tlet bone = skeleton.bones[this.boneIndex];\r\n\t\tif (!bone.active) return;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup:\r\n\t\t\t\tbone.x = bone.data.x;\r\n\t\t\t\tbone.y = bone.data.y;\r\n\t\t\t\treturn;\r\n\t\t\tcase MixBlend.first:\r\n\t\t\t\tbone.x += (bone.data.x - bone.x) * alpha;\r\n\t\t\t\tbone.y += (bone.data.y - bone.y) * alpha;\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet x = 0, y = 0;\r\n\t\tif (time >= frames[frames.length - TranslateTimeline.ENTRIES]) { // Time is after last frame.\r\n\t\t\tx = frames[frames.length + TranslateTimeline.PREV_X];\r\n\t\t\ty = frames[frames.length + TranslateTimeline.PREV_Y];\r\n\t\t} else {\r\n\t\t\t// Interpolate between the previous frame and the current frame.\r\n\t\t\tlet frame = Animation.binarySearch(frames, time, TranslateTimeline.ENTRIES);\r\n\t\t\tx = frames[frame + TranslateTimeline.PREV_X];\r\n\t\t\ty = frames[frame + TranslateTimeline.PREV_Y];\r\n\t\t\tlet frameTime = frames[frame];\r\n\t\t\tlet percent = this.getCurvePercent(frame / TranslateTimeline.ENTRIES - 1,\r\n\t\t\t\t1 - (time - frameTime) / (frames[frame + TranslateTimeline.PREV_TIME] - frameTime));\r\n\r\n\t\t\tx += (frames[frame + TranslateTimeline.X] - x) * percent;\r\n\t\t\ty += (frames[frame + TranslateTimeline.Y] - y) * percent;\r\n\t\t}\r\n\t\tswitch (blend) {\r\n\t\tcase MixBlend.setup:\r\n\t\t\tbone.x = bone.data.x + x * alpha;\r\n\t\t\tbone.y = bone.data.y + y * alpha;\r\n\t\t\tbreak;\r\n\t\tcase MixBlend.first:\r\n\t\tcase MixBlend.replace:\r\n\t\t\tbone.x += (bone.data.x + x - bone.x) * alpha;\r\n\t\t\tbone.y += (bone.data.y + y - bone.y) * alpha;\r\n\t\t\tbreak;\r\n\t\tcase MixBlend.add:\r\n\t\t\tbone.x += x * alpha;\r\n\t\t\tbone.y += y * alpha;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/** Changes a bone's local {@link Bone#scaleX)} and {@link Bone#scaleY}. */\r\nexport class ScaleTimeline extends TranslateTimeline {\r\n\tconstructor (frameCount: number) {\r\n\t\tsuper(frameCount);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn (TimelineType.scale << 24) + this.boneIndex;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet frames = this.frames;\r\n\r\n\t\tlet bone = skeleton.bones[this.boneIndex];\r\n\t\tif (!bone.active) return;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup:\r\n\t\t\t\tbone.scaleX = bone.data.scaleX;\r\n\t\t\t\tbone.scaleY = bone.data.scaleY;\r\n\t\t\t\treturn;\r\n\t\t\tcase MixBlend.first:\r\n\t\t\t\tbone.scaleX += (bone.data.scaleX - bone.scaleX) * alpha;\r\n\t\t\t\tbone.scaleY += (bone.data.scaleY - bone.scaleY) * alpha;\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet x = 0, y = 0;\r\n\t\tif (time >= frames[frames.length - ScaleTimeline.ENTRIES]) { // Time is after last frame.\r\n\t\t\tx = frames[frames.length + ScaleTimeline.PREV_X] * bone.data.scaleX;\r\n\t\t\ty = frames[frames.length + ScaleTimeline.PREV_Y] * bone.data.scaleY;\r\n\t\t} else {\r\n\t\t\t// Interpolate between the previous frame and the current frame.\r\n\t\t\tlet frame = Animation.binarySearch(frames, time, ScaleTimeline.ENTRIES);\r\n\t\t\tx = frames[frame + ScaleTimeline.PREV_X];\r\n\t\t\ty = frames[frame + ScaleTimeline.PREV_Y];\r\n\t\t\tlet frameTime = frames[frame];\r\n\t\t\tlet percent = this.getCurvePercent(frame / ScaleTimeline.ENTRIES - 1,\r\n\t\t\t\t1 - (time - frameTime) / (frames[frame + ScaleTimeline.PREV_TIME] - frameTime));\r\n\r\n\t\t\tx = (x + (frames[frame + ScaleTimeline.X] - x) * percent) * bone.data.scaleX;\r\n\t\t\ty = (y + (frames[frame + ScaleTimeline.Y] - y) * percent) * bone.data.scaleY;\r\n\t\t}\r\n\t\tif (alpha == 1) {\r\n\t\t\tif (blend == MixBlend.add) {\r\n\t\t\t\tbone.scaleX += x - bone.data.scaleX;\r\n\t\t\t\tbone.scaleY += y - bone.data.scaleY;\r\n\t\t\t} else {\r\n\t\t\t\tbone.scaleX = x;\r\n\t\t\t\tbone.scaleY = y;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tlet bx = 0, by = 0;\r\n\t\t\tif (direction == MixDirection.mixOut) {\r\n\t\t\t\tswitch (blend) {\r\n\t\t\t\tcase MixBlend.setup:\r\n\t\t\t\t\tbx = bone.data.scaleX;\r\n\t\t\t\t\tby = bone.data.scaleY;\r\n\t\t\t\t\tbone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha;\r\n\t\t\t\t\tbone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase MixBlend.first:\r\n\t\t\t\tcase MixBlend.replace:\r\n\t\t\t\t\tbx = bone.scaleX;\r\n\t\t\t\t\tby = bone.scaleY;\r\n\t\t\t\t\tbone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha;\r\n\t\t\t\t\tbone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase MixBlend.add:\r\n\t\t\t\t\tbx = bone.scaleX;\r\n\t\t\t\t\tby = bone.scaleY;\r\n\t\t\t\t\tbone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bone.data.scaleX) * alpha;\r\n\t\t\t\t\tbone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - bone.data.scaleY) * alpha;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tswitch (blend) {\r\n\t\t\t\tcase MixBlend.setup:\r\n\t\t\t\t\tbx = Math.abs(bone.data.scaleX) * MathUtils.signum(x);\r\n\t\t\t\t\tby = Math.abs(bone.data.scaleY) * MathUtils.signum(y);\r\n\t\t\t\t\tbone.scaleX = bx + (x - bx) * alpha;\r\n\t\t\t\t\tbone.scaleY = by + (y - by) * alpha;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase MixBlend.first:\r\n\t\t\t\tcase MixBlend.replace:\r\n\t\t\t\t\tbx = Math.abs(bone.scaleX) * MathUtils.signum(x);\r\n\t\t\t\t\tby = Math.abs(bone.scaleY) * MathUtils.signum(y);\r\n\t\t\t\t\tbone.scaleX = bx + (x - bx) * alpha;\r\n\t\t\t\t\tbone.scaleY = by + (y - by) * alpha;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase MixBlend.add:\r\n\t\t\t\t\tbx = MathUtils.signum(x);\r\n\t\t\t\t\tby = MathUtils.signum(y);\r\n\t\t\t\t\tbone.scaleX = Math.abs(bone.scaleX) * bx + (x - Math.abs(bone.data.scaleX) * bx) * alpha;\r\n\t\t\t\t\tbone.scaleY = Math.abs(bone.scaleY) * by + (y - Math.abs(bone.data.scaleY) * by) * alpha;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/** Changes a bone's local {@link Bone#shearX} and {@link Bone#shearY}. */\r\nexport class ShearTimeline extends TranslateTimeline {\r\n\tconstructor (frameCount: number) {\r\n\t\tsuper(frameCount);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn (TimelineType.shear << 24) + this.boneIndex;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet frames = this.frames;\r\n\r\n\t\tlet bone = skeleton.bones[this.boneIndex];\r\n\t\tif (!bone.active) return;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup:\r\n\t\t\t\tbone.shearX = bone.data.shearX;\r\n\t\t\t\tbone.shearY = bone.data.shearY;\r\n\t\t\t\treturn;\r\n\t\t\tcase MixBlend.first:\r\n\t\t\t\tbone.shearX += (bone.data.shearX - bone.shearX) * alpha;\r\n\t\t\t\tbone.shearY += (bone.data.shearY - bone.shearY) * alpha;\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet x = 0, y = 0;\r\n\t\tif (time >= frames[frames.length - ShearTimeline.ENTRIES]) { // Time is after last frame.\r\n\t\t\tx = frames[frames.length + ShearTimeline.PREV_X];\r\n\t\t\ty = frames[frames.length + ShearTimeline.PREV_Y];\r\n\t\t} else {\r\n\t\t\t// Interpolate between the previous frame and the current frame.\r\n\t\t\tlet frame = Animation.binarySearch(frames, time, ShearTimeline.ENTRIES);\r\n\t\t\tx = frames[frame + ShearTimeline.PREV_X];\r\n\t\t\ty = frames[frame + ShearTimeline.PREV_Y];\r\n\t\t\tlet frameTime = frames[frame];\r\n\t\t\tlet percent = this.getCurvePercent(frame / ShearTimeline.ENTRIES - 1,\r\n\t\t\t\t1 - (time - frameTime) / (frames[frame + ShearTimeline.PREV_TIME] - frameTime));\r\n\r\n\t\t\tx = x + (frames[frame + ShearTimeline.X] - x) * percent;\r\n\t\t\ty = y + (frames[frame + ShearTimeline.Y] - y) * percent;\r\n\t\t}\r\n\t\tswitch (blend) {\r\n\t\tcase MixBlend.setup:\r\n\t\t\tbone.shearX = bone.data.shearX + x * alpha;\r\n\t\t\tbone.shearY = bone.data.shearY + y * alpha;\r\n\t\t\tbreak;\r\n\t\tcase MixBlend.first:\r\n\t\tcase MixBlend.replace:\r\n\t\t\tbone.shearX += (bone.data.shearX + x - bone.shearX) * alpha;\r\n\t\t\tbone.shearY += (bone.data.shearY + y - bone.shearY) * alpha;\r\n\t\t\tbreak;\r\n\t\tcase MixBlend.add:\r\n\t\t\tbone.shearX += x * alpha;\r\n\t\t\tbone.shearY += y * alpha;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/** Changes a slot's {@link Slot#color}. */\r\nexport class ColorTimeline extends CurveTimeline {\r\n\tstatic ENTRIES = 5;\r\n\tstatic PREV_TIME = -5; static PREV_R = -4; static PREV_G = -3; static PREV_B = -2; static PREV_A = -1;\r\n\tstatic R = 1; static G = 2; static B = 3; static A = 4;\r\n\r\n\t/** The index of the slot in {@link Skeleton#slots} that will be changed. */\r\n\tslotIndex: number;\r\n\r\n\t/** The time in seconds, red, green, blue, and alpha values for each key frame. */\r\n\tframes: ArrayLike<number>; // time, r, g, b, a, ...\r\n\r\n\tconstructor (frameCount: number) {\r\n\t\tsuper(frameCount);\r\n\t\tthis.frames = Utils.newFloatArray(frameCount * ColorTimeline.ENTRIES);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn (TimelineType.color << 24) + this.slotIndex;\r\n\t}\r\n\r\n\t/** Sets the time in seconds, red, green, blue, and alpha for the specified key frame. */\r\n\tsetFrame (frameIndex: number, time: number, r: number, g: number, b: number, a: number) {\r\n\t\tframeIndex *= ColorTimeline.ENTRIES;\r\n\t\tthis.frames[frameIndex] = time;\r\n\t\tthis.frames[frameIndex + ColorTimeline.R] = r;\r\n\t\tthis.frames[frameIndex + ColorTimeline.G] = g;\r\n\t\tthis.frames[frameIndex + ColorTimeline.B] = b;\r\n\t\tthis.frames[frameIndex + ColorTimeline.A] = a;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet slot = skeleton.slots[this.slotIndex];\r\n\t\tif (!slot.bone.active) return;\r\n\t\tlet frames = this.frames;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup:\r\n\t\t\t\tslot.color.setFromColor(slot.data.color);\r\n\t\t\t\treturn;\r\n\t\t\tcase MixBlend.first:\r\n\t\t\t\tlet color = slot.color, setup = slot.data.color;\r\n\t\t\t\tcolor.add((setup.r - color.r) * alpha, (setup.g - color.g) * alpha, (setup.b - color.b) * alpha,\r\n\t\t\t\t\t(setup.a - color.a) * alpha);\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet r = 0, g = 0, b = 0, a = 0;\r\n\t\tif (time >= frames[frames.length - ColorTimeline.ENTRIES]) { // Time is after last frame.\r\n\t\t\tlet i = frames.length;\r\n\t\t\tr = frames[i + ColorTimeline.PREV_R];\r\n\t\t\tg = frames[i + ColorTimeline.PREV_G];\r\n\t\t\tb = frames[i + ColorTimeline.PREV_B];\r\n\t\t\ta = frames[i + ColorTimeline.PREV_A];\r\n\t\t} else {\r\n\t\t\t// Interpolate between the previous frame and the current frame.\r\n\t\t\tlet frame = Animation.binarySearch(frames, time, ColorTimeline.ENTRIES);\r\n\t\t\tr = frames[frame + ColorTimeline.PREV_R];\r\n\t\t\tg = frames[frame + ColorTimeline.PREV_G];\r\n\t\t\tb = frames[frame + ColorTimeline.PREV_B];\r\n\t\t\ta = frames[frame + ColorTimeline.PREV_A];\r\n\t\t\tlet frameTime = frames[frame];\r\n\t\t\tlet percent = this.getCurvePercent(frame / ColorTimeline.ENTRIES - 1,\r\n\t\t\t\t1 - (time - frameTime) / (frames[frame + ColorTimeline.PREV_TIME] - frameTime));\r\n\r\n\t\t\tr += (frames[frame + ColorTimeline.R] - r) * percent;\r\n\t\t\tg += (frames[frame + ColorTimeline.G] - g) * percent;\r\n\t\t\tb += (frames[frame + ColorTimeline.B] - b) * percent;\r\n\t\t\ta += (frames[frame + ColorTimeline.A] - a) * percent;\r\n\t\t}\r\n\t\tif (alpha == 1)\r\n\t\t\tslot.color.set(r, g, b, a);\r\n\t\telse {\r\n\t\t\tlet color = slot.color;\r\n\t\t\tif (blend == MixBlend.setup) color.setFromColor(slot.data.color);\r\n\t\t\tcolor.add((r - color.r) * alpha, (g - color.g) * alpha, (b - color.b) * alpha, (a - color.a) * alpha);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/** Changes a slot's {@link Slot#color} and {@link Slot#darkColor} for two color tinting. */\r\nexport class TwoColorTimeline extends CurveTimeline {\r\n\tstatic ENTRIES = 8;\r\n\tstatic PREV_TIME = -8; static PREV_R = -7; static PREV_G = -6; static PREV_B = -5; static PREV_A = -4;\r\n\tstatic PREV_R2 = -3; static PREV_G2 = -2; static PREV_B2 = -1;\r\n\tstatic R = 1; static G = 2; static B = 3; static A = 4; static R2 = 5; static G2 = 6; static B2 = 7;\r\n\r\n\t/** The index of the slot in {@link Skeleton#slots()} that will be changed. The {@link Slot#darkColor()} must not be\r\n\t * null. */\r\n\tslotIndex: number;\r\n\r\n\t/** The time in seconds, red, green, blue, and alpha values of the color, red, green, blue of the dark color, for each key frame. */\r\n\tframes: ArrayLike<number>; // time, r, g, b, a, r2, g2, b2, ...\r\n\r\n\tconstructor (frameCount: number) {\r\n\t\tsuper(frameCount);\r\n\t\tthis.frames = Utils.newFloatArray(frameCount * TwoColorTimeline.ENTRIES);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn (TimelineType.twoColor << 24) + this.slotIndex;\r\n\t}\r\n\r\n\t/** Sets the time in seconds, light, and dark colors for the specified key frame. */\r\n\tsetFrame (frameIndex: number, time: number, r: number, g: number, b: number, a: number, r2: number, g2: number, b2: number) {\r\n\t\tframeIndex *= TwoColorTimeline.ENTRIES;\r\n\t\tthis.frames[frameIndex] = time;\r\n\t\tthis.frames[frameIndex + TwoColorTimeline.R] = r;\r\n\t\tthis.frames[frameIndex + TwoColorTimeline.G] = g;\r\n\t\tthis.frames[frameIndex + TwoColorTimeline.B] = b;\r\n\t\tthis.frames[frameIndex + TwoColorTimeline.A] = a;\r\n\t\tthis.frames[frameIndex + TwoColorTimeline.R2] = r2;\r\n\t\tthis.frames[frameIndex + TwoColorTimeline.G2] = g2;\r\n\t\tthis.frames[frameIndex + TwoColorTimeline.B2] = b2;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet slot = skeleton.slots[this.slotIndex];\r\n\t\tif (!slot.bone.active) return;\r\n\t\tlet frames = this.frames;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup:\r\n\t\t\t\tslot.color.setFromColor(slot.data.color);\r\n\t\t\t\tslot.darkColor.setFromColor(slot.data.darkColor);\r\n\t\t\t\treturn;\r\n\t\t\tcase MixBlend.first:\r\n\t\t\t\tlet light = slot.color, dark = slot.darkColor, setupLight = slot.data.color, setupDark = slot.data.darkColor;\r\n\t\t\t\tlight.add((setupLight.r - light.r) * alpha, (setupLight.g - light.g) * alpha, (setupLight.b - light.b) * alpha,\r\n\t\t\t\t\t(setupLight.a - light.a) * alpha);\r\n\t\t\t\tdark.add((setupDark.r - dark.r) * alpha, (setupDark.g - dark.g) * alpha, (setupDark.b - dark.b) * alpha, 0);\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet r = 0, g = 0, b = 0, a = 0, r2 = 0, g2 = 0, b2 = 0;\r\n\t\tif (time >= frames[frames.length - TwoColorTimeline.ENTRIES]) { // Time is after last frame.\r\n\t\t\tlet i = frames.length;\r\n\t\t\tr = frames[i + TwoColorTimeline.PREV_R];\r\n\t\t\tg = frames[i + TwoColorTimeline.PREV_G];\r\n\t\t\tb = frames[i + TwoColorTimeline.PREV_B];\r\n\t\t\ta = frames[i + TwoColorTimeline.PREV_A];\r\n\t\t\tr2 = frames[i + TwoColorTimeline.PREV_R2];\r\n\t\t\tg2 = frames[i + TwoColorTimeline.PREV_G2];\r\n\t\t\tb2 = frames[i + TwoColorTimeline.PREV_B2];\r\n\t\t} else {\r\n\t\t\t// Interpolate between the previous frame and the current frame.\r\n\t\t\tlet frame = Animation.binarySearch(frames, time, TwoColorTimeline.ENTRIES);\r\n\t\t\tr = frames[frame + TwoColorTimeline.PREV_R];\r\n\t\t\tg = frames[frame + TwoColorTimeline.PREV_G];\r\n\t\t\tb = frames[frame + TwoColorTimeline.PREV_B];\r\n\t\t\ta = frames[frame + TwoColorTimeline.PREV_A];\r\n\t\t\tr2 = frames[frame + TwoColorTimeline.PREV_R2];\r\n\t\t\tg2 = frames[frame + TwoColorTimeline.PREV_G2];\r\n\t\t\tb2 = frames[frame + TwoColorTimeline.PREV_B2];\r\n\t\t\tlet frameTime = frames[frame];\r\n\t\t\tlet percent = this.getCurvePercent(frame / TwoColorTimeline.ENTRIES - 1,\r\n\t\t\t\t1 - (time - frameTime) / (frames[frame + TwoColorTimeline.PREV_TIME] - frameTime));\r\n\r\n\t\t\tr += (frames[frame + TwoColorTimeline.R] - r) * percent;\r\n\t\t\tg += (frames[frame + TwoColorTimeline.G] - g) * percent;\r\n\t\t\tb += (frames[frame + TwoColorTimeline.B] - b) * percent;\r\n\t\t\ta += (frames[frame + TwoColorTimeline.A] - a) * percent;\r\n\t\t\tr2 += (frames[frame + TwoColorTimeline.R2] - r2) * percent;\r\n\t\t\tg2 += (frames[frame + TwoColorTimeline.G2] - g2) * percent;\r\n\t\t\tb2 += (frames[frame + TwoColorTimeline.B2] - b2) * percent;\r\n\t\t}\r\n\t\tif (alpha == 1) {\r\n\t\t\tslot.color.set(r, g, b, a);\r\n\t\t\tslot.darkColor.set(r2, g2, b2, 1);\r\n\t\t} else {\r\n\t\t\tlet light = slot.color, dark = slot.darkColor;\r\n\t\t\tif (blend == MixBlend.setup) {\r\n\t\t\t\tlight.setFromColor(slot.data.color);\r\n\t\t\t\tdark.setFromColor(slot.data.darkColor);\r\n\t\t\t}\r\n\t\t\tlight.add((r - light.r) * alpha, (g - light.g) * alpha, (b - light.b) * alpha, (a - light.a) * alpha);\r\n\t\t\tdark.add((r2 - dark.r) * alpha, (g2 - dark.g) * alpha, (b2 - dark.b) * alpha, 0);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/** Changes a slot's {@link Slot#attachment}. */\r\nexport class AttachmentTimeline implements Timeline {\r\n\t/** The index of the slot in {@link Skeleton#slots} that will be changed. */\r\n\tslotIndex: number;\r\n\r\n\t/** The time in seconds for each key frame. */\r\n\tframes: ArrayLike<number> // time, ...\r\n\r\n\t/** The attachment name for each key frame. May contain null values to clear the attachment. */\r\n\tattachmentNames: Array<string>;\r\n\r\n\tconstructor (frameCount: number) {\r\n\t\tthis.frames = Utils.newFloatArray(frameCount);\r\n\t\tthis.attachmentNames = new Array<string>(frameCount);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn (TimelineType.attachment << 24) + this.slotIndex;\r\n\t}\r\n\r\n\t/** The number of key frames for this timeline. */\r\n\tgetFrameCount () {\r\n\t\treturn this.frames.length;\r\n\t}\r\n\r\n\t/** Sets the time in seconds and the attachment name for the specified key frame. */\r\n\tsetFrame (frameIndex: number, time: number, attachmentName: string) {\r\n\t\tthis.frames[frameIndex] = time;\r\n\t\tthis.attachmentNames[frameIndex] = attachmentName;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet slot = skeleton.slots[this.slotIndex];\r\n\t\tif (!slot.bone.active) return;\r\n\t\tif (direction == MixDirection.mixOut) {\r\n\t\t\tif (blend == MixBlend.setup)\r\n\t\t\t\tthis.setAttachment(skeleton, slot, slot.data.attachmentName);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet frames = this.frames;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tif (blend == MixBlend.setup || blend == MixBlend.first) this.setAttachment(skeleton, slot, slot.data.attachmentName);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet frameIndex = 0;\r\n\t\tif (time >= frames[frames.length - 1]) // Time is after last frame.\r\n\t\t\tframeIndex = frames.length - 1;\r\n\t\telse\r\n\t\t\tframeIndex = Animation.binarySearch(frames, time, 1) - 1;\r\n\r\n\t\tlet attachmentName = this.attachmentNames[frameIndex];\r\n\t\tskeleton.slots[this.slotIndex]\r\n\t\t\t.setAttachment(attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName));\r\n\t}\r\n\r\n\tsetAttachment(skeleton: Skeleton, slot: Slot, attachmentName: string) {\r\n\t\tslot.attachment = attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName);\r\n\t}\r\n}\r\n\r\nlet zeros : ArrayLike<number> = null;\r\n\r\n/** Changes a slot's {@link Slot#deform} to deform a {@link VertexAttachment}. */\r\nexport class DeformTimeline extends CurveTimeline {\r\n\t/** The index of the slot in {@link Skeleton#getSlots()} that will be changed. */\r\n\tslotIndex: number;\r\n\r\n\t/** The attachment that will be deformed. */\r\n\tattachment: VertexAttachment;\r\n\r\n\t/** The time in seconds for each key frame. */\r\n\tframes: ArrayLike<number>; // time, ...\r\n\r\n\t/** The vertices for each key frame. */\r\n\tframeVertices: Array<ArrayLike<number>>;\r\n\r\n\tconstructor (frameCount: number) {\r\n\t\tsuper(frameCount);\r\n\t\tthis.frames = Utils.newFloatArray(frameCount);\r\n\t\tthis.frameVertices = new Array<ArrayLike<number>>(frameCount);\r\n\t\tif (zeros == null) zeros = Utils.newFloatArray(64);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn (TimelineType.deform << 27) + + this.attachment.id + this.slotIndex;\r\n\t}\r\n\r\n\t/** Sets the time in seconds and the vertices for the specified key frame.\r\n\t * @param vertices Vertex positions for an unweighted VertexAttachment, or deform offsets if it has weights. */\r\n\tsetFrame (frameIndex: number, time: number, vertices: ArrayLike<number>) {\r\n\t\tthis.frames[frameIndex] = time;\r\n\t\tthis.frameVertices[frameIndex] = vertices;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet slot: Slot = skeleton.slots[this.slotIndex];\r\n\t\tif (!slot.bone.active) return;\r\n\t\tlet slotAttachment: Attachment = slot.getAttachment();\r\n\t\tif (!(slotAttachment instanceof VertexAttachment) || !((<VertexAttachment>slotAttachment).deformAttachment == this.attachment)) return;\r\n\r\n\t\tlet deformArray: Array<number> = slot.deform;\r\n\t\tif (deformArray.length == 0) blend = MixBlend.setup;\r\n\r\n\t\tlet frameVertices = this.frameVertices;\r\n\t\tlet vertexCount = frameVertices[0].length;\r\n\r\n\t\tlet frames = this.frames;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tlet vertexAttachment = <VertexAttachment>slotAttachment;\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup:\r\n\t\t\t\tdeformArray.length = 0;\r\n\t\t\t\treturn;\r\n\t\t\tcase MixBlend.first:\r\n\t\t\t\tif (alpha == 1) {\r\n\t\t\t\t\tdeformArray.length = 0;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tlet deform: Array<number> = Utils.setArraySize(deformArray, vertexCount);\r\n\t\t\t\tif (vertexAttachment.bones == null) {\r\n\t\t\t\t\t// Unweighted vertex positions.\r\n\t\t\t\t\tlet setupVertices = vertexAttachment.vertices;\r\n\t\t\t\t\tfor (var i = 0; i < vertexCount; i++)\r\n\t\t\t\t\t\tdeform[i] += (setupVertices[i] - deform[i]) * alpha;\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// Weighted deform offsets.\r\n\t\t\t\t\talpha = 1 - alpha;\r\n\t\t\t\t\tfor (var i = 0; i < vertexCount; i++)\r\n\t\t\t\t\t\tdeform[i] *= alpha;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet deform: Array<number> = Utils.setArraySize(deformArray, vertexCount);\r\n\t\tif (time >= frames[frames.length - 1]) { // Time is after last frame.\r\n\t\t\tlet lastVertices = frameVertices[frames.length - 1];\r\n\t\t\tif (alpha == 1) {\r\n\t\t\t\tif (blend == MixBlend.add) {\r\n\t\t\t\t\tlet vertexAttachment = slotAttachment as VertexAttachment;\r\n\t\t\t\t\tif (vertexAttachment.bones == null) {\r\n\t\t\t\t\t\t// Unweighted vertex positions, with alpha.\r\n\t\t\t\t\t\tlet setupVertices = vertexAttachment.vertices;\r\n\t\t\t\t\t\tfor (let i = 0; i < vertexCount; i++) {\r\n\t\t\t\t\t\t\tdeform[i] += lastVertices[i] - setupVertices[i];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// Weighted deform offsets, with alpha.\r\n\t\t\t\t\t\tfor (let i = 0; i < vertexCount; i++)\r\n\t\t\t\t\t\t\tdeform[i] += lastVertices[i];\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tUtils.arrayCopy(lastVertices, 0, deform, 0, vertexCount);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tswitch (blend) {\r\n\t\t\t\tcase MixBlend.setup: {\r\n\t\t\t\t\tlet vertexAttachment = slotAttachment as VertexAttachment;\r\n\t\t\t\t\tif (vertexAttachment.bones == null) {\r\n\t\t\t\t\t\t// Unweighted vertex positions, with alpha.\r\n\t\t\t\t\t\tlet setupVertices = vertexAttachment.vertices;\r\n\t\t\t\t\t\tfor (let i = 0; i < vertexCount; i++) {\r\n\t\t\t\t\t\t\tlet setup = setupVertices[i];\r\n\t\t\t\t\t\t\tdeform[i] = setup + (lastVertices[i] - setup) * alpha;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// Weighted deform offsets, with alpha.\r\n\t\t\t\t\t\tfor (let i = 0; i < vertexCount; i++)\r\n\t\t\t\t\t\t\tdeform[i] = lastVertices[i] * alpha;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tcase MixBlend.first:\r\n\t\t\t\tcase MixBlend.replace:\r\n\t\t\t\t\tfor (let i = 0; i < vertexCount; i++)\r\n\t\t\t\t\t\tdeform[i] += (lastVertices[i] - deform[i]) * alpha;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase MixBlend.add:\r\n\t\t\t\t\tlet vertexAttachment = slotAttachment as VertexAttachment;\r\n\t\t\t\t\tif (vertexAttachment.bones == null) {\r\n\t\t\t\t\t\t// Unweighted vertex positions, with alpha.\r\n\t\t\t\t\t\tlet setupVertices = vertexAttachment.vertices;\r\n\t\t\t\t\t\tfor (let i = 0; i < vertexCount; i++) {\r\n\t\t\t\t\t\t\tdeform[i] += (lastVertices[i] - setupVertices[i]) * alpha;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// Weighted deform offsets, with alpha.\r\n\t\t\t\t\t\tfor (let i = 0; i < vertexCount; i++)\r\n\t\t\t\t\t\t\tdeform[i] += lastVertices[i] * alpha;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Interpolate between the previous frame and the current frame.\r\n\t\tlet frame = Animation.binarySearch(frames, time);\r\n\t\tlet prevVertices = frameVertices[frame - 1];\r\n\t\tlet nextVertices = frameVertices[frame];\r\n\t\tlet frameTime = frames[frame];\r\n\t\tlet percent = this.getCurvePercent(frame - 1, 1 - (time - frameTime) / (frames[frame - 1] - frameTime));\r\n\r\n\t\tif (alpha == 1) {\r\n\t\t\tif (blend == MixBlend.add) {\r\n\t\t\t\tlet vertexAttachment = slotAttachment as VertexAttachment;\r\n\t\t\t\tif (vertexAttachment.bones == null) {\r\n\t\t\t\t\t// Unweighted vertex positions, with alpha.\r\n\t\t\t\t\tlet setupVertices = vertexAttachment.vertices;\r\n\t\t\t\t\tfor (let i = 0; i < vertexCount; i++) {\r\n\t\t\t\t\t\tlet prev = prevVertices[i];\r\n\t\t\t\t\t\tdeform[i] += prev + (nextVertices[i] - prev) * percent - setupVertices[i];\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// Weighted deform offsets, with alpha.\r\n\t\t\t\t\tfor (let i = 0; i < vertexCount; i++) {\r\n\t\t\t\t\t\tlet prev = prevVertices[i];\r\n\t\t\t\t\t\tdeform[i] += prev + (nextVertices[i] - prev) * percent;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tfor (let i = 0; i < vertexCount; i++) {\r\n\t\t\t\t\tlet prev = prevVertices[i];\r\n\t\t\t\t\tdeform[i] = prev + (nextVertices[i] - prev) * percent;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup: {\r\n\t\t\t\tlet vertexAttachment = slotAttachment as VertexAttachment;\r\n\t\t\t\tif (vertexAttachment.bones == null) {\r\n\t\t\t\t\t// Unweighted vertex positions, with alpha.\r\n\t\t\t\t\tlet setupVertices = vertexAttachment.vertices;\r\n\t\t\t\t\tfor (let i = 0; i < vertexCount; i++) {\r\n\t\t\t\t\t\tlet prev = prevVertices[i], setup = setupVertices[i];\r\n\t\t\t\t\t\tdeform[i] = setup + (prev + (nextVertices[i] - prev) * percent - setup) * alpha;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// Weighted deform offsets, with alpha.\r\n\t\t\t\t\tfor (let i = 0; i < vertexCount; i++) {\r\n\t\t\t\t\t\tlet prev = prevVertices[i];\r\n\t\t\t\t\t\tdeform[i] = (prev + (nextVertices[i] - prev) * percent) * alpha;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tcase MixBlend.first:\r\n\t\t\tcase MixBlend.replace:\r\n\t\t\t\tfor (let i = 0; i < vertexCount; i++) {\r\n\t\t\t\t\tlet prev = prevVertices[i];\r\n\t\t\t\t\tdeform[i] += (prev + (nextVertices[i] - prev) * percent - deform[i]) * alpha;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase MixBlend.add:\r\n\t\t\t\tlet vertexAttachment = slotAttachment as VertexAttachment;\r\n\t\t\t\tif (vertexAttachment.bones == null) {\r\n\t\t\t\t\t// Unweighted vertex positions, with alpha.\r\n\t\t\t\t\tlet setupVertices = vertexAttachment.vertices;\r\n\t\t\t\t\tfor (let i = 0; i < vertexCount; i++) {\r\n\t\t\t\t\t\tlet prev = prevVertices[i];\r\n\t\t\t\t\t\tdeform[i] += (prev + (nextVertices[i] - prev) * percent - setupVertices[i]) * alpha;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// Weighted deform offsets, with alpha.\r\n\t\t\t\t\tfor (let i = 0; i < vertexCount; i++) {\r\n\t\t\t\t\t\tlet prev = prevVertices[i];\r\n\t\t\t\t\t\tdeform[i] += (prev + (nextVertices[i] - prev) * percent) * alpha;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/** Fires an {@link Event} when specific animation times are reached. */\r\nexport class EventTimeline implements Timeline {\r\n\t/** The time in seconds for each key frame. */\r\n\tframes: ArrayLike<number>; // time, ...\r\n\r\n\t/** The event for each key frame. */\r\n\tevents: Array<Event>;\r\n\r\n\tconstructor (frameCount: number) {\r\n\t\tthis.frames = Utils.newFloatArray(frameCount);\r\n\t\tthis.events = new Array<Event>(frameCount);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn TimelineType.event << 24;\r\n\t}\r\n\r\n\t/** The number of key frames for this timeline. */\r\n\tgetFrameCount () {\r\n\t\treturn this.frames.length;\r\n\t}\r\n\r\n\t/** Sets the time in seconds and the event for the specified key frame. */\r\n\tsetFrame (frameIndex: number, event: Event) {\r\n\t\tthis.frames[frameIndex] = event.time;\r\n\t\tthis.events[frameIndex] = event;\r\n\t}\r\n\r\n\t/** Fires events for frames > `lastTime` and <= `time`. */\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tif (firedEvents == null) return;\r\n\t\tlet frames = this.frames;\r\n\t\tlet frameCount = this.frames.length;\r\n\r\n\t\tif (lastTime > time) { // Fire events after last time for looped animations.\r\n\t\t\tthis.apply(skeleton, lastTime, Number.MAX_VALUE, firedEvents, alpha, blend, direction);\r\n\t\t\tlastTime = -1;\r\n\t\t} else if (lastTime >= frames[frameCount - 1]) // Last time is after last frame.\r\n\t\t\treturn;\r\n\t\tif (time < frames[0]) return; // Time is before first frame.\r\n\r\n\t\tlet frame = 0;\r\n\t\tif (lastTime < frames[0])\r\n\t\t\tframe = 0;\r\n\t\telse {\r\n\t\t\tframe = Animation.binarySearch(frames, lastTime);\r\n\t\t\tlet frameTime = frames[frame];\r\n\t\t\twhile (frame > 0) { // Fire multiple events with the same frame.\r\n\t\t\t\tif (frames[frame - 1] != frameTime) break;\r\n\t\t\t\tframe--;\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor (; frame < frameCount && time >= frames[frame]; frame++)\r\n\t\t\tfiredEvents.push(this.events[frame]);\r\n\t}\r\n}\r\n\r\n/** Changes a skeleton's {@link Skeleton#drawOrder}. */\r\nexport class DrawOrderTimeline implements Timeline {\r\n\t/** The time in seconds for each key frame. */\r\n\tframes: ArrayLike<number>; // time, ...\r\n\r\n\t/** The draw order for each key frame. See {@link #setFrame(int, float, int[])}. */\r\n\tdrawOrders: Array<Array<number>>;\r\n\r\n\tconstructor (frameCount: number) {\r\n\t\tthis.frames = Utils.newFloatArray(frameCount);\r\n\t\tthis.drawOrders = new Array<Array<number>>(frameCount);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn TimelineType.drawOrder << 24;\r\n\t}\r\n\r\n\t/** The number of key frames for this timeline. */\r\n\tgetFrameCount () {\r\n\t\treturn this.frames.length;\r\n\t}\r\n\r\n\t/** Sets the time in seconds and the draw order for the specified key frame.\r\n\t * @param drawOrder For each slot in {@link Skeleton#slots}, the index of the new draw order. May be null to use setup pose\r\n\t * draw order. */\r\n\tsetFrame (frameIndex: number, time: number, drawOrder: Array<number>) {\r\n\t\tthis.frames[frameIndex] = time;\r\n\t\tthis.drawOrders[frameIndex] = drawOrder;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet drawOrder: Array<Slot> = skeleton.drawOrder;\r\n\t\tlet slots: Array<Slot> = skeleton.slots;\r\n\t\tif (direction == MixDirection.mixOut) {\r\n\t\t\tif (blend == MixBlend.setup) Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet frames = this.frames;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tif (blend == MixBlend.setup || blend == MixBlend.first) Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet frame = 0;\r\n\t\tif (time >= frames[frames.length - 1]) // Time is after last frame.\r\n\t\t\tframe = frames.length - 1;\r\n\t\telse\r\n\t\t\tframe = Animation.binarySearch(frames, time) - 1;\r\n\r\n\t\tlet drawOrderToSetupIndex = this.drawOrders[frame];\r\n\t\tif (drawOrderToSetupIndex == null)\r\n\t\t\tUtils.arrayCopy(slots, 0, drawOrder, 0, slots.length);\r\n\t\telse {\r\n\t\t\tfor (let i = 0, n = drawOrderToSetupIndex.length; i < n; i++)\r\n\t\t\t\tdrawOrder[i] = slots[drawOrderToSetupIndex[i]];\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/** Changes an IK constraint's {@link IkConstraint#mix}, {@link IkConstraint#softness},\r\n * {@link IkConstraint#bendDirection}, {@link IkConstraint#stretch}, and {@link IkConstraint#compress}. */\r\nexport class IkConstraintTimeline extends CurveTimeline {\r\n\tstatic ENTRIES = 6;\r\n\tstatic PREV_TIME = -6; static PREV_MIX = -5; static PREV_SOFTNESS = -4; static PREV_BEND_DIRECTION = -3; static PREV_COMPRESS = -2; static PREV_STRETCH = -1;\r\n\tstatic MIX = 1; static SOFTNESS = 2; static BEND_DIRECTION = 3; static COMPRESS = 4; static STRETCH = 5;\r\n\r\n\t/** The index of the IK constraint slot in {@link Skeleton#ikConstraints} that will be changed. */\r\n\tikConstraintIndex: number;\r\n\r\n\t/** The time in seconds, mix, softness, bend direction, compress, and stretch for each key frame. */\r\n\tframes: ArrayLike<number>; // time, mix, softness, bendDirection, compress, stretch, ...\r\n\r\n\tconstructor (frameCount: number) {\r\n\t\tsuper(frameCount);\r\n\t\tthis.frames = Utils.newFloatArray(frameCount * IkConstraintTimeline.ENTRIES);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn (TimelineType.ikConstraint << 24) + this.ikConstraintIndex;\r\n\t}\r\n\r\n\t/** Sets the time in seconds, mix, softness, bend direction, compress, and stretch for the specified key frame. */\r\n\tsetFrame (frameIndex: number, time: number, mix: number, softness: number, bendDirection: number, compress: boolean, stretch: boolean) {\r\n\t\tframeIndex *= IkConstraintTimeline.ENTRIES;\r\n\t\tthis.frames[frameIndex] = time;\r\n\t\tthis.frames[frameIndex + IkConstraintTimeline.MIX] = mix;\r\n\t\tthis.frames[frameIndex + IkConstraintTimeline.SOFTNESS] = softness;\r\n\t\tthis.frames[frameIndex + IkConstraintTimeline.BEND_DIRECTION] = bendDirection;\r\n\t\tthis.frames[frameIndex + IkConstraintTimeline.COMPRESS] = compress ? 1 : 0;\r\n\t\tthis.frames[frameIndex + IkConstraintTimeline.STRETCH] = stretch ? 1 : 0;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet frames = this.frames;\r\n\t\tlet constraint: IkConstraint = skeleton.ikConstraints[this.ikConstraintIndex];\r\n\t\tif (!constraint.active) return;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup:\r\n\t\t\t\tconstraint.mix = constraint.data.mix;\r\n\t\t\t\tconstraint.softness = constraint.data.softness;\r\n\t\t\t\tconstraint.bendDirection = constraint.data.bendDirection;\r\n\t\t\t\tconstraint.compress = constraint.data.compress;\r\n\t\t\t\tconstraint.stretch = constraint.data.stretch;\r\n\t\t\t\treturn;\r\n\t\t\tcase MixBlend.first:\r\n\t\t\t\tconstraint.mix += (constraint.data.mix - constraint.mix) * alpha;\r\n\t\t\t\tconstraint.softness += (constraint.data.softness - constraint.softness) * alpha;\r\n\t\t\t\tconstraint.bendDirection = constraint.data.bendDirection;\r\n\t\t\t\tconstraint.compress = constraint.data.compress;\r\n\t\t\t\tconstraint.stretch = constraint.data.stretch;\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (time >= frames[frames.length - IkConstraintTimeline.ENTRIES]) { // Time is after last frame.\r\n\t\t\tif (blend == MixBlend.setup) {\r\n\t\t\t\tconstraint.mix = constraint.data.mix + (frames[frames.length + IkConstraintTimeline.PREV_MIX] - constraint.data.mix) * alpha;\r\n\t\t\t\tconstraint.softness = constraint.data.softness\r\n\t\t\t\t\t+ (frames[frames.length + IkConstraintTimeline.PREV_SOFTNESS] - constraint.data.softness) * alpha;\r\n\t\t\t\tif (direction == MixDirection.mixOut) {\r\n\t\t\t\t\tconstraint.bendDirection = constraint.data.bendDirection;\r\n\t\t\t\t\tconstraint.compress = constraint.data.compress;\r\n\t\t\t\t\tconstraint.stretch = constraint.data.stretch;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tconstraint.bendDirection = frames[frames.length + IkConstraintTimeline.PREV_BEND_DIRECTION]\r\n\t\t\t\t\tconstraint.compress = frames[frames.length + IkConstraintTimeline.PREV_COMPRESS] != 0;\r\n\t\t\t\t\tconstraint.stretch = frames[frames.length + IkConstraintTimeline.PREV_STRETCH] != 0;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tconstraint.mix += (frames[frames.length + IkConstraintTimeline.PREV_MIX] - constraint.mix) * alpha;\r\n\t\t\t\tconstraint.softness += (frames[frames.length + IkConstraintTimeline.PREV_SOFTNESS] - constraint.softness) * alpha;\r\n\t\t\t\tif (direction == MixDirection.mixIn) {\r\n\t\t\t\t\tconstraint.bendDirection = frames[frames.length + IkConstraintTimeline.PREV_BEND_DIRECTION];\r\n\t\t\t\t\tconstraint.compress = frames[frames.length + IkConstraintTimeline.PREV_COMPRESS] != 0;\r\n\t\t\t\t\tconstraint.stretch = frames[frames.length + IkConstraintTimeline.PREV_STRETCH] != 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Interpolate between the previous frame and the current frame.\r\n\t\tlet frame = Animation.binarySearch(frames, time, IkConstraintTimeline.ENTRIES);\r\n\t\tlet mix = frames[frame + IkConstraintTimeline.PREV_MIX];\r\n\t\tlet softness = frames[frame + IkConstraintTimeline.PREV_SOFTNESS];\r\n\t\tlet frameTime = frames[frame];\r\n\t\tlet percent = this.getCurvePercent(frame / IkConstraintTimeline.ENTRIES - 1,\r\n\t\t\t1 - (time - frameTime) / (frames[frame + IkConstraintTimeline.PREV_TIME] - frameTime));\r\n\r\n\t\tif (blend == MixBlend.setup) {\r\n\t\t\tconstraint.mix = constraint.data.mix + (mix + (frames[frame + IkConstraintTimeline.MIX] - mix) * percent - constraint.data.mix) * alpha;\r\n\t\t\tconstraint.softness = constraint.data.softness\r\n\t\t\t\t+ (softness + (frames[frame + IkConstraintTimeline.SOFTNESS] - softness) * percent - constraint.data.softness) * alpha;\r\n\t\t\tif (direction == MixDirection.mixOut) {\r\n\t\t\t\tconstraint.bendDirection = constraint.data.bendDirection;\r\n\t\t\t\tconstraint.compress = constraint.data.compress;\r\n\t\t\t\tconstraint.stretch = constraint.data.stretch;\r\n\t\t\t} else {\r\n\t\t\t\tconstraint.bendDirection = frames[frame + IkConstraintTimeline.PREV_BEND_DIRECTION];\r\n\t\t\t\tconstraint.compress = frames[frame + IkConstraintTimeline.PREV_COMPRESS] != 0;\r\n\t\t\t\tconstraint.stretch = frames[frame + IkConstraintTimeline.PREV_STRETCH] != 0;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tconstraint.mix += (mix + (frames[frame + IkConstraintTimeline.MIX] - mix) * percent - constraint.mix) * alpha;\r\n\t\t\tconstraint.softness += (softness + (frames[frame + IkConstraintTimeline.SOFTNESS] - softness) * percent - constraint.softness) * alpha;\r\n\t\t\tif (direction == MixDirection.mixIn) {\r\n\t\t\t\tconstraint.bendDirection = frames[frame + IkConstraintTimeline.PREV_BEND_DIRECTION];\r\n\t\t\t\tconstraint.compress = frames[frame + IkConstraintTimeline.PREV_COMPRESS] != 0;\r\n\t\t\t\tconstraint.stretch = frames[frame + IkConstraintTimeline.PREV_STRETCH] != 0;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/** Changes a transform constraint's {@link TransformConstraint#rotateMix}, {@link TransformConstraint#translateMix},\r\n * {@link TransformConstraint#scaleMix}, and {@link TransformConstraint#shearMix}. */\r\nexport class TransformConstraintTimeline extends CurveTimeline {\r\n\tstatic ENTRIES = 5;\r\n\tstatic PREV_TIME = -5; static PREV_ROTATE = -4; static PREV_TRANSLATE = -3; static PREV_SCALE = -2; static PREV_SHEAR = -1;\r\n\tstatic ROTATE = 1; static TRANSLATE = 2; static SCALE = 3; static SHEAR = 4;\r\n\r\n\t/** The index of the transform constraint slot in {@link Skeleton#transformConstraints} that will be changed. */\r\n\ttransformConstraintIndex: number;\r\n\r\n\t/** The time in seconds, rotate mix, translate mix, scale mix, and shear mix for each key frame. */\r\n\tframes: ArrayLike<number>; // time, rotate mix, translate mix, scale mix, shear mix, ...\r\n\r\n\tconstructor (frameCount: number) {\r\n\t\tsuper(frameCount);\r\n\t\tthis.frames = Utils.newFloatArray(frameCount * TransformConstraintTimeline.ENTRIES);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn (TimelineType.transformConstraint << 24) + this.transformConstraintIndex;\r\n\t}\r\n\r\n\t/** The time in seconds, rotate mix, translate mix, scale mix, and shear mix for the specified key frame. */\r\n\tsetFrame (frameIndex: number, time: number, rotateMix: number, translateMix: number, scaleMix: number, shearMix: number) {\r\n\t\tframeIndex *= TransformConstraintTimeline.ENTRIES;\r\n\t\tthis.frames[frameIndex] = time;\r\n\t\tthis.frames[frameIndex + TransformConstraintTimeline.ROTATE] = rotateMix;\r\n\t\tthis.frames[frameIndex + TransformConstraintTimeline.TRANSLATE] = translateMix;\r\n\t\tthis.frames[frameIndex + TransformConstraintTimeline.SCALE] = scaleMix;\r\n\t\tthis.frames[frameIndex + TransformConstraintTimeline.SHEAR] = shearMix;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet frames = this.frames;\r\n\r\n\t\tlet constraint: TransformConstraint = skeleton.transformConstraints[this.transformConstraintIndex];\r\n\t\tif (!constraint.active) return;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tlet data = constraint.data;\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup:\r\n\t\t\t\tconstraint.rotateMix = data.rotateMix;\r\n\t\t\t\tconstraint.translateMix = data.translateMix;\r\n\t\t\t\tconstraint.scaleMix = data.scaleMix;\r\n\t\t\t\tconstraint.shearMix = data.shearMix;\r\n\t\t\t\treturn;\r\n\t\t\tcase MixBlend.first:\r\n\t\t\t\tconstraint.rotateMix += (data.rotateMix - constraint.rotateMix) * alpha;\r\n\t\t\t\tconstraint.translateMix += (data.translateMix - constraint.translateMix) * alpha;\r\n\t\t\t\tconstraint.scaleMix += (data.scaleMix - constraint.scaleMix) * alpha;\r\n\t\t\t\tconstraint.shearMix += (data.shearMix - constraint.shearMix) * alpha;\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet rotate = 0, translate = 0, scale = 0, shear = 0;\r\n\t\tif (time >= frames[frames.length - TransformConstraintTimeline.ENTRIES]) { // Time is after last frame.\r\n\t\t\tlet i = frames.length;\r\n\t\t\trotate = frames[i + TransformConstraintTimeline.PREV_ROTATE];\r\n\t\t\ttranslate = frames[i + TransformConstraintTimeline.PREV_TRANSLATE];\r\n\t\t\tscale = frames[i + TransformConstraintTimeline.PREV_SCALE];\r\n\t\t\tshear = frames[i + TransformConstraintTimeline.PREV_SHEAR];\r\n\t\t} else {\r\n\t\t\t// Interpolate between the previous frame and the current frame.\r\n\t\t\tlet frame = Animation.binarySearch(frames, time, TransformConstraintTimeline.ENTRIES);\r\n\t\t\trotate = frames[frame + TransformConstraintTimeline.PREV_ROTATE];\r\n\t\t\ttranslate = frames[frame + TransformConstraintTimeline.PREV_TRANSLATE];\r\n\t\t\tscale = frames[frame + TransformConstraintTimeline.PREV_SCALE];\r\n\t\t\tshear = frames[frame + TransformConstraintTimeline.PREV_SHEAR];\r\n\t\t\tlet frameTime = frames[frame];\r\n\t\t\tlet percent = this.getCurvePercent(frame / TransformConstraintTimeline.ENTRIES - 1,\r\n\t\t\t\t1 - (time - frameTime) / (frames[frame + TransformConstraintTimeline.PREV_TIME] - frameTime));\r\n\r\n\t\t\trotate += (frames[frame + TransformConstraintTimeline.ROTATE] - rotate) * percent;\r\n\t\t\ttranslate += (frames[frame + TransformConstraintTimeline.TRANSLATE] - translate) * percent;\r\n\t\t\tscale += (frames[frame + TransformConstraintTimeline.SCALE] - scale) * percent;\r\n\t\t\tshear += (frames[frame + TransformConstraintTimeline.SHEAR] - shear) * percent;\r\n\t\t}\r\n\t\tif (blend == MixBlend.setup) {\r\n\t\t\tlet data = constraint.data;\r\n\t\t\tconstraint.rotateMix = data.rotateMix + (rotate - data.rotateMix) * alpha;\r\n\t\t\tconstraint.translateMix = data.translateMix + (translate - data.translateMix) * alpha;\r\n\t\t\tconstraint.scaleMix = data.scaleMix + (scale - data.scaleMix) * alpha;\r\n\t\t\tconstraint.shearMix = data.shearMix + (shear - data.shearMix) * alpha;\r\n\t\t} else {\r\n\t\t\tconstraint.rotateMix += (rotate - constraint.rotateMix) * alpha;\r\n\t\t\tconstraint.translateMix += (translate - constraint.translateMix) * alpha;\r\n\t\t\tconstraint.scaleMix += (scale - constraint.scaleMix) * alpha;\r\n\t\t\tconstraint.shearMix += (shear - constraint.shearMix) * alpha;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/** Changes a path constraint's {@link PathConstraint#position}. */\r\nexport class PathConstraintPositionTimeline extends CurveTimeline {\r\n\tstatic ENTRIES = 2;\r\n\tstatic PREV_TIME = -2; static PREV_VALUE = -1;\r\n\tstatic VALUE = 1;\r\n\r\n\t/** The index of the path constraint slot in {@link Skeleton#pathConstraints} that will be changed. */\r\n\tpathConstraintIndex: number;\r\n\r\n\t/** The time in seconds and path constraint position for each key frame. */\r\n\tframes: ArrayLike<number>; // time, position, ...\r\n\r\n\tconstructor (frameCount: number) {\r\n\t\tsuper(frameCount);\r\n\t\tthis.frames = Utils.newFloatArray(frameCount * PathConstraintPositionTimeline.ENTRIES);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn (TimelineType.pathConstraintPosition << 24) + this.pathConstraintIndex;\r\n\t}\r\n\r\n\t/** Sets the time in seconds and path constraint position for the specified key frame. */\r\n\tsetFrame (frameIndex: number, time: number, value: number) {\r\n\t\tframeIndex *= PathConstraintPositionTimeline.ENTRIES;\r\n\t\tthis.frames[frameIndex] = time;\r\n\t\tthis.frames[frameIndex + PathConstraintPositionTimeline.VALUE] = value;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet frames = this.frames;\r\n\t\tlet constraint: PathConstraint = skeleton.pathConstraints[this.pathConstraintIndex];\r\n\t\tif (!constraint.active) return;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup:\r\n\t\t\t\tconstraint.position = constraint.data.position;\r\n\t\t\t\treturn;\r\n\t\t\tcase MixBlend.first:\r\n\t\t\t\tconstraint.position += (constraint.data.position - constraint.position) * alpha;\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet position = 0;\r\n\t\tif (time >= frames[frames.length - PathConstraintPositionTimeline.ENTRIES]) // Time is after last frame.\r\n\t\t\tposition = frames[frames.length + PathConstraintPositionTimeline.PREV_VALUE];\r\n\t\telse {\r\n\t\t\t// Interpolate between the previous frame and the current frame.\r\n\t\t\tlet frame = Animation.binarySearch(frames, time, PathConstraintPositionTimeline.ENTRIES);\r\n\t\t\tposition = frames[frame + PathConstraintPositionTimeline.PREV_VALUE];\r\n\t\t\tlet frameTime = frames[frame];\r\n\t\t\tlet percent = this.getCurvePercent(frame / PathConstraintPositionTimeline.ENTRIES - 1,\r\n\t\t\t\t1 - (time - frameTime) / (frames[frame + PathConstraintPositionTimeline.PREV_TIME] - frameTime));\r\n\r\n\t\t\tposition += (frames[frame + PathConstraintPositionTimeline.VALUE] - position) * percent;\r\n\t\t}\r\n\t\tif (blend == MixBlend.setup)\r\n\t\t\tconstraint.position = constraint.data.position + (position - constraint.data.position) * alpha;\r\n\t\telse\r\n\t\t\tconstraint.position += (position - constraint.position) * alpha;\r\n\t}\r\n}\r\n\r\n/** Changes a path constraint's {@link PathConstraint#spacing}. */\r\nexport class PathConstraintSpacingTimeline extends PathConstraintPositionTimeline {\r\n\tconstructor (frameCount: number) {\r\n\t\tsuper(frameCount);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn (TimelineType.pathConstraintSpacing << 24) + this.pathConstraintIndex;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet frames = this.frames;\r\n\t\tlet constraint: PathConstraint = skeleton.pathConstraints[this.pathConstraintIndex];\r\n\t\tif (!constraint.active) return;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup:\r\n\t\t\t\tconstraint.spacing = constraint.data.spacing;\r\n\t\t\t\treturn;\r\n\t\t\tcase MixBlend.first:\r\n\t\t\t\tconstraint.spacing += (constraint.data.spacing - constraint.spacing) * alpha;\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet spacing = 0;\r\n\t\tif (time >= frames[frames.length - PathConstraintSpacingTimeline.ENTRIES]) // Time is after last frame.\r\n\t\t\tspacing = frames[frames.length + PathConstraintSpacingTimeline.PREV_VALUE];\r\n\t\telse {\r\n\t\t\t// Interpolate between the previous frame and the current frame.\r\n\t\t\tlet frame = Animation.binarySearch(frames, time, PathConstraintSpacingTimeline.ENTRIES);\r\n\t\t\tspacing = frames[frame + PathConstraintSpacingTimeline.PREV_VALUE];\r\n\t\t\tlet frameTime = frames[frame];\r\n\t\t\tlet percent = this.getCurvePercent(frame / PathConstraintSpacingTimeline.ENTRIES - 1,\r\n\t\t\t\t1 - (time - frameTime) / (frames[frame + PathConstraintSpacingTimeline.PREV_TIME] - frameTime));\r\n\r\n\t\t\tspacing += (frames[frame + PathConstraintSpacingTimeline.VALUE] - spacing) * percent;\r\n\t\t}\r\n\r\n\t\tif (blend == MixBlend.setup)\r\n\t\t\tconstraint.spacing = constraint.data.spacing + (spacing - constraint.data.spacing) * alpha;\r\n\t\telse\r\n\t\t\tconstraint.spacing += (spacing - constraint.spacing) * alpha;\r\n\t}\r\n}\r\n\r\n/** Changes a transform constraint's {@link PathConstraint#rotateMix} and\r\n * {@link TransformConstraint#translateMix}. */\r\nexport class PathConstraintMixTimeline extends CurveTimeline {\r\n\tstatic ENTRIES = 3;\r\n\tstatic PREV_TIME = -3; static PREV_ROTATE = -2; static PREV_TRANSLATE = -1;\r\n\tstatic ROTATE = 1; static TRANSLATE = 2;\r\n\r\n\t/** The index of the path constraint slot in {@link Skeleton#getPathConstraints()} that will be changed. */\r\n\tpathConstraintIndex: number;\r\n\r\n\t/** The time in seconds, rotate mix, and translate mix for each key frame. */\r\n\tframes: ArrayLike<number>; // time, rotate mix, translate mix, ...\r\n\r\n\tconstructor (frameCount: number) {\r\n\t\tsuper(frameCount);\r\n\t\tthis.frames = Utils.newFloatArray(frameCount * PathConstraintMixTimeline.ENTRIES);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn (TimelineType.pathConstraintMix << 24) + this.pathConstraintIndex;\r\n\t}\r\n\r\n\t/** The time in seconds, rotate mix, and translate mix for the specified key frame. */\r\n\tsetFrame (frameIndex: number, time: number, rotateMix: number, translateMix: number) {\r\n\t\tframeIndex *= PathConstraintMixTimeline.ENTRIES;\r\n\t\tthis.frames[frameIndex] = time;\r\n\t\tthis.frames[frameIndex + PathConstraintMixTimeline.ROTATE] = rotateMix;\r\n\t\tthis.frames[frameIndex + PathConstraintMixTimeline.TRANSLATE] = translateMix;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet frames = this.frames;\r\n\t\tlet constraint: PathConstraint = skeleton.pathConstraints[this.pathConstraintIndex];\r\n\t\tif (!constraint.active) return;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup:\r\n\t\t\t\tconstraint.rotateMix = constraint.data.rotateMix;\r\n\t\t\t\tconstraint.translateMix = constraint.data.translateMix;\r\n\t\t\t\treturn;\r\n\t\t\tcase MixBlend.first:\r\n\t\t\t\tconstraint.rotateMix += (constraint.data.rotateMix - constraint.rotateMix) * alpha;\r\n\t\t\t\tconstraint.translateMix += (constraint.data.translateMix - constraint.translateMix) * alpha;\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet rotate = 0, translate = 0;\r\n\t\tif (time >= frames[frames.length - PathConstraintMixTimeline.ENTRIES]) { // Time is after last frame.\r\n\t\t\trotate = frames[frames.length + PathConstraintMixTimeline.PREV_ROTATE];\r\n\t\t\ttranslate = frames[frames.length + PathConstraintMixTimeline.PREV_TRANSLATE];\r\n\t\t} else {\r\n\t\t\t// Interpolate between the previous frame and the current frame.\r\n\t\t\tlet frame = Animation.binarySearch(frames, time, PathConstraintMixTimeline.ENTRIES);\r\n\t\t\trotate = frames[frame + PathConstraintMixTimeline.PREV_ROTATE];\r\n\t\t\ttranslate = frames[frame + PathConstraintMixTimeline.PREV_TRANSLATE];\r\n\t\t\tlet frameTime = frames[frame];\r\n\t\t\tlet percent = this.getCurvePercent(frame / PathConstraintMixTimeline.ENTRIES - 1,\r\n\t\t\t\t1 - (time - frameTime) / (frames[frame + PathConstraintMixTimeline.PREV_TIME] - frameTime));\r\n\r\n\t\t\trotate += (frames[frame + PathConstraintMixTimeline.ROTATE] - rotate) * percent;\r\n\t\t\ttranslate += (frames[frame + PathConstraintMixTimeline.TRANSLATE] - translate) * percent;\r\n\t\t}\r\n\r\n\t\tif (blend == MixBlend.setup) {\r\n\t\t\tconstraint.rotateMix = constraint.data.rotateMix + (rotate - constraint.data.rotateMix) * alpha;\r\n\t\t\tconstraint.translateMix = constraint.data.translateMix + (translate - constraint.data.translateMix) * alpha;\r\n\t\t} else {\r\n\t\t\tconstraint.rotateMix += (rotate - constraint.rotateMix) * alpha;\r\n\t\t\tconstraint.translateMix += (translate - constraint.translateMix) * alpha;\r\n\t\t}\r\n\t}\r\n}\r\n","\r\n\r\nimport { Disposable } from \"./Utils\";\r\nimport { Texture, TextureFilter } from \"./Texture\";\r\nimport { TextureWrap, TextureRegion } from \"./Texture\";\r\n\r\n\r\n\texport class TextureAtlas implements Disposable {\r\n\t\tpages = new Array<TextureAtlasPage>();\r\n\t\tregions = new Array<TextureAtlasRegion>();\r\n\r\n\t\tconstructor (atlasText: string, textureLoader: (path: string, width?: number, height?: number) => any) {\r\n\t\t\tthis.load(atlasText, textureLoader);\r\n\t\t}\r\n\r\n\t\tprivate load (atlasText: string, textureLoader: (path: string, width?: number, height?: number) => any) {\r\n\t\t\tif (textureLoader == null)\r\n\t\t\t\tthrow new Error(\"textureLoader cannot be null.\");\r\n\r\n\t\t\tlet reader = new TextureAtlasReader(atlasText);\r\n\t\t\tlet tuple = new Array<string>(4);\r\n\t\t\tlet page:TextureAtlasPage = null;\r\n\t\t\twhile (true) {\r\n\t\t\t\tlet line = reader.readLine();\r\n\t\t\t\tif (line == null)\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tline = line.trim();\r\n\t\t\t\tif (line.length == 0)\r\n\t\t\t\t\tpage = null;\r\n\t\t\t\telse if (!page) {\r\n\t\t\t\t\tpage = new TextureAtlasPage();\r\n\t\t\t\t\tpage.name = line;\r\n\r\n\t\t\t\t\tif (reader.readTuple(tuple) == 2) { // size is only optional for an atlas packed with an old TexturePacker.\r\n\t\t\t\t\t\tpage.width = parseInt(tuple[0]);\r\n\t\t\t\t\t\tpage.height = parseInt(tuple[1]);\r\n\t\t\t\t\t\treader.readTuple(tuple);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// page.format = Format[tuple[0]]; we don't need format in WebGL\r\n\r\n\t\t\t\t\treader.readTuple(tuple);\r\n\t\t\t\t\tpage.minFilter = Texture.filterFromString(tuple[0]);\r\n\t\t\t\t\tpage.magFilter = Texture.filterFromString(tuple[1]);\r\n\r\n\t\t\t\t\tlet direction= reader.readValue();\r\n\t\t\t\t\tpage.uWrap = TextureWrap.ClampToEdge;\r\n\t\t\t\t\tpage.vWrap = TextureWrap.ClampToEdge;\r\n\t\t\t\t\tif (direction == \"x\")\r\n\t\t\t\t\t\tpage.uWrap = TextureWrap.Repeat;\r\n\t\t\t\t\telse if (direction == \"y\")\r\n\t\t\t\t\t\tpage.vWrap = TextureWrap.Repeat;\r\n\t\t\t\t\telse if (direction == \"xy\")\r\n\t\t\t\t\t\tpage.uWrap = page.vWrap = TextureWrap.Repeat;\r\n\r\n\t\t\t\t\tpage.texture = textureLoader(line);\r\n\t\t\t\t\tpage.texture.setFilters(page.minFilter, page.magFilter);\r\n\t\t\t\t\tpage.texture.setWraps(page.uWrap, page.vWrap);\r\n\t\t\t\t\tpage.width = page.texture.getImage().width;\r\n\t\t\t\t\tpage.height = page.texture.getImage().height;\r\n\t\t\t\t\tthis.pages.push(page);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tlet region:TextureAtlasRegion = new TextureAtlasRegion();\r\n\t\t\t\t\tregion.name = line;\r\n\t\t\t\t\tregion.page = page;\r\n\r\n\t\t\t\t\tlet rotateValue = reader.readValue();\r\n\t\t\t\t\tif (rotateValue.toLocaleLowerCase() == \"true\") {\r\n\t\t\t\t\t\tregion.degrees = 90;\r\n\t\t\t\t\t} else if (rotateValue.toLocaleLowerCase() == \"false\") {\r\n\t\t\t\t\t\tregion.degrees = 0;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tregion.degrees = parseFloat(rotateValue);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tregion.rotate = region.degrees == 90;\r\n\r\n\t\t\t\t\treader.readTuple(tuple);\r\n\t\t\t\t\tlet x = parseInt(tuple[0]);\r\n\t\t\t\t\tlet y = parseInt(tuple[1]);\r\n\r\n\t\t\t\t\treader.readTuple(tuple);\r\n\t\t\t\t\tlet width = parseInt(tuple[0]);\r\n\t\t\t\t\tlet height = parseInt(tuple[1]);\r\n\r\n\t\t\t\t\tregion.u = x / page.width;\r\n\t\t\t\t\tregion.v = y / page.height;\r\n\t\t\t\t\tif (region.rotate) {\r\n\t\t\t\t\t\tregion.u2 = (x + height) / page.width;\r\n\t\t\t\t\t\tregion.v2 = (y + width) / page.height;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tregion.u2 = (x + width) / page.width;\r\n\t\t\t\t\t\tregion.v2 = (y + height) / page.height;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tregion.x = x;\r\n\t\t\t\t\tregion.y = y;\r\n\t\t\t\t\tregion.width = Math.abs(width);\r\n\t\t\t\t\tregion.height = Math.abs(height);\r\n\r\n\t\t\t\t\tif (reader.readTuple(tuple) == 4) { // split is optional\r\n\t\t\t\t\t\t// region.splits = new Vector.<int>(parseInt(tuple[0]), parseInt(tuple[1]), parseInt(tuple[2]), parseInt(tuple[3]));\r\n\t\t\t\t\t\tif (reader.readTuple(tuple) == 4) { // pad is optional, but only present with splits\r\n\t\t\t\t\t\t\t//region.pads = Vector.<int>(parseInt(tuple[0]), parseInt(tuple[1]), parseInt(tuple[2]), parseInt(tuple[3]));\r\n\t\t\t\t\t\t\treader.readTuple(tuple);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tregion.originalWidth = parseInt(tuple[0]);\r\n\t\t\t\t\tregion.originalHeight = parseInt(tuple[1]);\r\n\r\n\t\t\t\t\treader.readTuple(tuple);\r\n\t\t\t\t\tregion.offsetX = parseInt(tuple[0]);\r\n\t\t\t\t\tregion.offsetY = parseInt(tuple[1]);\r\n\r\n\t\t\t\t\tregion.index = parseInt(reader.readValue());\r\n\r\n\t\t\t\t\tregion.texture = page.texture;\r\n\t\t\t\t\tthis.regions.push(region);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfindRegion (name: string): TextureAtlasRegion {\r\n\t\t\tfor (let i = 0; i < this.regions.length; i++) {\r\n\t\t\t\tif (this.regions[i].name == name) {\r\n\t\t\t\t\treturn this.regions[i];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn null;\r\n\t\t}\r\n\r\n\t\tdispose () {\r\n\t\t\tfor (let i = 0; i < this.pages.length; i++) {\r\n\t\t\t\tthis.pages[i].texture.dispose();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tclass TextureAtlasReader {\r\n\t\tlines: Array<string>;\r\n\t\tindex: number = 0;\r\n\r\n\t\tconstructor (text: string) {\r\n\t\t\tthis.lines = text.split(/\\r\\n|\\r|\\n/);\r\n\t\t}\r\n\r\n\t\treadLine (): string {\r\n\t\t\tif (this.index >= this.lines.length)\r\n\t\t\t\treturn null;\r\n\t\t\treturn this.lines[this.index++];\r\n\t\t}\r\n\r\n\t\treadValue (): string {\r\n\t\t\tlet line = this.readLine();\r\n\t\t\tlet colon= line.indexOf(\":\");\r\n\t\t\tif (colon == -1)\r\n\t\t\t\tthrow new Error(\"Invalid line: \" + line);\r\n\t\t\treturn line.substring(colon + 1).trim();\r\n\t\t}\r\n\r\n\t\treadTuple (tuple: Array<string>): number {\r\n\t\t\tlet line = this.readLine();\r\n\t\t\tlet colon = line.indexOf(\":\");\r\n\t\t\tif (colon == -1)\r\n\t\t\t\tthrow new Error(\"Invalid line: \" + line);\r\n\t\t\tlet i = 0, lastMatch = colon + 1;\r\n\t\t\tfor (; i < 3; i++) {\r\n\t\t\t\tlet comma = line.indexOf(\",\", lastMatch);\r\n\t\t\t\tif (comma == -1) break;\r\n\t\t\t\ttuple[i] = line.substr(lastMatch, comma - lastMatch).trim();\r\n\t\t\t\tlastMatch = comma + 1;\r\n\t\t\t}\r\n\t\t\ttuple[i] = line.substring(lastMatch).trim();\r\n\t\t\treturn i + 1;\r\n\t\t}\r\n\t}\r\n\r\n\texport class TextureAtlasPage {\r\n\t\tname: string;\r\n\t\tminFilter: TextureFilter;\r\n\t\tmagFilter: TextureFilter;\r\n\t\tuWrap: TextureWrap;\r\n\t\tvWrap: TextureWrap;\r\n\t\ttexture: Texture;\r\n\t\twidth: number;\r\n\t\theight: number;\r\n\t}\r\n\r\n\texport class TextureAtlasRegion extends TextureRegion {\r\n\t\tpage: TextureAtlasPage;\r\n\t\tname: string;\r\n\t\tx: number;\r\n\t\ty: number;\r\n\t\tindex: number;\r\n\t\tdegrees: number;\r\n\t\ttexture: Texture;\r\n\t}\r\n","\r\n\r\nimport { VertexAttachment, Attachment } from \"./Attachment\";\r\nimport { TextureRegion } from \"../Texture\";\r\nimport { Color, Utils, ArrayLike } from \"../Utils\";\r\nimport { TextureAtlasRegion } from \"../TextureAtlas\";\r\n\r\n\r\n/** An attachment that displays a textured mesh. A mesh has hull vertices and internal vertices within the hull. Holes are not\r\n * supported. Each vertex has UVs (texture coordinates) and triangles are used to map an image on to the mesh.\r\n *\r\n * See [Mesh attachments](http://esotericsoftware.com/spine-meshes) in the Spine User Guide. */\r\nexport class MeshAttachment extends VertexAttachment {\r\n\tregion: TextureRegion;\r\n\r\n\t/** The name of the texture region for this attachment. */\r\n\tpath: string;\r\n\r\n\t/** The UV pair for each vertex, normalized within the texture region. */\r\n\tregionUVs: ArrayLike<number>;\r\n\r\n\t/** The UV pair for each vertex, normalized within the entire texture.\r\n\t *\r\n\t * See {@link #updateUVs}. */\r\n\tuvs: ArrayLike<number>;\r\n\r\n\t/** Triplets of vertex indices which describe the mesh's triangulation. */\r\n\ttriangles: Array<number>;\r\n\r\n\t/** The color to tint the mesh. */\r\n\tcolor = new Color(1, 1, 1, 1);\r\n\r\n\t/** The width of the mesh's image. Available only when nonessential data was exported. */\r\n\twidth: number;\r\n\r\n\t/** The height of the mesh's image. Available only when nonessential data was exported. */\r\n\theight: number;\r\n\r\n\t/** The number of entries at the beginning of {@link #vertices} that make up the mesh hull. */\r\n\thullLength: number;\r\n\r\n\t/** Vertex index pairs describing edges for controling triangulation. Mesh triangles will never cross edges. Only available if\r\n\t * nonessential data was exported. Triangulation is not performed at runtime. */\r\n\tedges: Array<number>;\r\n\r\n\tprivate parentMesh: MeshAttachment;\r\n\ttempColor = new Color(0, 0, 0, 0);\r\n\r\n\tconstructor (name: string) {\r\n\t\tsuper(name);\r\n\t}\r\n\r\n\t/** Calculates {@link #uvs} using {@link #regionUVs} and the {@link #region}. Must be called after changing the region UVs or\r\n\t * region. */\r\n\tupdateUVs () {\r\n\t\tlet regionUVs = this.regionUVs;\r\n\t\tif (this.uvs == null || this.uvs.length != regionUVs.length) this.uvs = Utils.newFloatArray(regionUVs.length);\r\n\t\tlet uvs = this.uvs;\r\n\t\tlet n = this.uvs.length;\r\n\t\tlet u = this.region.u, v = this.region.v, width = 0, height = 0;\r\n\t\tif (this.region instanceof TextureAtlasRegion) {\r\n\t\t\tlet region = this.region;\r\n\t\t\tlet textureWidth = region.texture.getImage().width, textureHeight = region.texture.getImage().height;\r\n\t\t\tswitch(region.degrees) {\r\n\t\t\tcase 90:\r\n\t\t\t\tu -= (region.originalHeight - region.offsetY - region.height) / textureWidth;\r\n\t\t\t\tv -= (region.originalWidth - region.offsetX - region.width) / textureHeight;\r\n\t\t\t\twidth = region.originalHeight / textureWidth;\r\n\t\t\t\theight = region.originalWidth / textureHeight;\r\n\t\t\t\tfor (let i = 0; i < n; i += 2) {\r\n\t\t\t\t\tuvs[i] = u + regionUVs[i + 1] * width;\r\n\t\t\t\t\tuvs[i + 1] = v + (1 - regionUVs[i]) * height;\r\n\t\t\t\t}\r\n\t\t\t\treturn;\r\n\t\t\tcase 180:\r\n\t\t\t\tu -= (region.originalWidth - region.offsetX - region.width) / textureWidth;\r\n\t\t\t\tv -= region.offsetY / textureHeight;\r\n\t\t\t\twidth = region.originalWidth / textureWidth;\r\n\t\t\t\theight = region.originalHeight / textureHeight;\r\n\t\t\t\tfor (let i = 0; i < n; i += 2) {\r\n\t\t\t\t\tuvs[i] = u + (1 - regionUVs[i]) * width;\r\n\t\t\t\t\tuvs[i + 1] = v + (1 - regionUVs[i + 1]) * height;\r\n\t\t\t\t}\r\n\t\t\t\treturn;\r\n\t\t\tcase 270:\r\n\t\t\t\tu -= region.offsetY / textureWidth;\r\n\t\t\t\tv -= region.offsetX / textureHeight;\r\n\t\t\t\twidth = region.originalHeight / textureWidth;\r\n\t\t\t\theight = region.originalWidth / textureHeight;\r\n\t\t\t\tfor (let i = 0; i < n; i += 2) {\r\n\t\t\t\t\tuvs[i] = u + (1 - regionUVs[i + 1]) * width;\r\n\t\t\t\t\tuvs[i + 1] = v + regionUVs[i] * height;\r\n\t\t\t\t}\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tu -= region.offsetX / textureWidth;\r\n\t\t\tv -= (region.originalHeight - region.offsetY - region.height) / textureHeight;\r\n\t\t\twidth = region.originalWidth / textureWidth;\r\n\t\t\theight = region.originalHeight / textureHeight;\r\n\t\t} else if (this.region == null) {\r\n\t\t\tu = v = 0;\r\n\t\t\twidth = height = 1;\r\n\t\t} else {\r\n\t\t\twidth = this.region.u2 - u;\r\n\t\t\theight = this.region.v2 - v;\r\n\t\t}\r\n\r\n\t\tfor (let i = 0; i < n; i += 2) {\r\n\t\t\tuvs[i] = u + regionUVs[i] * width;\r\n\t\t\tuvs[i + 1] = v + regionUVs[i + 1] * height;\r\n\t\t}\r\n\t}\r\n\r\n\t/** The parent mesh if this is a linked mesh, else null. A linked mesh shares the {@link #bones}, {@link #vertices},\r\n\t * {@link #regionUVs}, {@link #triangles}, {@link #hullLength}, {@link #edges}, {@link #width}, and {@link #height} with the\r\n\t * parent mesh, but may have a different {@link #name} or {@link #path} (and therefore a different texture). */\r\n\tgetParentMesh () {\r\n\t\treturn this.parentMesh;\r\n\t}\r\n\r\n\t/** @param parentMesh May be null. */\r\n\tsetParentMesh (parentMesh: MeshAttachment) {\r\n\t\tthis.parentMesh = parentMesh;\r\n\t\tif (parentMesh != null) {\r\n\t\t\tthis.bones = parentMesh.bones;\r\n\t\t\tthis.vertices = parentMesh.vertices;\r\n\t\t\tthis.worldVerticesLength = parentMesh.worldVerticesLength;\r\n\t\t\tthis.regionUVs = parentMesh.regionUVs;\r\n\t\t\tthis.triangles = parentMesh.triangles;\r\n\t\t\tthis.hullLength = parentMesh.hullLength;\r\n\t\t\tthis.worldVerticesLength = parentMesh.worldVerticesLength\r\n\t\t}\r\n\t}\r\n\r\n\tcopy (): Attachment {\r\n\t\tif (this.parentMesh != null) return this.newLinkedMesh();\r\n\r\n\t\tlet copy = new MeshAttachment(this.name);\r\n\t\tcopy.region = this.region;\r\n\t\tcopy.path = this.path;\r\n\t\tcopy.color.setFromColor(this.color);\r\n\r\n\t\tthis.copyTo(copy);\r\n\t\tcopy.regionUVs = new Array<number>(this.regionUVs.length);\r\n\t\tUtils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);\r\n\t\tcopy.uvs = new Array<number>(this.uvs.length);\r\n\t\tUtils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);\r\n\t\tcopy.triangles = new Array<number>(this.triangles.length);\r\n\t\tUtils.arrayCopy(this.triangles, 0, copy.triangles, 0, this.triangles.length);\r\n\t\tcopy.hullLength = this.hullLength;\r\n\r\n\t\t// Nonessential.\r\n\t\tif (this.edges != null) {\r\n\t\t\tcopy.edges = new Array<number>(this.edges.length);\r\n\t\t\tUtils.arrayCopy(this.edges, 0, copy.edges, 0, this.edges.length);\r\n\t\t}\r\n\t\tcopy.width = this.width;\r\n\t\tcopy.height = this.height;\r\n\r\n\t\treturn copy;\r\n\t}\r\n\r\n\t/** Returns a new mesh with the {@link #parentMesh} set to this mesh's parent mesh, if any, else to this mesh. **/\r\n\tnewLinkedMesh (): MeshAttachment {\r\n\t\tlet copy = new MeshAttachment(this.name);\r\n\t\tcopy.region = this.region;\r\n\t\tcopy.path = this.path;\r\n\t\tcopy.color.setFromColor(this.color);\r\n\t\tcopy.deformAttachment = this.deformAttachment;\r\n\t\tcopy.setParentMesh(this.parentMesh != null ? this.parentMesh : this);\r\n\t\tcopy.updateUVs();\r\n\t\treturn copy;\r\n\t}\r\n}\r\n\r\n","\r\n\r\nimport { SkeletonData } from \"./SkeletonData\";\r\nimport { Bone } from \"./Bone\";\r\nimport { Slot } from \"./Slot\";\r\nimport { IkConstraint } from \"./IkConstraint\";\r\nimport { TransformConstraint } from \"./TransformConstraint\";\r\nimport { PathConstraint } from \"./PathConstraint\";\r\nimport { Updatable } from \"./Updatable\";\r\nimport { Skin } from \"./Skin\";\r\nimport { Color, Utils, Vector2 } from \"./Utils\";\r\nimport { PathAttachment } from \"./attachments/PathAttachment\";\r\nimport { Attachment } from \"./attachments/Attachment\";\r\nimport { RegionAttachment } from \"./attachments/RegionAttachment\";\r\nimport { MeshAttachment } from \"./attachments/MeshAttachment\";\r\n\r\n/** Stores the current pose for a skeleton.\r\n *\r\n * See [Instance objects](http://esotericsoftware.com/spine-runtime-architecture#Instance-objects) in the Spine Runtimes Guide. */\r\nexport class Skeleton {\r\n\t/** The skeleton's setup pose data. */\r\n\tdata: SkeletonData;\r\n\r\n\t/** The skeleton's bones, sorted parent first. The root bone is always the first bone. */\r\n\tbones: Array<Bone>;\r\n\r\n\t/** The skeleton's slots. */\r\n\tslots: Array<Slot>;\r\n\r\n\t/** The skeleton's slots in the order they should be drawn. The returned array may be modified to change the draw order. */\r\n\tdrawOrder: Array<Slot>;\r\n\r\n\t/** The skeleton's IK constraints. */\r\n\tikConstraints: Array<IkConstraint>;\r\n\r\n\t/** The skeleton's transform constraints. */\r\n\ttransformConstraints: Array<TransformConstraint>;\r\n\r\n\t/** The skeleton's path constraints. */\r\n\tpathConstraints: Array<PathConstraint>;\r\n\r\n\t/** The list of bones and constraints, sorted in the order they should be updated, as computed by {@link #updateCache()}. */\r\n\t_updateCache = new Array<Updatable>();\r\n\tupdateCacheReset = new Array<Updatable>();\r\n\r\n\t/** The skeleton's current skin. May be null. */\r\n\tskin: Skin;\r\n\r\n\t/** The color to tint all the skeleton's attachments. */\r\n\tcolor: Color;\r\n\r\n\t/** Returns the skeleton's time. This can be used for tracking, such as with Slot {@link Slot#attachmentTime}.\r\n\t * <p>\r\n\t * See {@link #update()}. */\r\n\ttime = 0;\r\n\r\n\t/** Scales the entire skeleton on the X axis. This affects all bones, even if the bone's transform mode disallows scale\r\n\t* inheritance. */\r\n\tscaleX = 1;\r\n\r\n\t/** Scales the entire skeleton on the Y axis. This affects all bones, even if the bone's transform mode disallows scale\r\n\t* inheritance. */\r\n\tscaleY = 1;\r\n\r\n\t/** Sets the skeleton X position, which is added to the root bone worldX position. */\r\n\tx = 0;\r\n\r\n\t/** Sets the skeleton Y position, which is added to the root bone worldY position. */\r\n\ty = 0;\r\n\r\n\tconstructor(data: SkeletonData) {\r\n\t\tif (data == null) throw new Error(\"data cannot be null.\");\r\n\t\tthis.data = data;\r\n\r\n\t\tthis.bones = new Array<Bone>();\r\n\t\tfor (let i = 0; i < data.bones.length; i++) {\r\n\t\t\tlet boneData = data.bones[i];\r\n\t\t\tlet bone: Bone;\r\n\t\t\tif (boneData.parent == null)\r\n\t\t\t\tbone = new Bone(boneData, this, null);\r\n\t\t\telse {\r\n\t\t\t\tlet parent = this.bones[boneData.parent.index];\r\n\t\t\t\tbone = new Bone(boneData, this, parent);\r\n\t\t\t\tparent.children.push(bone);\r\n\t\t\t}\r\n\t\t\tthis.bones.push(bone);\r\n\t\t}\r\n\r\n\t\tthis.slots = new Array<Slot>();\r\n\t\tthis.drawOrder = new Array<Slot>();\r\n\t\tfor (let i = 0; i < data.slots.length; i++) {\r\n\t\t\tlet slotData = data.slots[i];\r\n\t\t\tlet bone = this.bones[slotData.boneData.index];\r\n\t\t\tlet slot = new Slot(slotData, bone);\r\n\t\t\tthis.slots.push(slot);\r\n\t\t\tthis.drawOrder.push(slot);\r\n\t\t}\r\n\r\n\t\tthis.ikConstraints = new Array<IkConstraint>();\r\n\t\tfor (let i = 0; i < data.ikConstraints.length; i++) {\r\n\t\t\tlet ikConstraintData = data.ikConstraints[i];\r\n\t\t\tthis.ikConstraints.push(new IkConstraint(ikConstraintData, this));\r\n\t\t}\r\n\r\n\t\tthis.transformConstraints = new Array<TransformConstraint>();\r\n\t\tfor (let i = 0; i < data.transformConstraints.length; i++) {\r\n\t\t\tlet transformConstraintData = data.transformConstraints[i];\r\n\t\t\tthis.transformConstraints.push(new TransformConstraint(transformConstraintData, this));\r\n\t\t}\r\n\r\n\t\tthis.pathConstraints = new Array<PathConstraint>();\r\n\t\tfor (let i = 0; i < data.pathConstraints.length; i++) {\r\n\t\t\tlet pathConstraintData = data.pathConstraints[i];\r\n\t\t\tthis.pathConstraints.push(new PathConstraint(pathConstraintData, this));\r\n\t\t}\r\n\r\n\t\tthis.color = new Color(1, 1, 1, 1);\r\n\t\tthis.updateCache();\r\n\t}\r\n\r\n\t/** Caches information about bones and constraints. Must be called if the {@link #getSkin()} is modified or if bones,\r\n\t * constraints, or weighted path attachments are added or removed. */\r\n\tupdateCache() {\r\n\t\tlet updateCache = this._updateCache;\r\n\t\tupdateCache.length = 0;\r\n\t\tthis.updateCacheReset.length = 0;\r\n\r\n\t\tlet bones = this.bones;\r\n\t\tfor (let i = 0, n = bones.length; i < n; i++) {\r\n\t\t\tlet bone = bones[i];\r\n\t\t\tbone.sorted = bone.data.skinRequired;\r\n\t\t\tbone.active = !bone.sorted;\r\n\t\t}\r\n\r\n\t\tif (this.skin != null) {\r\n\t\t\tlet skinBones = this.skin.bones;\r\n\t\t\tfor (let i = 0, n = this.skin.bones.length; i < n; i++) {\r\n\t\t\t\tlet bone = this.bones[skinBones[i].index];\r\n\t\t\t\tdo {\r\n\t\t\t\t\tbone.sorted = false;\r\n\t\t\t\t\tbone.active = true;\r\n\t\t\t\t\tbone = bone.parent;\r\n\t\t\t\t} while (bone != null);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// IK first, lowest hierarchy depth first.\r\n\t\tlet ikConstraints = this.ikConstraints;\r\n\t\tlet transformConstraints = this.transformConstraints;\r\n\t\tlet pathConstraints = this.pathConstraints;\r\n\t\tlet ikCount = ikConstraints.length, transformCount = transformConstraints.length, pathCount = pathConstraints.length;\r\n\t\tlet constraintCount = ikCount + transformCount + pathCount;\r\n\r\n\t\touter:\r\n\t\tfor (let i = 0; i < constraintCount; i++) {\r\n\t\t\tfor (let ii = 0; ii < ikCount; ii++) {\r\n\t\t\t\tlet constraint = ikConstraints[ii];\r\n\t\t\t\tif (constraint.data.order == i) {\r\n\t\t\t\t\tthis.sortIkConstraint(constraint);\r\n\t\t\t\t\tcontinue outer;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tfor (let ii = 0; ii < transformCount; ii++) {\r\n\t\t\t\tlet constraint = transformConstraints[ii];\r\n\t\t\t\tif (constraint.data.order == i) {\r\n\t\t\t\t\tthis.sortTransformConstraint(constraint);\r\n\t\t\t\t\tcontinue outer;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tfor (let ii = 0; ii < pathCount; ii++) {\r\n\t\t\t\tlet constraint = pathConstraints[ii];\r\n\t\t\t\tif (constraint.data.order == i) {\r\n\t\t\t\t\tthis.sortPathConstraint(constraint);\r\n\t\t\t\t\tcontinue outer;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (let i = 0, n = bones.length; i < n; i++)\r\n\t\t\tthis.sortBone(bones[i]);\r\n\t}\r\n\r\n\tsortIkConstraint(constraint: IkConstraint) {\r\n\t\tconstraint.active = constraint.target.isActive() && (!constraint.data.skinRequired || (this.skin != null && Utils.contains(this.skin.constraints, constraint.data, true)));\r\n\t\tif (!constraint.active) return;\r\n\r\n\t\tlet target = constraint.target;\r\n\t\tthis.sortBone(target);\r\n\r\n\t\tlet constrained = constraint.bones;\r\n\t\tlet parent = constrained[0];\r\n\t\tthis.sortBone(parent);\r\n\r\n\t\tif (constrained.length > 1) {\r\n\t\t\tlet child = constrained[constrained.length - 1];\r\n\t\t\tif (!(this._updateCache.indexOf(child) > -1)) this.updateCacheReset.push(child);\r\n\t\t}\r\n\r\n\t\tthis._updateCache.push(constraint);\r\n\r\n\t\tthis.sortReset(parent.children);\r\n\t\tconstrained[constrained.length - 1].sorted = true;\r\n\t}\r\n\r\n\tsortPathConstraint(constraint: PathConstraint) {\r\n\t\tconstraint.active = constraint.target.bone.isActive() && (!constraint.data.skinRequired || (this.skin != null && Utils.contains(this.skin.constraints, constraint.data, true)));\r\n\t\tif (!constraint.active) return;\r\n\r\n\t\tlet slot = constraint.target;\r\n\t\tlet slotIndex = slot.data.index;\r\n\t\tlet slotBone = slot.bone;\r\n\t\tif (this.skin != null) this.sortPathConstraintAttachment(this.skin, slotIndex, slotBone);\r\n\t\tif (this.data.defaultSkin != null && this.data.defaultSkin != this.skin)\r\n\t\t\tthis.sortPathConstraintAttachment(this.data.defaultSkin, slotIndex, slotBone);\r\n\t\tfor (let i = 0, n = this.data.skins.length; i < n; i++)\r\n\t\t\tthis.sortPathConstraintAttachment(this.data.skins[i], slotIndex, slotBone);\r\n\r\n\t\tlet attachment = slot.getAttachment();\r\n\t\tif (attachment instanceof PathAttachment) this.sortPathConstraintAttachmentWith(attachment, slotBone);\r\n\r\n\t\tlet constrained = constraint.bones;\r\n\t\tlet boneCount = constrained.length;\r\n\t\tfor (let i = 0; i < boneCount; i++)\r\n\t\t\tthis.sortBone(constrained[i]);\r\n\r\n\t\tthis._updateCache.push(constraint);\r\n\r\n\t\tfor (let i = 0; i < boneCount; i++)\r\n\t\t\tthis.sortReset(constrained[i].children);\r\n\t\tfor (let i = 0; i < boneCount; i++)\r\n\t\t\tconstrained[i].sorted = true;\r\n\t}\r\n\r\n\tsortTransformConstraint(constraint: TransformConstraint) {\r\n\t\tconstraint.active = constraint.target.isActive() && (!constraint.data.skinRequired || (this.skin != null && Utils.contains(this.skin.constraints, constraint.data, true)));\r\n\t\tif (!constraint.active) return;\r\n\r\n\t\tthis.sortBone(constraint.target);\r\n\r\n\t\tlet constrained = constraint.bones;\r\n\t\tlet boneCount = constrained.length;\r\n\t\tif (constraint.data.local) {\r\n\t\t\tfor (let i = 0; i < boneCount; i++) {\r\n\t\t\t\tlet child = constrained[i];\r\n\t\t\t\tthis.sortBone(child.parent);\r\n\t\t\t\tif (!(this._updateCache.indexOf(child) > -1)) this.updateCacheReset.push(child);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tfor (let i = 0; i < boneCount; i++) {\r\n\t\t\t\tthis.sortBone(constrained[i]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthis._updateCache.push(constraint);\r\n\r\n\t\tfor (let ii = 0; ii < boneCount; ii++)\r\n\t\t\tthis.sortReset(constrained[ii].children);\r\n\t\tfor (let ii = 0; ii < boneCount; ii++)\r\n\t\t\tconstrained[ii].sorted = true;\r\n\t}\r\n\r\n\tsortPathConstraintAttachment(skin: Skin, slotIndex: number, slotBone: Bone) {\r\n\t\tlet attachments = skin.attachments[slotIndex];\r\n\t\tif (!attachments) return;\r\n\t\tfor (let key in attachments) {\r\n\t\t\tthis.sortPathConstraintAttachmentWith(attachments[key], slotBone);\r\n\t\t}\r\n\t}\r\n\r\n\tsortPathConstraintAttachmentWith(attachment: Attachment, slotBone: Bone) {\r\n\t\tif (!(attachment instanceof PathAttachment)) return;\r\n\t\tlet pathBones = (<PathAttachment>attachment).bones;\r\n\t\tif (pathBones == null)\r\n\t\t\tthis.sortBone(slotBone);\r\n\t\telse {\r\n\t\t\tlet bones = this.bones;\r\n\t\t\tlet i = 0;\r\n\t\t\twhile (i < pathBones.length) {\r\n\t\t\t\tlet boneCount = pathBones[i++];\r\n\t\t\t\tfor (let n = i + boneCount; i < n; i++) {\r\n\t\t\t\t\tlet boneIndex = pathBones[i];\r\n\t\t\t\t\tthis.sortBone(bones[boneIndex]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tsortBone(bone: Bone) {\r\n\t\tif (bone.sorted) return;\r\n\t\tlet parent = bone.parent;\r\n\t\tif (parent != null) this.sortBone(parent);\r\n\t\tbone.sorted = true;\r\n\t\tthis._updateCache.push(bone);\r\n\t}\r\n\r\n\tsortReset(bones: Array<Bone>) {\r\n\t\tfor (let i = 0, n = bones.length; i < n; i++) {\r\n\t\t\tlet bone = bones[i];\r\n\t\t\tif (!bone.active) continue;\r\n\t\t\tif (bone.sorted) this.sortReset(bone.children);\r\n\t\t\tbone.sorted = false;\r\n\t\t}\r\n\t}\r\n\r\n\t/** Updates the world transform for each bone and applies all constraints.\r\n\t *\r\n\t * See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine\r\n\t * Runtimes Guide. */\r\n\tupdateWorldTransform() {\r\n\t\tlet updateCacheReset = this.updateCacheReset;\r\n\t\tfor (let i = 0, n = updateCacheReset.length; i < n; i++) {\r\n\t\t\tlet bone = updateCacheReset[i] as Bone;\r\n\t\t\tbone.ax = bone.x;\r\n\t\t\tbone.ay = bone.y;\r\n\t\t\tbone.arotation = bone.rotation;\r\n\t\t\tbone.ascaleX = bone.scaleX;\r\n\t\t\tbone.ascaleY = bone.scaleY;\r\n\t\t\tbone.ashearX = bone.shearX;\r\n\t\t\tbone.ashearY = bone.shearY;\r\n\t\t\tbone.appliedValid = true;\r\n\t\t}\r\n\t\tlet updateCache = this._updateCache;\r\n\t\tfor (let i = 0, n = updateCache.length; i < n; i++)\r\n\t\t\tupdateCache[i].update();\r\n\t}\r\n\r\n\t/** Sets the bones, constraints, and slots to their setup pose values. */\r\n\tsetToSetupPose() {\r\n\t\tthis.setBonesToSetupPose();\r\n\t\tthis.setSlotsToSetupPose();\r\n\t}\r\n\r\n\t/** Sets the bones and constraints to their setup pose values. */\r\n\tsetBonesToSetupPose() {\r\n\t\tlet bones = this.bones;\r\n\t\tfor (let i = 0, n = bones.length; i < n; i++)\r\n\t\t\tbones[i].setToSetupPose();\r\n\r\n\t\tlet ikConstraints = this.ikConstraints;\r\n\t\tfor (let i = 0, n = ikConstraints.length; i < n; i++) {\r\n\t\t\tlet constraint = ikConstraints[i];\r\n\t\t\tconstraint.mix = constraint.data.mix;\r\n\t\t\tconstraint.softness = constraint.data.softness;\r\n\t\t\tconstraint.bendDirection = constraint.data.bendDirection;\r\n\t\t\tconstraint.compress = constraint.data.compress;\r\n\t\t\tconstraint.stretch = constraint.data.stretch;\r\n\t\t}\r\n\r\n\t\tlet transformConstraints = this.transformConstraints;\r\n\t\tfor (let i = 0, n = transformConstraints.length; i < n; i++) {\r\n\t\t\tlet constraint = transformConstraints[i];\r\n\t\t\tlet data = constraint.data;\r\n\t\t\tconstraint.rotateMix = data.rotateMix;\r\n\t\t\tconstraint.translateMix = data.translateMix;\r\n\t\t\tconstraint.scaleMix = data.scaleMix;\r\n\t\t\tconstraint.shearMix = data.shearMix;\r\n\t\t}\r\n\r\n\t\tlet pathConstraints = this.pathConstraints;\r\n\t\tfor (let i = 0, n = pathConstraints.length; i < n; i++) {\r\n\t\t\tlet constraint = pathConstraints[i];\r\n\t\t\tlet data = constraint.data;\r\n\t\t\tconstraint.position = data.position;\r\n\t\t\tconstraint.spacing = data.spacing;\r\n\t\t\tconstraint.rotateMix = data.rotateMix;\r\n\t\t\tconstraint.translateMix = data.translateMix;\r\n\t\t}\r\n\t}\r\n\r\n\t/** Sets the slots and draw order to their setup pose values. */\r\n\tsetSlotsToSetupPose() {\r\n\t\tlet slots = this.slots;\r\n\t\tUtils.arrayCopy(slots, 0, this.drawOrder, 0, slots.length);\r\n\t\tfor (let i = 0, n = slots.length; i < n; i++)\r\n\t\t\tslots[i].setToSetupPose();\r\n\t}\r\n\r\n\t/** @returns May return null. */\r\n\tgetRootBone() {\r\n\t\tif (this.bones.length == 0) return null;\r\n\t\treturn this.bones[0];\r\n\t}\r\n\r\n\t/** @returns May be null. */\r\n\tfindBone(boneName: string) {\r\n\t\tif (boneName == null) throw new Error(\"boneName cannot be null.\");\r\n\t\tlet bones = this.bones;\r\n\t\tfor (let i = 0, n = bones.length; i < n; i++) {\r\n\t\t\tlet bone = bones[i];\r\n\t\t\tif (bone.data.name == boneName) return bone;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/** @returns -1 if the bone was not found. */\r\n\tfindBoneIndex(boneName: string) {\r\n\t\tif (boneName == null) throw new Error(\"boneName cannot be null.\");\r\n\t\tlet bones = this.bones;\r\n\t\tfor (let i = 0, n = bones.length; i < n; i++)\r\n\t\t\tif (bones[i].data.name == boneName) return i;\r\n\t\treturn -1;\r\n\t}\r\n\r\n\t/** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it\r\n\t * repeatedly.\r\n\t * @returns May be null. */\r\n\tfindSlot(slotName: string) {\r\n\t\tif (slotName == null) throw new Error(\"slotName cannot be null.\");\r\n\t\tlet slots = this.slots;\r\n\t\tfor (let i = 0, n = slots.length; i < n; i++) {\r\n\t\t\tlet slot = slots[i];\r\n\t\t\tif (slot.data.name == slotName) return slot;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/** @returns -1 if the bone was not found. */\r\n\tfindSlotIndex(slotName: string) {\r\n\t\tif (slotName == null) throw new Error(\"slotName cannot be null.\");\r\n\t\tlet slots = this.slots;\r\n\t\tfor (let i = 0, n = slots.length; i < n; i++)\r\n\t\t\tif (slots[i].data.name == slotName) return i;\r\n\t\treturn -1;\r\n\t}\r\n\r\n\t/** Sets a skin by name.\r\n\t *\r\n\t * See {@link #setSkin()}. */\r\n\tsetSkinByName(skinName: string) {\r\n\t\tlet skin = this.data.findSkin(skinName);\r\n\t\tif (skin == null) throw new Error(\"Skin not found: \" + skinName);\r\n\t\tthis.setSkin(skin);\r\n\t}\r\n\r\n\t/** Sets the skin used to look up attachments before looking in the {@link SkeletonData#defaultSkin default skin}. If the\r\n\t * skin is changed, {@link #updateCache()} is called.\r\n\t *\r\n\t * Attachments from the new skin are attached if the corresponding attachment from the old skin was attached. If there was no\r\n\t * old skin, each slot's setup mode attachment is attached from the new skin.\r\n\t *\r\n\t * After changing the skin, the visible attachments can be reset to those attached in the setup pose by calling\r\n\t * {@link #setSlotsToSetupPose()}. Also, often {@link AnimationState#apply()} is called before the next time the\r\n\t * skeleton is rendered to allow any attachment keys in the current animation(s) to hide or show attachments from the new skin.\r\n\t * @param newSkin May be null. */\r\n\tsetSkin(newSkin: Skin) {\r\n\t\tif (newSkin == this.skin) return;\r\n\t\tif (newSkin != null) {\r\n\t\t\tif (this.skin != null)\r\n\t\t\t\tnewSkin.attachAll(this, this.skin);\r\n\t\t\telse {\r\n\t\t\t\tlet slots = this.slots;\r\n\t\t\t\tfor (let i = 0, n = slots.length; i < n; i++) {\r\n\t\t\t\t\tlet slot = slots[i];\r\n\t\t\t\t\tlet name = slot.data.attachmentName;\r\n\t\t\t\t\tif (name != null) {\r\n\t\t\t\t\t\tlet attachment: Attachment = newSkin.getAttachment(i, name);\r\n\t\t\t\t\t\tif (attachment != null) slot.setAttachment(attachment);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.skin = newSkin;\r\n\t\tthis.updateCache();\r\n\t}\r\n\r\n\r\n\t/** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot name and attachment\r\n\t * name.\r\n\t *\r\n\t * See {@link #getAttachment()}.\r\n\t * @returns May be null. */\r\n\tgetAttachmentByName(slotName: string, attachmentName: string): Attachment {\r\n\t\treturn this.getAttachment(this.data.findSlotIndex(slotName), attachmentName);\r\n\t}\r\n\r\n\t/** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot index and\r\n\t * attachment name. First the skin is checked and if the attachment was not found, the default skin is checked.\r\n\t *\r\n\t * See [Runtime skins](http://esotericsoftware.com/spine-runtime-skins) in the Spine Runtimes Guide.\r\n\t * @returns May be null. */\r\n\tgetAttachment(slotIndex: number, attachmentName: string): Attachment {\r\n\t\tif (attachmentName == null) throw new Error(\"attachmentName cannot be null.\");\r\n\t\tif (this.skin != null) {\r\n\t\t\tlet attachment: Attachment = this.skin.getAttachment(slotIndex, attachmentName);\r\n\t\t\tif (attachment != null) return attachment;\r\n\t\t}\r\n\t\tif (this.data.defaultSkin != null) return this.data.defaultSkin.getAttachment(slotIndex, attachmentName);\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/** A convenience method to set an attachment by finding the slot with {@link #findSlot()}, finding the attachment with\r\n\t * {@link #getAttachment()}, then setting the slot's {@link Slot#attachment}.\r\n\t * @param attachmentName May be null to clear the slot's attachment. */\r\n\tsetAttachment(slotName: string, attachmentName: string) {\r\n\t\tif (slotName == null) throw new Error(\"slotName cannot be null.\");\r\n\t\tlet slots = this.slots;\r\n\t\tfor (let i = 0, n = slots.length; i < n; i++) {\r\n\t\t\tlet slot = slots[i];\r\n\t\t\tif (slot.data.name == slotName) {\r\n\t\t\t\tlet attachment: Attachment = null;\r\n\t\t\t\tif (attachmentName != null) {\r\n\t\t\t\t\tattachment = this.getAttachment(i, attachmentName);\r\n\t\t\t\t\tif (attachment == null)\r\n\t\t\t\t\t\tthrow new Error(\"Attachment not found: \" + attachmentName + \", for slot: \" + slotName);\r\n\t\t\t\t}\r\n\t\t\t\tslot.setAttachment(attachment);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t\tthrow new Error(\"Slot not found: \" + slotName);\r\n\t}\r\n\r\n\r\n\t/** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method\r\n\t * than to call it repeatedly.\r\n\t * @return May be null. */\r\n\tfindIkConstraint(constraintName: string) {\r\n\t\tif (constraintName == null) throw new Error(\"constraintName cannot be null.\");\r\n\t\tlet ikConstraints = this.ikConstraints;\r\n\t\tfor (let i = 0, n = ikConstraints.length; i < n; i++) {\r\n\t\t\tlet ikConstraint = ikConstraints[i];\r\n\t\t\tif (ikConstraint.data.name == constraintName) return ikConstraint;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of\r\n\t * this method than to call it repeatedly.\r\n\t * @return May be null. */\r\n\tfindTransformConstraint(constraintName: string) {\r\n\t\tif (constraintName == null) throw new Error(\"constraintName cannot be null.\");\r\n\t\tlet transformConstraints = this.transformConstraints;\r\n\t\tfor (let i = 0, n = transformConstraints.length; i < n; i++) {\r\n\t\t\tlet constraint = transformConstraints[i];\r\n\t\t\tif (constraint.data.name == constraintName) return constraint;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method\r\n\t * than to call it repeatedly.\r\n\t * @return May be null. */\r\n\tfindPathConstraint(constraintName: string) {\r\n\t\tif (constraintName == null) throw new Error(\"constraintName cannot be null.\");\r\n\t\tlet pathConstraints = this.pathConstraints;\r\n\t\tfor (let i = 0, n = pathConstraints.length; i < n; i++) {\r\n\t\t\tlet constraint = pathConstraints[i];\r\n\t\t\tif (constraint.data.name == constraintName) return constraint;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose.\r\n\t * @param offset An output value, the distance from the skeleton origin to the bottom left corner of the AABB.\r\n\t * @param size An output value, the width and height of the AABB.\r\n\t * @param temp Working memory to temporarily store attachments' computed world vertices. */\r\n\tgetBounds(offset: Vector2, size: Vector2, temp: Array<number> = new Array<number>(2)) {\r\n\t\tif (offset == null) throw new Error(\"offset cannot be null.\");\r\n\t\tif (size == null) throw new Error(\"size cannot be null.\");\r\n\t\tlet drawOrder = this.drawOrder;\r\n\t\tlet minX = Number.POSITIVE_INFINITY, minY = Number.POSITIVE_INFINITY, maxX = Number.NEGATIVE_INFINITY, maxY = Number.NEGATIVE_INFINITY;\r\n\t\tfor (let i = 0, n = drawOrder.length; i < n; i++) {\r\n\t\t\tlet slot = drawOrder[i];\r\n\t\t\tif (!slot.bone.active) continue;\r\n\t\t\tlet verticesLength = 0;\r\n\t\t\tlet vertices: ArrayLike<number> = null;\r\n\t\t\tlet attachment = slot.getAttachment();\r\n\t\t\tif (attachment instanceof RegionAttachment) {\r\n\t\t\t\tverticesLength = 8;\r\n\t\t\t\tvertices = Utils.setArraySize(temp, verticesLength, 0);\r\n\t\t\t\t(<RegionAttachment>attachment).computeWorldVertices(slot.bone, vertices, 0, 2);\r\n\t\t\t} else if (attachment instanceof MeshAttachment) {\r\n\t\t\t\tlet mesh = (<MeshAttachment>attachment);\r\n\t\t\t\tverticesLength = mesh.worldVerticesLength;\r\n\t\t\t\tvertices = Utils.setArraySize(temp, verticesLength, 0);\r\n\t\t\t\tmesh.computeWorldVertices(slot, 0, verticesLength, vertices, 0, 2);\r\n\t\t\t}\r\n\t\t\tif (vertices != null) {\r\n\t\t\t\tfor (let ii = 0, nn = vertices.length; ii < nn; ii += 2) {\r\n\t\t\t\t\tlet x = vertices[ii], y = vertices[ii + 1];\r\n\t\t\t\t\tminX = Math.min(minX, x);\r\n\t\t\t\t\tminY = Math.min(minY, y);\r\n\t\t\t\t\tmaxX = Math.max(maxX, x);\r\n\t\t\t\t\tmaxY = Math.max(maxY, y);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\toffset.set(minX, minY);\r\n\t\tsize.set(maxX - minX, maxY - minY);\r\n\t}\r\n\r\n\t/** Increments the skeleton's {@link #time}. */\r\n\tupdate(delta: number) {\r\n\t\tthis.time += delta;\r\n\t}\r\n}\r\n","\r\n\r\nimport { AnimationStateData } from \"./AnimationStateData\";\r\nimport { IntSet, Pool, Utils, MathUtils } from \"./Utils\";\r\nimport { Skeleton } from \"./Skeleton\";\r\nimport { MixBlend, AttachmentTimeline, MixDirection, RotateTimeline, DrawOrderTimeline, Timeline, EventTimeline } from \"./Animation\";\r\nimport { Slot } from \"./Slot\";\r\nimport { Animation } from \"./Animation\";\r\nimport { Event } from \"./Event\";\r\n\r\n\r\n/** Applies animations over time, queues animations for later playback, mixes (crossfading) between animations, and applies\r\n * multiple animations on top of each other (layering).\r\n *\r\n * See [Applying Animations](http://esotericsoftware.com/spine-applying-animations/) in the Spine Runtimes Guide. */\r\nexport class AnimationState {\r\n\tstatic emptyAnimation = new Animation(\"<empty>\", [], 0);\r\n\r\n\t/** 1. A previously applied timeline has set this property.\r\n\t *\r\n\t * Result: Mix from the current pose to the timeline pose. */\r\n\tstatic SUBSEQUENT = 0;\r\n\t/** 1. This is the first timeline to set this property.\r\n\t * 2. The next track entry applied after this one does not have a timeline to set this property.\r\n\t *\r\n\t * Result: Mix from the setup pose to the timeline pose. */\r\n\tstatic FIRST = 1;\r\n\t/** 1) A previously applied timeline has set this property.<br>\r\n\t * 2) The next track entry to be applied does have a timeline to set this property.<br>\r\n\t * 3) The next track entry after that one does not have a timeline to set this property.<br>\r\n\t * Result: Mix from the current pose to the timeline pose, but do not mix out. This avoids \"dipping\" when crossfading\r\n\t * animations that key the same property. A subsequent timeline will set this property using a mix. */\r\n\tstatic HOLD_SUBSEQUENT = 2;\r\n\t/** 1) This is the first timeline to set this property.<br>\r\n\t * 2) The next track entry to be applied does have a timeline to set this property.<br>\r\n\t * 3) The next track entry after that one does not have a timeline to set this property.<br>\r\n\t * Result: Mix from the setup pose to the timeline pose, but do not mix out. This avoids \"dipping\" when crossfading animations\r\n\t * that key the same property. A subsequent timeline will set this property using a mix. */\r\n\tstatic HOLD_FIRST = 3;\r\n\t/** 1. This is the first timeline to set this property.\r\n\t * 2. The next track entry to be applied does have a timeline to set this property.\r\n\t * 3. The next track entry after that one does have a timeline to set this property.\r\n\t * 4. timelineHoldMix stores the first subsequent track entry that does not have a timeline to set this property.\r\n\t *\r\n\t * Result: The same as HOLD except the mix percentage from the timelineHoldMix track entry is used. This handles when more than\r\n\t * 2 track entries in a row have a timeline that sets the same property.\r\n\t *\r\n\t * Eg, A -> B -> C -> D where A, B, and C have a timeline setting same property, but D does not. When A is applied, to avoid\r\n\t * \"dipping\" A is not mixed out, however D (the first entry that doesn't set the property) mixing in is used to mix out A\r\n\t * (which affects B and C). Without using D to mix out, A would be applied fully until mixing completes, then snap into\r\n\t * place. */\r\n\tstatic HOLD_MIX = 4;\r\n\r\n\tstatic SETUP = 1;\r\n\tstatic CURRENT = 2;\r\n\r\n\t/** The AnimationStateData to look up mix durations. */\r\n\tdata: AnimationStateData;\r\n\r\n\t/** The list of tracks that currently have animations, which may contain null entries. */\r\n\ttracks = new Array<TrackEntry>();\r\n\r\n\t/** Multiplier for the delta time when the animation state is updated, causing time for all animations and mixes to play slower\r\n\t * or faster. Defaults to 1.\r\n\t *\r\n\t * See TrackEntry {@link TrackEntry#timeScale} for affecting a single animation. */\r\n\ttimeScale = 1;\r\n\tunkeyedState = 0;\r\n\r\n\tevents = new Array<Event>();\r\n\tlisteners = new Array<AnimationStateListener>();\r\n\tqueue = new EventQueue(this);\r\n\tpropertyIDs = new IntSet();\r\n\tanimationsChanged = false;\r\n\r\n\ttrackEntryPool = new Pool<TrackEntry>(() => new TrackEntry());\r\n\r\n\tconstructor (data: AnimationStateData) {\r\n\t\tthis.data = data;\r\n\t}\r\n\r\n\t/** Increments each track entry {@link TrackEntry#trackTime()}, setting queued animations as current if needed. */\r\n\tupdate (delta: number) {\r\n\t\tdelta *= this.timeScale;\r\n\t\tlet tracks = this.tracks;\r\n\t\tfor (let i = 0, n = tracks.length; i < n; i++) {\r\n\t\t\tlet current = tracks[i];\r\n\t\t\tif (current == null) continue;\r\n\r\n\t\t\tcurrent.animationLast = current.nextAnimationLast;\r\n\t\t\tcurrent.trackLast = current.nextTrackLast;\r\n\r\n\t\t\tlet currentDelta = delta * current.timeScale;\r\n\r\n\t\t\tif (current.delay > 0) {\r\n\t\t\t\tcurrent.delay -= currentDelta;\r\n\t\t\t\tif (current.delay > 0) continue;\r\n\t\t\t\tcurrentDelta = -current.delay;\r\n\t\t\t\tcurrent.delay = 0;\r\n\t\t\t}\r\n\r\n\t\t\tlet next = current.next;\r\n\t\t\tif (next != null) {\r\n\t\t\t\t// When the next entry's delay is passed, change to the next entry, preserving leftover time.\r\n\t\t\t\tlet nextTime = current.trackLast - next.delay;\r\n\t\t\t\tif (nextTime >= 0) {\r\n\t\t\t\t\tnext.delay = 0;\r\n\t\t\t\t\tnext.trackTime += current.timeScale == 0 ? 0 : (nextTime / current.timeScale + delta) * next.timeScale;\r\n\t\t\t\t\tcurrent.trackTime += currentDelta;\r\n\t\t\t\t\tthis.setCurrent(i, next, true);\r\n\t\t\t\t\twhile (next.mixingFrom != null) {\r\n\t\t\t\t\t\tnext.mixTime += delta;\r\n\t\t\t\t\t\tnext = next.mixingFrom;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t} else if (current.trackLast >= current.trackEnd && current.mixingFrom == null) {\r\n\t\t\t\ttracks[i] = null;\r\n\t\t\t\tthis.queue.end(current);\r\n\t\t\t\tthis.disposeNext(current);\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tif (current.mixingFrom != null && this.updateMixingFrom(current, delta)) {\r\n\t\t\t\t// End mixing from entries once all have completed.\r\n\t\t\t\tlet from = current.mixingFrom;\r\n\t\t\t\tcurrent.mixingFrom = null;\r\n\t\t\t\tif (from != null) from.mixingTo = null;\r\n\t\t\t\twhile (from != null) {\r\n\t\t\t\t\tthis.queue.end(from);\r\n\t\t\t\t\tfrom = from.mixingFrom;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tcurrent.trackTime += currentDelta;\r\n\t\t}\r\n\r\n\t\tthis.queue.drain();\r\n\t}\r\n\r\n\t/** Returns true when all mixing from entries are complete. */\r\n\tupdateMixingFrom (to: TrackEntry, delta: number): boolean {\r\n\t\tlet from = to.mixingFrom;\r\n\t\tif (from == null) return true;\r\n\r\n\t\tlet finished = this.updateMixingFrom(from, delta);\r\n\r\n\t\tfrom.animationLast = from.nextAnimationLast;\r\n\t\tfrom.trackLast = from.nextTrackLast;\r\n\r\n\t\t// Require mixTime > 0 to ensure the mixing from entry was applied at least once.\r\n\t\tif (to.mixTime > 0 && to.mixTime >= to.mixDuration) {\r\n\t\t\t// Require totalAlpha == 0 to ensure mixing is complete, unless mixDuration == 0 (the transition is a single frame).\r\n\t\t\tif (from.totalAlpha == 0 || to.mixDuration == 0) {\r\n\t\t\t\tto.mixingFrom = from.mixingFrom;\r\n\t\t\t\tif (from.mixingFrom != null) from.mixingFrom.mixingTo = to;\r\n\t\t\t\tto.interruptAlpha = from.interruptAlpha;\r\n\t\t\t\tthis.queue.end(from);\r\n\t\t\t}\r\n\t\t\treturn finished;\r\n\t\t}\r\n\r\n\t\tfrom.trackTime += delta * from.timeScale;\r\n\t\tto.mixTime += delta;\r\n\t\treturn false;\r\n\t}\r\n\r\n\t/** Poses the skeleton using the track entry animations. There are no side effects other than invoking listeners, so the\r\n\t * animation state can be applied to multiple skeletons to pose them identically.\r\n\t * @returns True if any animations were applied. */\r\n\tapply (skeleton: Skeleton) : boolean {\r\n\t\tif (skeleton == null) throw new Error(\"skeleton cannot be null.\");\r\n\t\tif (this.animationsChanged) this._animationsChanged();\r\n\r\n\t\tlet events = this.events;\r\n\t\tlet tracks = this.tracks;\r\n\t\tlet applied = false;\r\n\r\n\t\tfor (let i = 0, n = tracks.length; i < n; i++) {\r\n\t\t\tlet current = tracks[i];\r\n\t\t\tif (current == null || current.delay > 0) continue;\r\n\t\t\tapplied = true;\r\n\t\t\tlet blend: MixBlend = i == 0 ? MixBlend.first : current.mixBlend;\r\n\r\n\t\t\t// Apply mixing from entries first.\r\n\t\t\tlet mix = current.alpha;\r\n\t\t\tif (current.mixingFrom != null)\r\n\t\t\t\tmix *= this.applyMixingFrom(current, skeleton, blend);\r\n\t\t\telse if (current.trackTime >= current.trackEnd && current.next == null)\r\n\t\t\t\tmix = 0;\r\n\r\n\t\t\t// Apply current entry.\r\n\t\t\tlet animationLast = current.animationLast, animationTime = current.getAnimationTime();\r\n\t\t\tlet timelineCount = current.animation.timelines.length;\r\n\t\t\tlet timelines = current.animation.timelines;\r\n\t\t\tif ((i == 0 && mix == 1) || blend == MixBlend.add) {\r\n\t\t\t\tfor (let ii = 0; ii < timelineCount; ii++) {\r\n\t\t\t\t\t// Fixes issue #302 on IOS9 where mix, blend sometimes became undefined and caused assets\r\n\t\t\t\t\t// to sometimes stop rendering when using color correction, as their RGBA values become NaN.\r\n\t\t\t\t\t// (https://github.com/pixijs/pixi-spine/issues/302)\r\n\t\t\t\t\tUtils.webkit602BugfixHelper(mix, blend);\r\n\t\t\t\t\tvar timeline = timelines[ii];\r\n\t\t\t\t\tif (timeline instanceof AttachmentTimeline)\r\n\t\t\t\t\t\tthis.applyAttachmentTimeline(timeline, skeleton, animationTime, blend, true);\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\ttimeline.apply(skeleton, animationLast, animationTime, events, mix, blend, MixDirection.mixIn);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tlet timelineMode = current.timelineMode;\r\n\r\n\t\t\t\tlet firstFrame = current.timelinesRotation.length == 0;\r\n\t\t\t\tif (firstFrame) Utils.setArraySize(current.timelinesRotation, timelineCount << 1, null);\r\n\t\t\t\tlet timelinesRotation = current.timelinesRotation;\r\n\r\n\t\t\t\tfor (let ii = 0; ii < timelineCount; ii++) {\r\n\t\t\t\t\tlet timeline = timelines[ii];\r\n\t\t\t\t\tlet timelineBlend = timelineMode[ii] == AnimationState.SUBSEQUENT ? blend : MixBlend.setup;\r\n\t\t\t\t\tif (timeline instanceof RotateTimeline) {\r\n\t\t\t\t\t\tthis.applyRotateTimeline(timeline, skeleton, animationTime, mix, timelineBlend, timelinesRotation, ii << 1, firstFrame);\r\n\t\t\t\t\t} else if (timeline instanceof AttachmentTimeline) {\r\n\t\t\t\t\t\tthis.applyAttachmentTimeline(timeline, skeleton, animationTime, blend, true);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// This fixes the WebKit 602 specific issue described at http://esotericsoftware.com/forum/iOS-10-disappearing-graphics-10109\r\n\t\t\t\t\t\tUtils.webkit602BugfixHelper(mix, blend);\r\n\t\t\t\t\t\ttimeline.apply(skeleton, animationLast, animationTime, events, mix, timelineBlend, MixDirection.mixIn);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.queueEvents(current, animationTime);\r\n\t\t\tevents.length = 0;\r\n\t\t\tcurrent.nextAnimationLast = animationTime;\r\n\t\t\tcurrent.nextTrackLast = current.trackTime;\r\n\t\t}\r\n\r\n\t\t// Set slots attachments to the setup pose, if needed. This occurs if an animation that is mixing out sets attachments so\r\n\t\t// subsequent timelines see any deform, but the subsequent timelines don't set an attachment (eg they are also mixing out or\r\n\t\t// the time is before the first key).\r\n\t\tvar setupState = this.unkeyedState + AnimationState.SETUP;\r\n\t\tvar slots = skeleton.slots;\r\n\t\tfor (var i = 0, n = skeleton.slots.length; i < n; i++) {\r\n\t\t\tvar slot = slots[i];\r\n\t\t\tif (slot.attachmentState == setupState) {\r\n\t\t\t\tvar attachmentName = slot.data.attachmentName;\r\n\t\t\t\tslot.attachment = (attachmentName == null ? null : skeleton.getAttachment(slot.data.index, attachmentName));\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.unkeyedState += 2; // Increasing after each use avoids the need to reset attachmentState for every slot.\r\n\r\n\t\tthis.queue.drain();\r\n\t\treturn applied;\r\n\t}\r\n\r\n\tapplyMixingFrom (to: TrackEntry, skeleton: Skeleton, blend: MixBlend) {\r\n\t\tlet from = to.mixingFrom;\r\n\t\tif (from.mixingFrom != null) this.applyMixingFrom(from, skeleton, blend);\r\n\r\n\t\tlet mix = 0;\r\n\t\tif (to.mixDuration == 0) { // Single frame mix to undo mixingFrom changes.\r\n\t\t\tmix = 1;\r\n\t\t\tif (blend == MixBlend.first) blend = MixBlend.setup;\r\n\t\t} else {\r\n\t\t\tmix = to.mixTime / to.mixDuration;\r\n\t\t\tif (mix > 1) mix = 1;\r\n\t\t\tif (blend != MixBlend.first) blend = from.mixBlend;\r\n\t\t}\r\n\r\n\t\tlet events = mix < from.eventThreshold ? this.events : null;\r\n\t\tlet attachments = mix < from.attachmentThreshold, drawOrder = mix < from.drawOrderThreshold;\r\n\t\tlet animationLast = from.animationLast, animationTime = from.getAnimationTime();\r\n\t\tlet timelineCount = from.animation.timelines.length;\r\n\t\tlet timelines = from.animation.timelines;\r\n\t\tlet alphaHold = from.alpha * to.interruptAlpha, alphaMix = alphaHold * (1 - mix);\r\n\t\tif (blend == MixBlend.add) {\r\n\t\t\tfor (let i = 0; i < timelineCount; i++)\r\n\t\t\t\ttimelines[i].apply(skeleton, animationLast, animationTime, events, alphaMix, blend, MixDirection.mixOut);\r\n\t\t} else {\r\n\t\t\tlet timelineMode = from.timelineMode;\r\n\t\t\tlet timelineHoldMix = from.timelineHoldMix;\r\n\r\n\t\t\tlet firstFrame = from.timelinesRotation.length == 0;\r\n\t\t\tif (firstFrame) Utils.setArraySize(from.timelinesRotation, timelineCount << 1, null);\r\n\t\t\tlet timelinesRotation = from.timelinesRotation;\r\n\r\n\t\t\tfrom.totalAlpha = 0;\r\n\t\t\tfor (let i = 0; i < timelineCount; i++) {\r\n\t\t\t\tlet timeline = timelines[i];\r\n\t\t\t\tlet direction = MixDirection.mixOut;\r\n\t\t\t\tlet timelineBlend: MixBlend;\r\n\t\t\t\tlet alpha = 0;\r\n\t\t\t\tswitch (timelineMode[i]) {\r\n\t\t\t\tcase AnimationState.SUBSEQUENT:\r\n\t\t\t\t\tif (!drawOrder && timeline instanceof DrawOrderTimeline) continue;\r\n\t\t\t\t\ttimelineBlend = blend;\r\n\t\t\t\t\talpha = alphaMix;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase AnimationState.FIRST:\r\n\t\t\t\t\ttimelineBlend = MixBlend.setup;\r\n\t\t\t\t\talpha = alphaMix;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase AnimationState.HOLD_SUBSEQUENT:\r\n\t\t\t\t\ttimelineBlend = blend;\r\n\t\t\t\t\talpha = alphaHold;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase AnimationState.HOLD_FIRST:\r\n\t\t\t\t\ttimelineBlend = MixBlend.setup;\r\n\t\t\t\t\talpha = alphaHold;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\ttimelineBlend = MixBlend.setup;\r\n\t\t\t\t\tlet holdMix = timelineHoldMix[i];\r\n\t\t\t\t\talpha = alphaHold * Math.max(0, 1 - holdMix.mixTime / holdMix.mixDuration);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tfrom.totalAlpha += alpha;\r\n\r\n\t\t\t\tif (timeline instanceof RotateTimeline)\r\n\t\t\t\t\tthis.applyRotateTimeline(timeline, skeleton, animationTime, alpha, timelineBlend, timelinesRotation, i << 1, firstFrame);\r\n\t\t\t\telse if (timeline instanceof AttachmentTimeline)\r\n\t\t\t\t\tthis.applyAttachmentTimeline(timeline, skeleton, animationTime, timelineBlend, attachments);\r\n\t\t\t\telse {\r\n\t\t\t\t\t// This fixes the WebKit 602 specific issue described at http://esotericsoftware.com/forum/iOS-10-disappearing-graphics-10109\r\n\t\t\t\t\tUtils.webkit602BugfixHelper(alpha, blend);\r\n\t\t\t\t\tif (drawOrder && timeline instanceof DrawOrderTimeline && timelineBlend == MixBlend.setup)\r\n\t\t\t\t\t\tdirection = MixDirection.mixIn;\r\n\t\t\t\t\ttimeline.apply(skeleton, animationLast, animationTime, events, alpha, timelineBlend, direction);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (to.mixDuration > 0) this.queueEvents(from, animationTime);\r\n\t\tthis.events.length = 0;\r\n\t\tfrom.nextAnimationLast = animationTime;\r\n\t\tfrom.nextTrackLast = from.trackTime;\r\n\r\n\t\treturn mix;\r\n\t}\r\n\r\n\tapplyAttachmentTimeline (timeline: AttachmentTimeline, skeleton: Skeleton, time: number, blend: MixBlend, attachments: boolean) {\r\n\r\n\t\tvar slot = skeleton.slots[timeline.slotIndex];\r\n\t\tif (!slot.bone.active) return;\r\n\r\n\t\tvar frames = timeline.frames;\r\n\t\tif (time < frames[0]) { // Time is before first frame.\r\n\t\t\tif (blend == MixBlend.setup || blend == MixBlend.first)\r\n\t\t\t\tthis.setAttachment(skeleton, slot, slot.data.attachmentName, attachments);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tvar frameIndex;\r\n\t\t\tif (time >= frames[frames.length - 1]) // Time is after last frame.\r\n\t\t\t\tframeIndex = frames.length - 1;\r\n\t\t\telse\r\n\t\t\t\tframeIndex = Animation.binarySearch(frames, time) - 1;\r\n\t\t\tthis.setAttachment(skeleton, slot, timeline.attachmentNames[frameIndex], attachments);\r\n\t\t}\r\n\r\n\t\t// If an attachment wasn't set (ie before the first frame or attachments is false), set the setup attachment later.\r\n\t\tif (slot.attachmentState <= this.unkeyedState) slot.attachmentState = this.unkeyedState + AnimationState.SETUP;\r\n\t}\r\n\r\n\tsetAttachment (skeleton: Skeleton, slot: Slot, attachmentName: string, attachments: boolean) {\r\n\t\tslot.attachment = attachmentName == null ? null : skeleton.getAttachment(slot.data.index, attachmentName);\r\n\t\tif (attachments) slot.attachmentState = this.unkeyedState + AnimationState.CURRENT;\r\n\t}\r\n\r\n\r\n\tapplyRotateTimeline (timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, blend: MixBlend,\r\n\t\ttimelinesRotation: Array<number>, i: number, firstFrame: boolean) {\r\n\r\n\t\tif (firstFrame) timelinesRotation[i] = 0;\r\n\r\n\t\tif (alpha == 1) {\r\n\t\t\ttimeline.apply(skeleton, 0, time, null, 1, blend, MixDirection.mixIn);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet rotateTimeline = timeline as RotateTimeline;\r\n\t\tlet frames = rotateTimeline.frames;\r\n\t\tlet bone = skeleton.bones[rotateTimeline.boneIndex];\r\n\t\tif (!bone.active) return;\r\n\t\tlet r1 = 0, r2 = 0;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tswitch (blend) {\r\n\t\t\t\tcase MixBlend.setup:\r\n\t\t\t\t\tbone.rotation = bone.data.rotation;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\treturn;\r\n\t\t\t\tcase MixBlend.first:\r\n\t\t\t\t\tr1 = bone.rotation;\r\n\t\t\t\t\tr2 = bone.data.rotation;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tr1 = blend == MixBlend.setup ? bone.data.rotation : bone.rotation;\r\n\t\t\tif (time >= frames[frames.length - RotateTimeline.ENTRIES]) // Time is after last frame.\r\n\t\t\t\tr2 = bone.data.rotation + frames[frames.length + RotateTimeline.PREV_ROTATION];\r\n\t\t\telse {\r\n\t\t\t\t// Interpolate between the previous frame and the current frame.\r\n\t\t\t\tlet frame = Animation.binarySearch(frames, time, RotateTimeline.ENTRIES);\r\n\t\t\t\tlet prevRotation = frames[frame + RotateTimeline.PREV_ROTATION];\r\n\t\t\t\tlet frameTime = frames[frame];\r\n\t\t\t\tlet percent = rotateTimeline.getCurvePercent((frame >> 1) - 1,\r\n\t\t\t\t\t1 - (time - frameTime) / (frames[frame + RotateTimeline.PREV_TIME] - frameTime));\r\n\r\n\t\t\t\tr2 = frames[frame + RotateTimeline.ROTATION] - prevRotation;\r\n\t\t\t\tr2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;\r\n\t\t\t\tr2 = prevRotation + r2 * percent + bone.data.rotation;\r\n\t\t\t\tr2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Mix between rotations using the direction of the shortest route on the first frame while detecting crosses.\r\n\t\tlet total = 0, diff = r2 - r1;\r\n\t\tdiff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;\r\n\t\tif (diff == 0) {\r\n\t\t\ttotal = timelinesRotation[i];\r\n\t\t} else {\r\n\t\t\tlet lastTotal = 0, lastDiff = 0;\r\n\t\t\tif (firstFrame) {\r\n\t\t\t\tlastTotal = 0;\r\n\t\t\t\tlastDiff = diff;\r\n\t\t\t} else {\r\n\t\t\t\tlastTotal = timelinesRotation[i]; // Angle and direction of mix, including loops.\r\n\t\t\t\tlastDiff = timelinesRotation[i + 1]; // Difference between bones.\r\n\t\t\t}\r\n\t\t\tlet current = diff > 0, dir = lastTotal >= 0;\r\n\t\t\t// Detect cross at 0 (not 180).\r\n\t\t\tif (MathUtils.signum(lastDiff) != MathUtils.signum(diff) && Math.abs(lastDiff) <= 90) {\r\n\t\t\t\t// A cross after a 360 rotation is a loop.\r\n\t\t\t\tif (Math.abs(lastTotal) > 180) lastTotal += 360 * MathUtils.signum(lastTotal);\r\n\t\t\t\tdir = current;\r\n\t\t\t}\r\n\t\t\ttotal = diff + lastTotal - lastTotal % 360; // Store loops as part of lastTotal.\r\n\t\t\tif (dir != current) total += 360 * MathUtils.signum(lastTotal);\r\n\t\t\ttimelinesRotation[i] = total;\r\n\t\t}\r\n\t\ttimelinesRotation[i + 1] = diff;\r\n\t\tr1 += total * alpha;\r\n\t\tbone.rotation = r1 - (16384 - ((16384.499999999996 - r1 / 360) | 0)) * 360;\r\n\t}\r\n\r\n\tqueueEvents (entry: TrackEntry, animationTime: number) {\r\n\t\tlet animationStart = entry.animationStart, animationEnd = entry.animationEnd;\r\n\t\tlet duration = animationEnd - animationStart;\r\n\t\tlet trackLastWrapped = entry.trackLast % duration;\r\n\r\n\t\t// Queue events before complete.\r\n\t\tlet events = this.events;\r\n\t\tlet i = 0, n = events.length;\r\n\t\tfor (; i < n; i++) {\r\n\t\t\tlet event = events[i];\r\n\t\t\tif (event.time < trackLastWrapped) break;\r\n\t\t\tif (event.time > animationEnd) continue; // Discard events outside animation start/end.\r\n\t\t\tthis.queue.event(entry, event);\r\n\t\t}\r\n\r\n\t\t// Queue complete if completed a loop iteration or the animation.\r\n\t\tlet complete = false;\r\n\t\tif (entry.loop)\r\n\t\t\tcomplete = duration == 0 || trackLastWrapped > entry.trackTime % duration;\r\n\t\telse\r\n\t\t\tcomplete = animationTime >= animationEnd && entry.animationLast < animationEnd;\r\n\t\tif (complete) this.queue.complete(entry);\r\n\r\n\t\t// Queue events after complete.\r\n\t\tfor (; i < n; i++) {\r\n\t\t\tlet event = events[i];\r\n\t\t\tif (event.time < animationStart) continue; // Discard events outside animation start/end.\r\n\t\t\tthis.queue.event(entry, events[i]);\r\n\t\t}\r\n\t}\r\n\r\n\t/** Removes all animations from all tracks, leaving skeletons in their current pose.\r\n\t *\r\n\t * It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,\r\n\t * rather than leaving them in their current pose. */\r\n\tclearTracks () {\r\n\t\tlet oldDrainDisabled = this.queue.drainDisabled;\r\n\t\tthis.queue.drainDisabled = true;\r\n\t\tfor (let i = 0, n = this.tracks.length; i < n; i++)\r\n\t\t\tthis.clearTrack(i);\r\n\t\tthis.tracks.length = 0;\r\n\t\tthis.queue.drainDisabled = oldDrainDisabled;\r\n\t\tthis.queue.drain();\r\n\t}\r\n\r\n\t/** Removes all animations from the track, leaving skeletons in their current pose.\r\n\t *\r\n\t * It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,\r\n\t * rather than leaving them in their current pose. */\r\n\tclearTrack (trackIndex: number) {\r\n\t\tif (trackIndex >= this.tracks.length) return;\r\n\t\tlet current = this.tracks[trackIndex];\r\n\t\tif (current == null) return;\r\n\r\n\t\tthis.queue.end(current);\r\n\r\n\t\tthis.disposeNext(current);\r\n\r\n\t\tlet entry = current;\r\n\t\twhile (true) {\r\n\t\t\tlet from = entry.mixingFrom;\r\n\t\t\tif (from == null) break;\r\n\t\t\tthis.queue.end(from);\r\n\t\t\tentry.mixingFrom = null;\r\n\t\t\tentry.mixingTo = null;\r\n\t\t\tentry = from;\r\n\t\t}\r\n\r\n\t\tthis.tracks[current.trackIndex] = null;\r\n\r\n\t\tthis.queue.drain();\r\n\t}\r\n\r\n\tsetCurrent (index: number, current: TrackEntry, interrupt: boolean) {\r\n\t\tlet from = this.expandToIndex(index);\r\n\t\tthis.tracks[index] = current;\r\n\r\n\t\tif (from != null) {\r\n\t\t\tif (interrupt) this.queue.interrupt(from);\r\n\t\t\tcurrent.mixingFrom = from;\r\n\t\t\tfrom.mixingTo = current;\r\n\t\t\tcurrent.mixTime = 0;\r\n\r\n\t\t\t// Store the interrupted mix percentage.\r\n\t\t\tif (from.mixingFrom != null && from.mixDuration > 0)\r\n\t\t\t\tcurrent.interruptAlpha *= Math.min(1, from.mixTime / from.mixDuration);\r\n\r\n\t\t\tfrom.timelinesRotation.length = 0; // Reset rotation for mixing out, in case entry was mixed in.\r\n\t\t}\r\n\r\n\t\tthis.queue.start(current);\r\n\t}\r\n\r\n\t/** Sets an animation by name.\r\n\t*\r\n\t* {@link #setAnimationWith(}. */\r\n\tsetAnimation (trackIndex: number, animationName: string, loop: boolean) {\r\n\t\tlet animation = this.data.skeletonData.findAnimation(animationName);\r\n\t\tif (animation == null) throw new Error(\"Animation not found: \" + animationName);\r\n\t\treturn this.setAnimationWith(trackIndex, animation, loop);\r\n\t}\r\n\r\n\t/** Sets the current animation for a track, discarding any queued animations. If the formerly current track entry was never\r\n\t * applied to a skeleton, it is replaced (not mixed from).\r\n\t * @param loop If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its\r\n\t * duration. In either case {@link TrackEntry#trackEnd} determines when the track is cleared.\r\n\t * @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept\r\n\t * after the {@link AnimationStateListener#dispose()} event occurs. */\r\n\tsetAnimationWith (trackIndex: number, animation: Animation, loop: boolean) {\r\n\t\tif (animation == null) throw new Error(\"animation cannot be null.\");\r\n\t\tlet interrupt = true;\r\n\t\tlet current = this.expandToIndex(trackIndex);\r\n\t\tif (current != null) {\r\n\t\t\tif (current.nextTrackLast == -1) {\r\n\t\t\t\t// Don't mix from an entry that was never applied.\r\n\t\t\t\tthis.tracks[trackIndex] = current.mixingFrom;\r\n\t\t\t\tthis.queue.interrupt(current);\r\n\t\t\t\tthis.queue.end(current);\r\n\t\t\t\tthis.disposeNext(current);\r\n\t\t\t\tcurrent = current.mixingFrom;\r\n\t\t\t\tinterrupt = false;\r\n\t\t\t} else\r\n\t\t\t\tthis.disposeNext(current);\r\n\t\t}\r\n\t\tlet entry = this.trackEntry(trackIndex, animation, loop, current);\r\n\t\tthis.setCurrent(trackIndex, entry, interrupt);\r\n\t\tthis.queue.drain();\r\n\t\treturn entry;\r\n\t}\r\n\r\n\t/** Queues an animation by name.\r\n\t *\r\n\t * See {@link #addAnimationWith()}. */\r\n\taddAnimation (trackIndex: number, animationName: string, loop: boolean, delay: number) {\r\n\t\tlet animation = this.data.skeletonData.findAnimation(animationName);\r\n\t\tif (animation == null) throw new Error(\"Animation not found: \" + animationName);\r\n\t\treturn this.addAnimationWith(trackIndex, animation, loop, delay);\r\n\t}\r\n\r\n\t/** Adds an animation to be played after the current or last queued animation for a track. If the track is empty, it is\r\n\t * equivalent to calling {@link #setAnimationWith()}.\r\n\t * @param delay If > 0, sets {@link TrackEntry#delay}. If <= 0, the delay set is the duration of the previous track entry\r\n\t * minus any mix duration (from the {@link AnimationStateData}) plus the specified `delay` (ie the mix\r\n\t * ends at (`delay` = 0) or before (`delay` < 0) the previous track entry duration). If the\r\n\t * previous entry is looping, its next loop completion is used instead of its duration.\r\n\t * @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept\r\n\t * after the {@link AnimationStateListener#dispose()} event occurs. */\r\n\taddAnimationWith (trackIndex: number, animation: Animation, loop: boolean, delay: number) {\r\n\t\tif (animation == null) throw new Error(\"animation cannot be null.\");\r\n\r\n\t\tlet last = this.expandToIndex(trackIndex);\r\n\t\tif (last != null) {\r\n\t\t\twhile (last.next != null)\r\n\t\t\t\tlast = last.next;\r\n\t\t}\r\n\r\n\t\tlet entry = this.trackEntry(trackIndex, animation, loop, last);\r\n\r\n\t\tif (last == null) {\r\n\t\t\tthis.setCurrent(trackIndex, entry, true);\r\n\t\t\tthis.queue.drain();\r\n\t\t} else {\r\n\t\t\tlast.next = entry;\r\n\t\t\tif (delay <= 0) {\r\n\t\t\t\tlet duration = last.animationEnd - last.animationStart;\r\n\t\t\t\tif (duration != 0) {\r\n\t\t\t\t\tif (last.loop)\r\n\t\t\t\t\t\tdelay += duration * (1 + ((last.trackTime / duration) | 0));\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tdelay += Math.max(duration, last.trackTime);\r\n\t\t\t\t\tdelay -= this.data.getMix(last.animation, animation);\r\n\t\t\t\t} else\r\n\t\t\t\t\tdelay = last.trackTime;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tentry.delay = delay;\r\n\t\treturn entry;\r\n\t}\r\n\r\n\t/** Sets an empty animation for a track, discarding any queued animations, and sets the track entry's\r\n\t * {@link TrackEntry#mixduration}. An empty animation has no timelines and serves as a placeholder for mixing in or out.\r\n\t *\r\n\t * Mixing out is done by setting an empty animation with a mix duration using either {@link #setEmptyAnimation()},\r\n\t * {@link #setEmptyAnimations()}, or {@link #addEmptyAnimation()}. Mixing to an empty animation causes\r\n\t * the previous animation to be applied less and less over the mix duration. Properties keyed in the previous animation\r\n\t * transition to the value from lower tracks or to the setup pose value if no lower tracks key the property. A mix duration of\r\n\t * 0 still mixes out over one frame.\r\n\t *\r\n\t * Mixing in is done by first setting an empty animation, then adding an animation using\r\n\t * {@link #addAnimation()} and on the returned track entry, set the\r\n\t * {@link TrackEntry#setMixDuration()}. Mixing from an empty animation causes the new animation to be applied more and\r\n\t * more over the mix duration. Properties keyed in the new animation transition from the value from lower tracks or from the\r\n\t * setup pose value if no lower tracks key the property to the value keyed in the new animation. */\r\n\tsetEmptyAnimation (trackIndex: number, mixDuration: number) {\r\n\t\tlet entry = this.setAnimationWith(trackIndex, AnimationState.emptyAnimation, false);\r\n\t\tentry.mixDuration = mixDuration;\r\n\t\tentry.trackEnd = mixDuration;\r\n\t\treturn entry;\r\n\t}\r\n\r\n\t/** Adds an empty animation to be played after the current or last queued animation for a track, and sets the track entry's\r\n\t * {@link TrackEntry#mixDuration}. If the track is empty, it is equivalent to calling\r\n\t * {@link #setEmptyAnimation()}.\r\n\t *\r\n\t * See {@link #setEmptyAnimation()}.\r\n\t * @param delay If > 0, sets {@link TrackEntry#delay}. If <= 0, the delay set is the duration of the previous track entry\r\n\t * minus any mix duration plus the specified `delay` (ie the mix ends at (`delay` = 0) or\r\n\t * before (`delay` < 0) the previous track entry duration). If the previous entry is looping, its next\r\n\t * loop completion is used instead of its duration.\r\n\t * @return A track entry to allow further customization of animation playback. References to the track entry must not be kept\r\n\t * after the {@link AnimationStateListener#dispose()} event occurs. */\r\n\taddEmptyAnimation (trackIndex: number, mixDuration: number, delay: number) {\r\n\t\tif (delay <= 0) delay -= mixDuration;\r\n\t\tlet entry = this.addAnimationWith(trackIndex, AnimationState.emptyAnimation, false, delay);\r\n\t\tentry.mixDuration = mixDuration;\r\n\t\tentry.trackEnd = mixDuration;\r\n\t\treturn entry;\r\n\t}\r\n\r\n\t/** Sets an empty animation for every track, discarding any queued animations, and mixes to it over the specified mix\r\n\t* duration. */\r\n\tsetEmptyAnimations (mixDuration: number) {\r\n\t\tlet oldDrainDisabled = this.queue.drainDisabled;\r\n\t\tthis.queue.drainDisabled = true;\r\n\t\tfor (let i = 0, n = this.tracks.length; i < n; i++) {\r\n\t\t\tlet current = this.tracks[i];\r\n\t\t\tif (current != null) this.setEmptyAnimation(current.trackIndex, mixDuration);\r\n\t\t}\r\n\t\tthis.queue.drainDisabled = oldDrainDisabled;\r\n\t\tthis.queue.drain();\r\n\t}\r\n\r\n\texpandToIndex (index: number) {\r\n\t\tif (index < this.tracks.length) return this.tracks[index];\r\n\t\tUtils.ensureArrayCapacity(this.tracks, index + 1, null);\r\n\t\tthis.tracks.length = index + 1;\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/** @param last May be null. */\r\n\ttrackEntry (trackIndex: number, animation: Animation, loop: boolean, last: TrackEntry) {\r\n\t\tlet entry = this.trackEntryPool.obtain();\r\n\t\tentry.trackIndex = trackIndex;\r\n\t\tentry.animation = animation;\r\n\t\tentry.loop = loop;\r\n\t\tentry.holdPrevious = false;\r\n\r\n\t\tentry.eventThreshold = 0;\r\n\t\tentry.attachmentThreshold = 0;\r\n\t\tentry.drawOrderThreshold = 0;\r\n\r\n\t\tentry.animationStart = 0;\r\n\t\tentry.animationEnd = animation.duration;\r\n\t\tentry.animationLast = -1;\r\n\t\tentry.nextAnimationLast = -1;\r\n\r\n\t\tentry.delay = 0;\r\n\t\tentry.trackTime = 0;\r\n\t\tentry.trackLast = -1;\r\n\t\tentry.nextTrackLast = -1;\r\n\t\tentry.trackEnd = Number.MAX_VALUE;\r\n\t\tentry.timeScale = 1;\r\n\r\n\t\tentry.alpha = 1;\r\n\t\tentry.interruptAlpha = 1;\r\n\t\tentry.mixTime = 0;\r\n\t\tentry.mixDuration = last == null ? 0 : this.data.getMix(last.animation, animation);\r\n\t\tentry.mixBlend = MixBlend.replace;\r\n\t\treturn entry;\r\n\t}\r\n\r\n\tdisposeNext (entry: TrackEntry) {\r\n\t\tlet next = entry.next;\r\n\t\twhile (next != null) {\r\n\t\t\tthis.queue.dispose(next);\r\n\t\t\tnext = next.next;\r\n\t\t}\r\n\t\tentry.next = null;\r\n\t}\r\n\r\n\t_animationsChanged () {\r\n\t\tthis.animationsChanged = false;\r\n\r\n\t\tthis.propertyIDs.clear();\r\n\r\n\t\tfor (let i = 0, n = this.tracks.length; i < n; i++) {\r\n\t\t\tlet entry = this.tracks[i];\r\n\t\t\tif (entry == null) continue;\r\n\t\t\twhile (entry.mixingFrom != null)\r\n\t\t\t\tentry = entry.mixingFrom;\r\n\r\n\t\t\tdo {\r\n\t\t\t\tif (entry.mixingFrom == null || entry.mixBlend != MixBlend.add) this.computeHold(entry);\r\n\t\t\t\tentry = entry.mixingTo;\r\n\t\t\t} while (entry != null)\r\n\t\t}\r\n\t}\r\n\r\n\tcomputeHold (entry: TrackEntry) {\r\n\t\tlet to = entry.mixingTo;\r\n\t\tlet timelines = entry.animation.timelines;\r\n\t\tlet timelinesCount = entry.animation.timelines.length;\r\n\t\tlet timelineMode = Utils.setArraySize(entry.timelineMode, timelinesCount);\r\n\t\tentry.timelineHoldMix.length = 0;\r\n\t\tlet timelineDipMix = Utils.setArraySize(entry.timelineHoldMix, timelinesCount);\r\n\t\tlet propertyIDs = this.propertyIDs;\r\n\r\n\t\tif (to != null && to.holdPrevious) {\r\n\t\t\tfor (let i = 0; i < timelinesCount; i++) {\r\n\t\t\t\ttimelineMode[i] = propertyIDs.add(timelines[i].getPropertyId()) ? AnimationState.HOLD_FIRST : AnimationState.HOLD_SUBSEQUENT;\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\touter:\r\n\t\tfor (let i = 0; i < timelinesCount; i++) {\r\n\t\t\tlet timeline = timelines[i];\r\n\t\t\tlet id = timeline.getPropertyId();\r\n\t\t\tif (!propertyIDs.add(id))\r\n\t\t\t\ttimelineMode[i] = AnimationState.SUBSEQUENT;\r\n\t\t\telse if (to == null || timeline instanceof AttachmentTimeline || timeline instanceof DrawOrderTimeline\r\n\t\t\t\t|| timeline instanceof EventTimeline || !to.animation.hasTimeline(id)) {\r\n\t\t\t\ttimelineMode[i] = AnimationState.FIRST;\r\n\t\t\t} else {\r\n\t\t\t\tfor (let next = to.mixingTo; next != null; next = next.mixingTo) {\r\n\t\t\t\t\tif (next.animation.hasTimeline(id)) continue;\r\n\t\t\t\t\tif (entry.mixDuration > 0) {\r\n\t\t\t\t\t\ttimelineMode[i] = AnimationState.HOLD_MIX;\r\n\t\t\t\t\t\ttimelineDipMix[i] = next;\r\n\t\t\t\t\t\tcontinue outer;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\ttimelineMode[i] = AnimationState.HOLD_FIRST;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/** Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing. */\r\n\tgetCurrent (trackIndex: number) {\r\n\t\tif (trackIndex >= this.tracks.length) return null;\r\n\t\treturn this.tracks[trackIndex];\r\n\t}\r\n\r\n\t/** Adds a listener to receive events for all track entries. */\r\n\taddListener (listener: AnimationStateListener) {\r\n\t\tif (listener == null) throw new Error(\"listener cannot be null.\");\r\n\t\tthis.listeners.push(listener);\r\n\t}\r\n\r\n\t/** Removes the listener added with {@link #addListener()}. */\r\n\tremoveListener (listener: AnimationStateListener) {\r\n\t\tlet index = this.listeners.indexOf(listener);\r\n\t\tif (index >= 0) this.listeners.splice(index, 1);\r\n\t}\r\n\r\n\t/** Removes all listeners added with {@link #addListener()}. */\r\n\tclearListeners () {\r\n\t\tthis.listeners.length = 0;\r\n\t}\r\n\r\n\t/** Discards all listener notifications that have not yet been delivered. This can be useful to call from an\r\n\t * {@link AnimationStateListener} when it is known that further notifications that may have been already queued for delivery\r\n\t * are not wanted because new animations are being set. */\r\n\tclearListenerNotifications () {\r\n\t\tthis.queue.clear();\r\n\t}\r\n}\r\n\r\n/** Stores settings and other state for the playback of an animation on an {@link AnimationState} track.\r\n *\r\n * References to a track entry must not be kept after the {@link AnimationStateListener#dispose()} event occurs. */\r\nexport class TrackEntry {\r\n\t/** The animation to apply for this track entry. */\r\n\tanimation: Animation;\r\n\r\n\t/** The animation queued to start after this animation, or null. `next` makes up a linked list. */\r\n\tnext: TrackEntry;\r\n\r\n\t/** The track entry for the previous animation when mixing from the previous animation to this animation, or null if no\r\n\t * mixing is currently occuring. When mixing from multiple animations, `mixingFrom` makes up a linked list. */\r\n\tmixingFrom: TrackEntry;\r\n\r\n\t/** The track entry for the next animation when mixing from this animation to the next animation, or null if no mixing is\r\n\t * currently occuring. When mixing to multiple animations, `mixingTo` makes up a linked list. */\r\n\tmixingTo: TrackEntry;\r\n\r\n\t/** The listener for events generated by this track entry, or null.\r\n\t *\r\n\t * A track entry returned from {@link AnimationState#setAnimation()} is already the current animation\r\n\t * for the track, so the track entry listener {@link AnimationStateListener#start()} will not be called. */\r\n\tlistener: AnimationStateListener;\r\n\r\n\t/** The index of the track where this track entry is either current or queued.\r\n\t *\r\n\t * See {@link AnimationState#getCurrent()}. */\r\n\ttrackIndex: number;\r\n\r\n\t/** If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its\r\n\t * duration. */\r\n\tloop: boolean;\r\n\r\n\t/** If true, when mixing from the previous animation to this animation, the previous animation is applied as normal instead\r\n\t * of being mixed out.\r\n\t *\r\n\t * When mixing between animations that key the same property, if a lower track also keys that property then the value will\r\n\t * briefly dip toward the lower track value during the mix. This happens because the first animation mixes from 100% to 0%\r\n\t * while the second animation mixes from 0% to 100%. Setting `holdPrevious` to true applies the first animation\r\n\t * at 100% during the mix so the lower track value is overwritten. Such dipping does not occur on the lowest track which\r\n\t * keys the property, only when a higher track also keys the property.\r\n\t *\r\n\t * Snapping will occur if `holdPrevious` is true and this animation does not key all the same properties as the\r\n\t * previous animation. */\r\n\tholdPrevious: boolean;\r\n\r\n\t/** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the\r\n\t * `eventThreshold`, event timelines are applied while this animation is being mixed out. Defaults to 0, so event\r\n\t * timelines are not applied while this animation is being mixed out. */\r\n\teventThreshold: number;\r\n\r\n\t/** When the mix percentage ({@link #mixtime} / {@link #mixDuration}) is less than the\r\n\t * `attachmentThreshold`, attachment timelines are applied while this animation is being mixed out. Defaults to\r\n\t * 0, so attachment timelines are not applied while this animation is being mixed out. */\r\n\tattachmentThreshold: number;\r\n\r\n\t/** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the\r\n\t * `drawOrderThreshold`, draw order timelines are applied while this animation is being mixed out. Defaults to 0,\r\n\t * so draw order timelines are not applied while this animation is being mixed out. */\r\n\tdrawOrderThreshold: number;\r\n\r\n\t/** Seconds when this animation starts, both initially and after looping. Defaults to 0.\r\n\t *\r\n\t * When changing the `animationStart` time, it often makes sense to set {@link #animationLast} to the same\r\n\t * value to prevent timeline keys before the start time from triggering. */\r\n\tanimationStart: number;\r\n\r\n\t/** Seconds for the last frame of this animation. Non-looping animations won't play past this time. Looping animations will\r\n\t * loop back to {@link #animationStart} at this time. Defaults to the animation {@link Animation#duration}. */\r\n\tanimationEnd: number;\r\n\r\n\r\n\t/** The time in seconds this animation was last applied. Some timelines use this for one-time triggers. Eg, when this\r\n\t * animation is applied, event timelines will fire all events between the `animationLast` time (exclusive) and\r\n\t * `animationTime` (inclusive). Defaults to -1 to ensure triggers on frame 0 happen the first time this animation\r\n\t * is applied. */\r\n\tanimationLast: number;\r\n\r\n\tnextAnimationLast: number;\r\n\r\n\t/** Seconds to postpone playing the animation. When this track entry is the current track entry, `delay`\r\n\t * postpones incrementing the {@link #trackTime}. When this track entry is queued, `delay` is the time from\r\n\t * the start of the previous animation to when this track entry will become the current track entry (ie when the previous\r\n\t * track entry {@link TrackEntry#trackTime} >= this track entry's `delay`).\r\n\t *\r\n\t * {@link #timeScale} affects the delay. */\r\n\tdelay: number;\r\n\r\n\t/** Current time in seconds this track entry has been the current track entry. The track time determines\r\n\t * {@link #animationTime}. The track time can be set to start the animation at a time other than 0, without affecting\r\n\t * looping. */\r\n\ttrackTime: number;\r\n\r\n\ttrackLast: number; nextTrackLast: number;\r\n\r\n\t/** The track time in seconds when this animation will be removed from the track. Defaults to the highest possible float\r\n\t * value, meaning the animation will be applied until a new animation is set or the track is cleared. If the track end time\r\n\t * is reached, no other animations are queued for playback, and mixing from any previous animations is complete, then the\r\n\t * properties keyed by the animation are set to the setup pose and the track is cleared.\r\n\t *\r\n\t * It may be desired to use {@link AnimationState#addEmptyAnimation()} rather than have the animation\r\n\t * abruptly cease being applied. */\r\n\ttrackEnd: number;\r\n\r\n\t/** Multiplier for the delta time when this track entry is updated, causing time for this animation to pass slower or\r\n\t * faster. Defaults to 1.\r\n\t *\r\n\t * {@link #mixTime} is not affected by track entry time scale, so {@link #mixDuration} may need to be adjusted to\r\n\t * match the animation speed.\r\n\t *\r\n\t * When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the\r\n\t * {@link #delay} is set using the mix duration from the {@link AnimationStateData}, assuming time scale to be 1. If\r\n\t * the time scale is not 1, the delay may need to be adjusted.\r\n\t *\r\n\t * See AnimationState {@link AnimationState#timeScale} for affecting all animations. */\r\n\ttimeScale: number;\r\n\r\n\t/** Values < 1 mix this animation with the skeleton's current pose (usually the pose resulting from lower tracks). Defaults\r\n\t * to 1, which overwrites the skeleton's current pose with this animation.\r\n\t *\r\n\t * Typically track 0 is used to completely pose the skeleton, then alpha is used on higher tracks. It doesn't make sense to\r\n\t * use alpha on track 0 if the skeleton pose is from the last frame render. */\r\n\talpha: number;\r\n\r\n\t/** Seconds from 0 to the {@link #getMixDuration()} when mixing from the previous animation to this animation. May be\r\n\t * slightly more than `mixDuration` when the mix is complete. */\r\n\tmixTime: number;\r\n\r\n\t/** Seconds for mixing from the previous animation to this animation. Defaults to the value provided by AnimationStateData\r\n\t * {@link AnimationStateData#getMix()} based on the animation before this animation (if any).\r\n\t *\r\n\t * A mix duration of 0 still mixes out over one frame to provide the track entry being mixed out a chance to revert the\r\n\t * properties it was animating.\r\n\t *\r\n\t * The `mixDuration` can be set manually rather than use the value from\r\n\t * {@link AnimationStateData#getMix()}. In that case, the `mixDuration` can be set for a new\r\n\t * track entry only before {@link AnimationState#update(float)} is first called.\r\n\t *\r\n\t * When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the\r\n\t * {@link #delay} is set using the mix duration from the {@link AnimationStateData}, not a mix duration set\r\n\t * afterward. */\r\n\tmixDuration: number; interruptAlpha: number; totalAlpha: number;\r\n\r\n\t/** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to {@link MixBlend#replace}, which\r\n\t * replaces the values from the lower tracks with the animation values. {@link MixBlend#add} adds the animation values to\r\n\t * the values from the lower tracks.\r\n\t *\r\n\t * The `mixBlend` can be set for a new track entry only before {@link AnimationState#apply()} is first\r\n\t * called. */\r\n\tmixBlend = MixBlend.replace;\r\n\ttimelineMode = new Array<number>();\r\n\ttimelineHoldMix = new Array<TrackEntry>();\r\n\ttimelinesRotation = new Array<number>();\r\n\r\n\treset () {\r\n\t\tthis.next = null;\r\n\t\tthis.mixingFrom = null;\r\n\t\tthis.mixingTo = null;\r\n\t\tthis.animation = null;\r\n\t\tthis.listener = null;\r\n\t\tthis.timelineMode.length = 0;\r\n\t\tthis.timelineHoldMix.length = 0;\r\n\t\tthis.timelinesRotation.length = 0;\r\n\t}\r\n\r\n\t/** Uses {@link #trackTime} to compute the `animationTime`, which is between {@link #animationStart}\r\n\t * and {@link #animationEnd}. When the `trackTime` is 0, the `animationTime` is equal to the\r\n\t * `animationStart` time. */\r\n\tgetAnimationTime () {\r\n\t\tif (this.loop) {\r\n\t\t\tlet duration = this.animationEnd - this.animationStart;\r\n\t\t\tif (duration == 0) return this.animationStart;\r\n\t\t\treturn (this.trackTime % duration) + this.animationStart;\r\n\t\t}\r\n\t\treturn Math.min(this.trackTime + this.animationStart, this.animationEnd);\r\n\t}\r\n\r\n\tsetAnimationLast(animationLast: number) {\r\n\t\tthis.animationLast = animationLast;\r\n\t\tthis.nextAnimationLast = animationLast;\r\n\t}\r\n\r\n\t/** Returns true if at least one loop has been completed.\r\n\t *\r\n\t * See {@link AnimationStateListener#complete()}. */\r\n\tisComplete () {\r\n\t\treturn this.trackTime >= this.animationEnd - this.animationStart;\r\n\t}\r\n\r\n\t/** Resets the rotation directions for mixing this entry's rotate timelines. This can be useful to avoid bones rotating the\r\n\t * long way around when using {@link #alpha} and starting animations on other tracks.\r\n\t *\r\n\t * Mixing with {@link MixBlend#replace} involves finding a rotation between two others, which has two possible solutions:\r\n\t * the short way or the long way around. The two rotations likely change over time, so which direction is the short or long\r\n\t * way also changes. If the short way was always chosen, bones would flip to the other side when that direction became the\r\n\t * long way. TrackEntry chooses the short way the first time it is applied and remembers that direction. */\r\n\tresetRotationDirections () {\r\n\t\tthis.timelinesRotation.length = 0;\r\n\t}\r\n}\r\n\r\nexport class EventQueue {\r\n\tobjects: Array<any> = [];\r\n\tdrainDisabled = false;\r\n\tanimState: AnimationState;\r\n\r\n\tconstructor(animState: AnimationState) {\r\n\t\tthis.animState = animState;\r\n\t}\r\n\r\n\tstart (entry: TrackEntry) {\r\n\t\tthis.objects.push(EventType.start);\r\n\t\tthis.objects.push(entry);\r\n\t\tthis.animState.animationsChanged = true;\r\n\t}\r\n\r\n\tinterrupt (entry: TrackEntry) {\r\n\t\tthis.objects.push(EventType.interrupt);\r\n\t\tthis.objects.push(entry);\r\n\t}\r\n\r\n\tend (entry: TrackEntry) {\r\n\t\tthis.objects.push(EventType.end);\r\n\t\tthis.objects.push(entry);\r\n\t\tthis.animState.animationsChanged = true;\r\n\t}\r\n\r\n\tdispose (entry: TrackEntry) {\r\n\t\tthis.objects.push(EventType.dispose);\r\n\t\tthis.objects.push(entry);\r\n\t}\r\n\r\n\tcomplete (entry: TrackEntry) {\r\n\t\tthis.objects.push(EventType.complete);\r\n\t\tthis.objects.push(entry);\r\n\t}\r\n\r\n\tevent (entry: TrackEntry, event: Event) {\r\n\t\tthis.objects.push(EventType.event);\r\n\t\tthis.objects.push(entry);\r\n\t\tthis.objects.push(event);\r\n\t}\r\n\r\n\tdrain () {\r\n\t\tif (this.drainDisabled) return;\r\n\t\tthis.drainDisabled = true;\r\n\r\n\t\tlet objects = this.objects;\r\n\t\tlet listeners = this.animState.listeners;\r\n\r\n\t\tfor (let i = 0; i < objects.length; i += 2) {\r\n\t\t\tlet type = objects[i] as EventType;\r\n\t\t\tlet entry = objects[i + 1] as TrackEntry;\r\n\t\t\tswitch (type) {\r\n\t\t\tcase EventType.start:\r\n\t\t\t\tif (entry.listener != null && entry.listener.start) entry.listener.start(entry);\r\n\t\t\t\tfor (let ii = 0; ii < listeners.length; ii++)\r\n\t\t\t\t\tif (listeners[ii].start) listeners[ii].start(entry);\r\n\t\t\t\tbreak;\r\n\t\t\tcase EventType.interrupt:\r\n\t\t\t\tif (entry.listener != null && entry.listener.interrupt) entry.listener.interrupt(entry);\r\n\t\t\t\tfor (let ii = 0; ii < listeners.length; ii++)\r\n\t\t\t\t\tif (listeners[ii].interrupt) listeners[ii].interrupt(entry);\r\n\t\t\t\tbreak;\r\n\t\t\tcase EventType.end:\r\n\t\t\t\tif (entry.listener != null && entry.listener.end) entry.listener.end(entry);\r\n\t\t\t\tfor (let ii = 0; ii < listeners.length; ii++)\r\n\t\t\t\t\tif (listeners[ii].end) listeners[ii].end(entry);\r\n\t\t\t\t// Fall through.\r\n\t\t\tcase EventType.dispose:\r\n\t\t\t\tif (entry.listener != null && entry.listener.dispose) entry.listener.dispose(entry);\r\n\t\t\t\tfor (let ii = 0; ii < listeners.length; ii++)\r\n\t\t\t\t\tif (listeners[ii].dispose) listeners[ii].dispose(entry);\r\n\t\t\t\tthis.animState.trackEntryPool.free(entry);\r\n\t\t\t\tbreak;\r\n\t\t\tcase EventType.complete:\r\n\t\t\t\tif (entry.listener != null && entry.listener.complete) entry.listener.complete(entry);\r\n\t\t\t\tfor (let ii = 0; ii < listeners.length; ii++)\r\n\t\t\t\t\tif (listeners[ii].complete) listeners[ii].complete(entry);\r\n\t\t\t\tbreak;\r\n\t\t\tcase EventType.event:\r\n\t\t\t\tlet event = objects[i++ + 2] as Event;\r\n\t\t\t\tif (entry.listener != null && entry.listener.event) entry.listener.event(entry, event);\r\n\t\t\t\tfor (let ii = 0; ii < listeners.length; ii++)\r\n\t\t\t\t\tif (listeners[ii].event) listeners[ii].event(entry, event);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.clear();\r\n\r\n\t\tthis.drainDisabled = false;\r\n\t}\r\n\r\n\tclear () {\r\n\t\tthis.objects.length = 0;\r\n\t}\r\n}\r\n\r\nexport enum EventType {\r\n\tstart, interrupt, end, dispose, complete, event\r\n}\r\n\r\n/** The interface to implement for receiving TrackEntry events. It is always safe to call AnimationState methods when receiving\r\n * events.\r\n *\r\n * See TrackEntry {@link TrackEntry#listener} and AnimationState\r\n * {@link AnimationState#addListener()}. */\r\nexport interface AnimationStateListener {\r\n\t/** Invoked when this entry has been set as the current entry. */\r\n\tstart (entry: TrackEntry): void;\r\n\r\n\t/** Invoked when another entry has replaced this entry as the current entry. This entry may continue being applied for\r\n\t * mixing. */\r\n\tinterrupt (entry: TrackEntry): void;\r\n\r\n\t/** Invoked when this entry is no longer the current entry and will never be applied again. */\r\n\tend (entry: TrackEntry): void;\r\n\r\n\t/** Invoked when this entry will be disposed. This may occur without the entry ever being set as the current entry.\r\n\t * References to the entry should not be kept after dispose is called, as it may be destroyed or reused. */\r\n\tdispose (entry: TrackEntry): void;\r\n\r\n\t/** Invoked every time this entry's animation completes a loop. */\r\n\tcomplete (entry: TrackEntry): void;\r\n\r\n\t/** Invoked when this entry's animation triggers an event. */\r\n\tevent (entry: TrackEntry, event: Event): void;\r\n}\r\n\r\nexport abstract class AnimationStateAdapter implements AnimationStateListener {\r\n\tstart (entry: TrackEntry) {\r\n\t}\r\n\r\n\tinterrupt (entry: TrackEntry) {\r\n\t}\r\n\r\n\tend (entry: TrackEntry) {\r\n\t}\r\n\r\n\tdispose (entry: TrackEntry) {\r\n\t}\r\n\r\n\tcomplete (entry: TrackEntry) {\r\n\t}\r\n\r\n\tevent (entry: TrackEntry, event: Event) {\r\n\t}\r\n}\r\n","\r\n\r\nimport { SkeletonData } from \"./SkeletonData\";\r\nimport { Animation } from \"./Animation\";\r\nimport { Map } from \"./Utils\"\r\n\r\n\r\n/** Stores mix (crossfade) durations to be applied when {@link AnimationState} animations are changed. */\r\nexport class AnimationStateData {\r\n\t/** The SkeletonData to look up animations when they are specified by name. */\r\n\tskeletonData: SkeletonData;\r\n\r\n\tanimationToMixTime: Map<number> = {};\r\n\r\n\t/** The mix duration to use when no mix duration has been defined between two animations. */\r\n\tdefaultMix = 0;\r\n\r\n\tconstructor (skeletonData: SkeletonData) {\r\n\t\tif (skeletonData == null) throw new Error(\"skeletonData cannot be null.\");\r\n\t\tthis.skeletonData = skeletonData;\r\n\t}\r\n\r\n\t/** Sets a mix duration by animation name.\r\n\t *\r\n\t * See {@link #setMixWith()}. */\r\n\tsetMix (fromName: string, toName: string, duration: number) {\r\n\t\tlet from = this.skeletonData.findAnimation(fromName);\r\n\t\tif (from == null) throw new Error(\"Animation not found: \" + fromName);\r\n\t\tlet to = this.skeletonData.findAnimation(toName);\r\n\t\tif (to == null) throw new Error(\"Animation not found: \" + toName);\r\n\t\tthis.setMixWith(from, to, duration);\r\n\t}\r\n\r\n\t/** Sets the mix duration when changing from the specified animation to the other.\r\n\t *\r\n\t * See {@link TrackEntry#mixDuration}. */\r\n\tsetMixWith (from: Animation, to: Animation, duration: number) {\r\n\t\tif (from == null) throw new Error(\"from cannot be null.\");\r\n\t\tif (to == null) throw new Error(\"to cannot be null.\");\r\n\t\tlet key = from.name + \".\" + to.name;\r\n\t\tthis.animationToMixTime[key] = duration;\r\n\t}\r\n\r\n\t/** Returns the mix duration to use when changing from the specified animation to the other, or the {@link #defaultMix} if\r\n\t* no mix duration has been set. */\r\n\tgetMix (from: Animation, to: Animation) {\r\n\t\tlet key = from.name + \".\" + to.name;\r\n\t\tlet value = this.animationToMixTime[key];\r\n\t\treturn value === undefined ? this.defaultMix : value;\r\n\t}\r\n}\r\n","\n\nimport { VertexAttachment, Attachment } from \"./Attachment\";\nimport { SlotData } from \"../SlotData\";\nimport { Color } from \"../Utils\";\n\n\n/** An attachment with vertices that make up a polygon used for clipping the rendering of other attachments. */\nexport class ClippingAttachment extends VertexAttachment {\n\t/** Clipping is performed between the clipping polygon's slot and the end slot. Returns null if clipping is done until the end of\n\t * the skeleton's rendering. */\n\tendSlot: SlotData;\n\n\t// Nonessential.\n\t/** The color of the clipping polygon as it was in Spine. Available only when nonessential data was exported. Clipping polygons\n\t * are not usually rendered at runtime. */\n\tcolor = new Color(0.2275, 0.2275, 0.8078, 1); // ce3a3aff\n\n\tconstructor (name: string) {\n\t\tsuper(name);\n\t}\n\n\tcopy (): Attachment {\n\t\tlet copy = new ClippingAttachment(this.name);\n\t\tthis.copyTo(copy);\n\t\tcopy.endSlot = this.endSlot;\n\t\tcopy.color.setFromColor(this.color);\n\t\treturn copy;\n\t}\n}\n","\n\nimport { Pool } from \"./Utils\";\n\n\nexport class Triangulator {\n\tprivate convexPolygons = new Array<Array<number>>();\n\tprivate convexPolygonsIndices = new Array<Array<number>>();\n\n\tprivate indicesArray = new Array<number>();\n\tprivate isConcaveArray = new Array<boolean>();\n\tprivate triangles = new Array<number>();\n\n\tprivate polygonPool = new Pool<Array<number>>(() => {\n\t\treturn new Array<number>();\n\t});\n\n\tprivate polygonIndicesPool = new Pool<Array<number>>(() => {\n\t\treturn new Array<number>();\n\t});\n\n\tpublic triangulate (verticesArray: ArrayLike<number>): Array<number> {\n\t\tlet vertices = verticesArray;\n\t\tlet vertexCount = verticesArray.length >> 1;\n\n\t\tlet indices = this.indicesArray;\n\t\tindices.length = 0;\n\t\tfor (let i = 0; i < vertexCount; i++)\n\t\t\tindices[i] = i;\n\n\t\tlet isConcave = this.isConcaveArray;\n\t\tisConcave.length = 0;\n\t\tfor (let i = 0, n = vertexCount; i < n; ++i)\n\t\t\tisConcave[i] = Triangulator.isConcave(i, vertexCount, vertices, indices);\n\n\t\tlet triangles = this.triangles;\n\t\ttriangles.length = 0;\n\n\t\twhile (vertexCount > 3) {\n\t\t\t// Find ear tip.\n\t\t\tlet previous = vertexCount - 1, i = 0, next = 1;\n\t\t\twhile (true) {\n\t\t\t\touter:\n\t\t\t\tif (!isConcave[i]) {\n\t\t\t\t\tlet p1 = indices[previous] << 1, p2 = indices[i] << 1, p3 = indices[next] << 1;\n\t\t\t\t\tlet p1x = vertices[p1], p1y = vertices[p1 + 1];\n\t\t\t\t\tlet p2x = vertices[p2], p2y = vertices[p2 + 1];\n\t\t\t\t\tlet p3x = vertices[p3], p3y = vertices[p3 + 1];\n\t\t\t\t\tfor (let ii = (next + 1) % vertexCount; ii != previous; ii = (ii + 1) % vertexCount) {\n\t\t\t\t\t\tif (!isConcave[ii]) continue;\n\t\t\t\t\t\tlet v = indices[ii] << 1;\n\t\t\t\t\t\tlet vx = vertices[v], vy = vertices[v + 1];\n\t\t\t\t\t\tif (Triangulator.positiveArea(p3x, p3y, p1x, p1y, vx, vy)) {\n\t\t\t\t\t\t\tif (Triangulator.positiveArea(p1x, p1y, p2x, p2y, vx, vy)) {\n\t\t\t\t\t\t\t\tif (Triangulator.positiveArea(p2x, p2y, p3x, p3y, vx, vy)) break outer;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (next == 0) {\n\t\t\t\t\tdo {\n\t\t\t\t\t\tif (!isConcave[i]) break;\n\t\t\t\t\t\ti--;\n\t\t\t\t\t} while (i > 0);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tprevious = i;\n\t\t\t\ti = next;\n\t\t\t\tnext = (next + 1) % vertexCount;\n\t\t\t}\n\n\t\t\t// Cut ear tip.\n\t\t\ttriangles.push(indices[(vertexCount + i - 1) % vertexCount]);\n\t\t\ttriangles.push(indices[i]);\n\t\t\ttriangles.push(indices[(i + 1) % vertexCount]);\n\t\t\tindices.splice(i, 1);\n\t\t\tisConcave.splice(i, 1);\n\t\t\tvertexCount--;\n\n\t\t\tlet previousIndex = (vertexCount + i - 1) % vertexCount;\n\t\t\tlet nextIndex = i == vertexCount ? 0 : i;\n\t\t\tisConcave[previousIndex] = Triangulator.isConcave(previousIndex, vertexCount, vertices, indices);\n\t\t\tisConcave[nextIndex] = Triangulator.isConcave(nextIndex, vertexCount, vertices, indices);\n\t\t}\n\n\t\tif (vertexCount == 3) {\n\t\t\ttriangles.push(indices[2]);\n\t\t\ttriangles.push(indices[0]);\n\t\t\ttriangles.push(indices[1]);\n\t\t}\n\n\t\treturn triangles;\n\t}\n\n\tdecompose (verticesArray: Array<number>, triangles: Array<number>) : Array<Array<number>> {\n\t\tlet vertices = verticesArray;\n\t\tlet convexPolygons = this.convexPolygons;\n\t\tthis.polygonPool.freeAll(convexPolygons);\n\t\tconvexPolygons.length = 0;\n\n\t\tlet convexPolygonsIndices = this.convexPolygonsIndices;\n\t\tthis.polygonIndicesPool.freeAll(convexPolygonsIndices);\n\t\tconvexPolygonsIndices.length = 0;\n\n\t\tlet polygonIndices = this.polygonIndicesPool.obtain();\n\t\tpolygonIndices.length = 0;\n\n\t\tlet polygon = this.polygonPool.obtain();\n\t\tpolygon.length = 0;\n\n\t\t// Merge subsequent triangles if they form a triangle fan.\n\t\tlet fanBaseIndex = -1, lastWinding = 0;\n\t\tfor (let i = 0, n = triangles.length; i < n; i += 3) {\n\t\t\tlet t1 = triangles[i] << 1, t2 = triangles[i + 1] << 1, t3 = triangles[i + 2] << 1;\n\t\t\tlet x1 = vertices[t1], y1 = vertices[t1 + 1];\n\t\t\tlet x2 = vertices[t2], y2 = vertices[t2 + 1];\n\t\t\tlet x3 = vertices[t3], y3 = vertices[t3 + 1];\n\n\t\t\t// If the base of the last triangle is the same as this triangle, check if they form a convex polygon (triangle fan).\n\t\t\tlet merged = false;\n\t\t\tif (fanBaseIndex == t1) {\n\t\t\t\tlet o = polygon.length - 4;\n\t\t\t\tlet winding1 = Triangulator.winding(polygon[o], polygon[o + 1], polygon[o + 2], polygon[o + 3], x3, y3);\n\t\t\t\tlet winding2 = Triangulator.winding(x3, y3, polygon[0], polygon[1], polygon[2], polygon[3]);\n\t\t\t\tif (winding1 == lastWinding && winding2 == lastWinding) {\n\t\t\t\t\tpolygon.push(x3);\n\t\t\t\t\tpolygon.push(y3);\n\t\t\t\t\tpolygonIndices.push(t3);\n\t\t\t\t\tmerged = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Otherwise make this triangle the new base.\n\t\t\tif (!merged) {\n\t\t\t\tif (polygon.length > 0) {\n\t\t\t\t\tconvexPolygons.push(polygon);\n\t\t\t\t\tconvexPolygonsIndices.push(polygonIndices);\n\t\t\t\t} else {\n\t\t\t\t\tthis.polygonPool.free(polygon)\n\t\t\t\t\tthis.polygonIndicesPool.free(polygonIndices);\n\t\t\t\t}\n\t\t\t\tpolygon = this.polygonPool.obtain();\n\t\t\t\tpolygon.length = 0;\n\t\t\t\tpolygon.push(x1);\n\t\t\t\tpolygon.push(y1);\n\t\t\t\tpolygon.push(x2);\n\t\t\t\tpolygon.push(y2);\n\t\t\t\tpolygon.push(x3);\n\t\t\t\tpolygon.push(y3);\n\t\t\t\tpolygonIndices = this.polygonIndicesPool.obtain();\n\t\t\t\tpolygonIndices.length = 0;\n\t\t\t\tpolygonIndices.push(t1);\n\t\t\t\tpolygonIndices.push(t2);\n\t\t\t\tpolygonIndices.push(t3);\n\t\t\t\tlastWinding = Triangulator.winding(x1, y1, x2, y2, x3, y3);\n\t\t\t\tfanBaseIndex = t1;\n\t\t\t}\n\t\t}\n\n\t\tif (polygon.length > 0) {\n\t\t\tconvexPolygons.push(polygon);\n\t\t\tconvexPolygonsIndices.push(polygonIndices);\n\t\t}\n\n\t\t// Go through the list of polygons and try to merge the remaining triangles with the found triangle fans.\n\t\tfor (let i = 0, n = convexPolygons.length; i < n; i++) {\n\t\t\tpolygonIndices = convexPolygonsIndices[i];\n\t\t\tif (polygonIndices.length == 0) continue;\n\t\t\tlet firstIndex = polygonIndices[0];\n\t\t\tlet lastIndex = polygonIndices[polygonIndices.length - 1];\n\n\t\t\tpolygon = convexPolygons[i];\n\t\t\tlet o = polygon.length - 4;\n\t\t\tlet prevPrevX = polygon[o], prevPrevY = polygon[o + 1];\n\t\t\tlet prevX = polygon[o + 2], prevY = polygon[o + 3];\n\t\t\tlet firstX = polygon[0], firstY = polygon[1];\n\t\t\tlet secondX = polygon[2], secondY = polygon[3];\n\t\t\tlet winding = Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, firstX, firstY);\n\n\t\t\tfor (let ii = 0; ii < n; ii++) {\n\t\t\t\tif (ii == i) continue;\n\t\t\t\tlet otherIndices = convexPolygonsIndices[ii];\n\t\t\t\tif (otherIndices.length != 3) continue;\n\t\t\t\tlet otherFirstIndex = otherIndices[0];\n\t\t\t\tlet otherSecondIndex = otherIndices[1];\n\t\t\t\tlet otherLastIndex = otherIndices[2];\n\n\t\t\t\tlet otherPoly = convexPolygons[ii];\n\t\t\t\tlet x3 = otherPoly[otherPoly.length - 2], y3 = otherPoly[otherPoly.length - 1];\n\n\t\t\t\tif (otherFirstIndex != firstIndex || otherSecondIndex != lastIndex) continue;\n\t\t\t\tlet winding1 = Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, x3, y3);\n\t\t\t\tlet winding2 = Triangulator.winding(x3, y3, firstX, firstY, secondX, secondY);\n\t\t\t\tif (winding1 == winding && winding2 == winding) {\n\t\t\t\t\totherPoly.length = 0;\n\t\t\t\t\totherIndices.length = 0;\n\t\t\t\t\tpolygon.push(x3);\n\t\t\t\t\tpolygon.push(y3);\n\t\t\t\t\tpolygonIndices.push(otherLastIndex);\n\t\t\t\t\tprevPrevX = prevX;\n\t\t\t\t\tprevPrevY = prevY;\n\t\t\t\t\tprevX = x3;\n\t\t\t\t\tprevY = y3;\n\t\t\t\t\tii = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Remove empty polygons that resulted from the merge step above.\n\t\tfor (let i = convexPolygons.length - 1; i >= 0; i--) {\n\t\t\tpolygon = convexPolygons[i];\n\t\t\tif (polygon.length == 0) {\n\t\t\t\tconvexPolygons.splice(i, 1);\n\t\t\t\tthis.polygonPool.free(polygon);\n\t\t\t\tpolygonIndices = convexPolygonsIndices[i]\n\t\t\t\tconvexPolygonsIndices.splice(i, 1)\n\t\t\t\tthis.polygonIndicesPool.free(polygonIndices);\n\t\t\t}\n\t\t}\n\n\t\treturn convexPolygons;\n\t}\n\n\tprivate static isConcave (index: number, vertexCount: number, vertices: ArrayLike<number>, indices: ArrayLike<number>): boolean {\n\t\tlet previous = indices[(vertexCount + index - 1) % vertexCount] << 1;\n\t\tlet current = indices[index] << 1;\n\t\tlet next = indices[(index + 1) % vertexCount] << 1;\n\t\treturn !this.positiveArea(vertices[previous], vertices[previous + 1], vertices[current], vertices[current + 1], vertices[next],\n\t\t\tvertices[next + 1]);\n\t}\n\n\tprivate static positiveArea (p1x: number, p1y: number, p2x: number, p2y: number, p3x: number, p3y: number): boolean {\n\t\treturn p1x * (p3y - p2y) + p2x * (p1y - p3y) + p3x * (p2y - p1y) >= 0;\n\t}\n\n\tprivate static winding (p1x: number, p1y: number, p2x: number, p2y: number, p3x: number, p3y: number): number {\n\t\tlet px = p2x - p1x, py = p2y - p1y;\n\t\treturn p3x * py - p3y * px + px * p1y - p1x * py >= 0 ? 1 : -1;\n\t}\n}\n","import { Triangulator } from \"./Triangulator\";\nimport { ClippingAttachment } from \"./attachments/ClippingAttachment\";\nimport { Slot } from \"./Slot\";\nimport { Utils, Color, ArrayLike } from \"./Utils\";\n\n\nexport class SkeletonClipping {\n\tprivate triangulator = new Triangulator();\n\tprivate clippingPolygon = new Array<number>();\n\tprivate clipOutput = new Array<number>();\n\tclippedVertices = new Array<number>();\n\tclippedTriangles = new Array<number>();\n\tprivate scratch = new Array<number>();\n\n\tprivate clipAttachment: ClippingAttachment;\n\tprivate clippingPolygons: Array<Array<number>>;\n\n\tclipStart (slot: Slot, clip: ClippingAttachment): number {\n\t\tif (this.clipAttachment != null) return 0;\n\t\tthis.clipAttachment = clip;\n\n\t\tlet n = clip.worldVerticesLength;\n\t\tlet vertices = Utils.setArraySize(this.clippingPolygon, n);\n\t\tclip.computeWorldVertices(slot, 0, n, vertices, 0, 2);\n\t\tlet clippingPolygon = this.clippingPolygon;\n\t\tSkeletonClipping.makeClockwise(clippingPolygon);\n\t\tlet clippingPolygons = this.clippingPolygons = this.triangulator.decompose(clippingPolygon, this.triangulator.triangulate(clippingPolygon));\n\t\tfor (let i = 0, n = clippingPolygons.length; i < n; i++) {\n\t\t\tlet polygon = clippingPolygons[i];\n\t\t\tSkeletonClipping.makeClockwise(polygon);\n\t\t\tpolygon.push(polygon[0]);\n\t\t\tpolygon.push(polygon[1]);\n\t\t}\n\n\t\treturn clippingPolygons.length;\n\t}\n\n\tclipEndWithSlot (slot: Slot) {\n\t\tif (this.clipAttachment != null && this.clipAttachment.endSlot == slot.data) this.clipEnd();\n\t}\n\n\tclipEnd () {\n\t\tif (this.clipAttachment == null) return;\n\t\tthis.clipAttachment = null;\n\t\tthis.clippingPolygons = null;\n\t\tthis.clippedVertices.length = 0;\n\t\tthis.clippedTriangles.length = 0;\n\t\tthis.clippingPolygon.length = 0;\n\t}\n\n\tisClipping (): boolean {\n\t\treturn this.clipAttachment != null;\n\t}\n\n\tclipTriangles (vertices: ArrayLike<number>, verticesLength: number, triangles: ArrayLike<number>, trianglesLength: number, uvs: ArrayLike<number>,\n\t\tlight: Color, dark: Color, twoColor: boolean) {\n\n\t\tlet clipOutput = this.clipOutput, clippedVertices = this.clippedVertices;\n\t\tlet clippedTriangles = this.clippedTriangles;\n\t\tlet polygons = this.clippingPolygons;\n\t\tlet polygonsCount = this.clippingPolygons.length;\n\t\tlet vertexSize = twoColor ? 12 : 8;\n\n\t\tlet index = 0;\n\t\tclippedVertices.length = 0;\n\t\tclippedTriangles.length = 0;\n\t\touter:\n\t\tfor (let i = 0; i < trianglesLength; i += 3) {\n\t\t\tlet vertexOffset = triangles[i] << 1;\n\t\t\tlet x1 = vertices[vertexOffset], y1 = vertices[vertexOffset + 1];\n\t\t\tlet u1 = uvs[vertexOffset], v1 = uvs[vertexOffset + 1];\n\n\t\t\tvertexOffset = triangles[i + 1] << 1;\n\t\t\tlet x2 = vertices[vertexOffset], y2 = vertices[vertexOffset + 1];\n\t\t\tlet u2 = uvs[vertexOffset], v2 = uvs[vertexOffset + 1];\n\n\t\t\tvertexOffset = triangles[i + 2] << 1;\n\t\t\tlet x3 = vertices[vertexOffset], y3 = vertices[vertexOffset + 1];\n\t\t\tlet u3 = uvs[vertexOffset], v3 = uvs[vertexOffset + 1];\n\n\t\t\tfor (let p = 0; p < polygonsCount; p++) {\n\t\t\t\tlet s = clippedVertices.length;\n\t\t\t\tif (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {\n\t\t\t\t\tlet clipOutputLength = clipOutput.length;\n\t\t\t\t\tif (clipOutputLength == 0) continue;\n\t\t\t\t\tlet d0 = y2 - y3, d1 = x3 - x2, d2 = x1 - x3, d4 = y3 - y1;\n\t\t\t\t\tlet d = 1 / (d0 * d2 + d1 * (y1 - y3));\n\n\t\t\t\t\tlet clipOutputCount = clipOutputLength >> 1;\n\t\t\t\t\tlet clipOutputItems = this.clipOutput;\n\t\t\t\t\tlet clippedVerticesItems = Utils.setArraySize(clippedVertices, s + clipOutputCount * vertexSize);\n\t\t\t\t\tfor (let ii = 0; ii < clipOutputLength; ii += 2) {\n\t\t\t\t\t\tlet x = clipOutputItems[ii], y = clipOutputItems[ii + 1];\n\t\t\t\t\t\tclippedVerticesItems[s] = x;\n\t\t\t\t\t\tclippedVerticesItems[s + 1] = y;\n\t\t\t\t\t\tclippedVerticesItems[s + 2] = light.r;\n\t\t\t\t\t\tclippedVerticesItems[s + 3] = light.g;\n\t\t\t\t\t\tclippedVerticesItems[s + 4] = light.b;\n\t\t\t\t\t\tclippedVerticesItems[s + 5] = light.a;\n\t\t\t\t\t\tlet c0 = x - x3, c1 = y - y3;\n\t\t\t\t\t\tlet a = (d0 * c0 + d1 * c1) * d;\n\t\t\t\t\t\tlet b = (d4 * c0 + d2 * c1) * d;\n\t\t\t\t\t\tlet c = 1 - a - b;\n\t\t\t\t\t\tclippedVerticesItems[s + 6] = u1 * a + u2 * b + u3 * c;\n\t\t\t\t\t\tclippedVerticesItems[s + 7] = v1 * a + v2 * b + v3 * c;\n\t\t\t\t\t\tif (twoColor) {\n\t\t\t\t\t\t\tclippedVerticesItems[s + 8] = dark.r;\n\t\t\t\t\t\t\tclippedVerticesItems[s + 9] = dark.g;\n\t\t\t\t\t\t\tclippedVerticesItems[s + 10] = dark.b;\n\t\t\t\t\t\t\tclippedVerticesItems[s + 11] = dark.a;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ts += vertexSize;\n\t\t\t\t\t}\n\n\t\t\t\t\ts = clippedTriangles.length;\n\t\t\t\t\tlet clippedTrianglesItems = Utils.setArraySize(clippedTriangles, s + 3 * (clipOutputCount - 2));\n\t\t\t\t\tclipOutputCount--;\n\t\t\t\t\tfor (let ii = 1; ii < clipOutputCount; ii++) {\n\t\t\t\t\t\tclippedTrianglesItems[s] = index;\n\t\t\t\t\t\tclippedTrianglesItems[s + 1] = (index + ii);\n\t\t\t\t\t\tclippedTrianglesItems[s + 2] = (index + ii + 1);\n\t\t\t\t\t\ts += 3;\n\t\t\t\t\t}\n\t\t\t\t\tindex += clipOutputCount + 1;\n\n\t\t\t\t} else {\n\t\t\t\t\tlet clippedVerticesItems = Utils.setArraySize(clippedVertices, s + 3 * vertexSize);\n\t\t\t\t\tclippedVerticesItems[s] = x1;\n\t\t\t\t\tclippedVerticesItems[s + 1] = y1;\n\t\t\t\t\tclippedVerticesItems[s + 2] = light.r;\n\t\t\t\t\tclippedVerticesItems[s + 3] = light.g;\n\t\t\t\t\tclippedVerticesItems[s + 4] = light.b;\n\t\t\t\t\tclippedVerticesItems[s + 5] = light.a;\n\t\t\t\t\tif (!twoColor) {\n\t\t\t\t\t\tclippedVerticesItems[s + 6] = u1;\n\t\t\t\t\t\tclippedVerticesItems[s + 7] = v1;\n\n\t\t\t\t\t\tclippedVerticesItems[s + 8] = x2;\n\t\t\t\t\t\tclippedVerticesItems[s + 9] = y2;\n\t\t\t\t\t\tclippedVerticesItems[s + 10] = light.r;\n\t\t\t\t\t\tclippedVerticesItems[s + 11] = light.g;\n\t\t\t\t\t\tclippedVerticesItems[s + 12] = light.b;\n\t\t\t\t\t\tclippedVerticesItems[s + 13] = light.a;\n\t\t\t\t\t\tclippedVerticesItems[s + 14] = u2;\n\t\t\t\t\t\tclippedVerticesItems[s + 15] = v2;\n\n\t\t\t\t\t\tclippedVerticesItems[s + 16] = x3;\n\t\t\t\t\t\tclippedVerticesItems[s + 17] = y3;\n\t\t\t\t\t\tclippedVerticesItems[s + 18] = light.r;\n\t\t\t\t\t\tclippedVerticesItems[s + 19] = light.g;\n\t\t\t\t\t\tclippedVerticesItems[s + 20] = light.b;\n\t\t\t\t\t\tclippedVerticesItems[s + 21] = light.a;\n\t\t\t\t\t\tclippedVerticesItems[s + 22] = u3;\n\t\t\t\t\t\tclippedVerticesItems[s + 23] = v3;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tclippedVerticesItems[s + 6] = u1;\n\t\t\t\t\t\tclippedVerticesItems[s + 7] = v1;\n\t\t\t\t\t\tclippedVerticesItems[s + 8] = dark.r;\n\t\t\t\t\t\tclippedVerticesItems[s + 9] = dark.g;\n\t\t\t\t\t\tclippedVerticesItems[s + 10] = dark.b;\n\t\t\t\t\t\tclippedVerticesItems[s + 11] = dark.a;\n\n\t\t\t\t\t\tclippedVerticesItems[s + 12] = x2;\n\t\t\t\t\t\tclippedVerticesItems[s + 13] = y2;\n\t\t\t\t\t\tclippedVerticesItems[s + 14] = light.r;\n\t\t\t\t\t\tclippedVerticesItems[s + 15] = light.g;\n\t\t\t\t\t\tclippedVerticesItems[s + 16] = light.b;\n\t\t\t\t\t\tclippedVerticesItems[s + 17] = light.a;\n\t\t\t\t\t\tclippedVerticesItems[s + 18] = u2;\n\t\t\t\t\t\tclippedVerticesItems[s + 19] = v2;\n\t\t\t\t\t\tclippedVerticesItems[s + 20] = dark.r;\n\t\t\t\t\t\tclippedVerticesItems[s + 21] = dark.g;\n\t\t\t\t\t\tclippedVerticesItems[s + 22] = dark.b;\n\t\t\t\t\t\tclippedVerticesItems[s + 23] = dark.a;\n\n\t\t\t\t\t\tclippedVerticesItems[s + 24] = x3;\n\t\t\t\t\t\tclippedVerticesItems[s + 25] = y3;\n\t\t\t\t\t\tclippedVerticesItems[s + 26] = light.r;\n\t\t\t\t\t\tclippedVerticesItems[s + 27] = light.g;\n\t\t\t\t\t\tclippedVerticesItems[s + 28] = light.b;\n\t\t\t\t\t\tclippedVerticesItems[s + 29] = light.a;\n\t\t\t\t\t\tclippedVerticesItems[s + 30] = u3;\n\t\t\t\t\t\tclippedVerticesItems[s + 31] = v3;\n\t\t\t\t\t\tclippedVerticesItems[s + 32] = dark.r;\n\t\t\t\t\t\tclippedVerticesItems[s + 33] = dark.g;\n\t\t\t\t\t\tclippedVerticesItems[s + 34] = dark.b;\n\t\t\t\t\t\tclippedVerticesItems[s + 35] = dark.a;\n\t\t\t\t\t}\n\n\t\t\t\t\ts = clippedTriangles.length;\n\t\t\t\t\tlet clippedTrianglesItems = Utils.setArraySize(clippedTriangles, s + 3);\n\t\t\t\t\tclippedTrianglesItems[s] = index;\n\t\t\t\t\tclippedTrianglesItems[s + 1] = (index + 1);\n\t\t\t\t\tclippedTrianglesItems[s + 2] = (index + 2);\n\t\t\t\t\tindex += 3;\n\t\t\t\t\tcontinue outer;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Clips the input triangle against the convex, clockwise clipping area. If the triangle lies entirely within the clipping\n\t * area, false is returned. The clipping area must duplicate the first vertex at the end of the vertices list. */\n\tclip (x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, clippingArea: Array<number>, output: Array<number>) {\n\t\tlet originalOutput = output;\n\t\tlet clipped = false;\n\n\t\t// Avoid copy at the end.\n\t\tlet input: Array<number> = null;\n\t\tif (clippingArea.length % 4 >= 2) {\n\t\t\tinput = output;\n\t\t\toutput = this.scratch;\n\t\t} else\n\t\t\tinput = this.scratch;\n\n\t\tinput.length = 0;\n\t\tinput.push(x1);\n\t\tinput.push(y1);\n\t\tinput.push(x2);\n\t\tinput.push(y2);\n\t\tinput.push(x3);\n\t\tinput.push(y3);\n\t\tinput.push(x1);\n\t\tinput.push(y1);\n\t\toutput.length = 0;\n\n\t\tlet clippingVertices = clippingArea;\n\t\tlet clippingVerticesLast = clippingArea.length - 4;\n\t\tfor (let i = 0;; i += 2) {\n\t\t\tlet edgeX = clippingVertices[i], edgeY = clippingVertices[i + 1];\n\t\t\tlet edgeX2 = clippingVertices[i + 2], edgeY2 = clippingVertices[i + 3];\n\t\t\tlet deltaX = edgeX - edgeX2, deltaY = edgeY - edgeY2;\n\n\t\t\tlet inputVertices = input;\n\t\t\tlet inputVerticesLength = input.length - 2, outputStart = output.length;\n\t\t\tfor (let ii = 0; ii < inputVerticesLength; ii += 2) {\n\t\t\t\tlet inputX = inputVertices[ii], inputY = inputVertices[ii + 1];\n\t\t\t\tlet inputX2 = inputVertices[ii + 2], inputY2 = inputVertices[ii + 3];\n\t\t\t\tlet side2 = deltaX * (inputY2 - edgeY2) - deltaY * (inputX2 - edgeX2) > 0;\n\t\t\t\tif (deltaX * (inputY - edgeY2) - deltaY * (inputX - edgeX2) > 0) {\n\t\t\t\t\tif (side2) { // v1 inside, v2 inside\n\t\t\t\t\t\toutput.push(inputX2);\n\t\t\t\t\t\toutput.push(inputY2);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t// v1 inside, v2 outside\n\t\t\t\t\tlet c0 = inputY2 - inputY, c2 = inputX2 - inputX;\n\t\t\t\t\tlet s = c0 * (edgeX2 - edgeX) - c2 * (edgeY2 - edgeY);\n\t\t\t\t\tif (Math.abs(s) > 0.000001) {\n\t\t\t\t\t\tlet ua = (c2 * (edgeY - inputY) - c0 * (edgeX - inputX)) / s;\n\t\t\t\t\t\toutput.push(edgeX + (edgeX2 - edgeX) * ua);\n\t\t\t\t\t\toutput.push(edgeY + (edgeY2 - edgeY) * ua);\n\t\t\t\t\t} else {\n\t\t\t\t\t\toutput.push(edgeX);\n\t\t\t\t\t\toutput.push(edgeY);\n\t\t\t\t\t}\n\t\t\t\t} else if (side2) { // v1 outside, v2 inside\n\t\t\t\t\tlet c0 = inputY2 - inputY, c2 = inputX2 - inputX;\n\t\t\t\t\tlet s = c0 * (edgeX2 - edgeX) - c2 * (edgeY2 - edgeY);\n\t\t\t\t\tif (Math.abs(s) > 0.000001) {\n\t\t\t\t\t\tlet ua = (c2 * (edgeY - inputY) - c0 * (edgeX - inputX)) / s;\n\t\t\t\t\t\toutput.push(edgeX + (edgeX2 - edgeX) * ua);\n\t\t\t\t\t\toutput.push(edgeY + (edgeY2 - edgeY) * ua);\n\t\t\t\t\t} else {\n\t\t\t\t\t\toutput.push(edgeX);\n\t\t\t\t\t\toutput.push(edgeY);\n\t\t\t\t\t}\n\t\t\t\t\toutput.push(inputX2);\n\t\t\t\t\toutput.push(inputY2);\n\t\t\t\t}\n\t\t\t\tclipped = true;\n\t\t\t}\n\n\t\t\tif (outputStart == output.length) { // All edges outside.\n\t\t\t\toriginalOutput.length = 0;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\toutput.push(output[0]);\n\t\t\toutput.push(output[1]);\n\n\t\t\tif (i == clippingVerticesLast) break;\n\t\t\tlet temp = output;\n\t\t\toutput = input;\n\t\t\toutput.length = 0;\n\t\t\tinput = temp;\n\t\t}\n\n\t\tif (originalOutput != output) {\n\t\t\toriginalOutput.length = 0;\n\t\t\tfor (let i = 0, n = output.length - 2; i < n; i++)\n\t\t\t\toriginalOutput[i] = output[i];\n\t\t} else\n\t\t\toriginalOutput.length = originalOutput.length - 2;\n\n\t\treturn clipped;\n\t}\n\n\tpublic static makeClockwise (polygon: ArrayLike<number>) {\n\t\tlet vertices = polygon;\n\t\tlet verticeslength = polygon.length;\n\n\t\tlet area = vertices[verticeslength - 2] * vertices[1] - vertices[0] * vertices[verticeslength - 1], p1x = 0, p1y = 0, p2x = 0, p2y = 0;\n\t\tfor (let i = 0, n = verticeslength - 3; i < n; i += 2) {\n\t\t\tp1x = vertices[i];\n\t\t\tp1y = vertices[i + 1];\n\t\t\tp2x = vertices[i + 2];\n\t\t\tp2y = vertices[i + 3];\n\t\t\tarea += p1x * p2y - p2x * p1y;\n\t\t}\n\t\tif (area < 0) return;\n\n\t\tfor (let i = 0, lastX = verticeslength - 2, n = verticeslength >> 1; i < n; i += 2) {\n\t\t\tlet x = vertices[i], y = vertices[i + 1];\n\t\t\tlet other = lastX - i;\n\t\t\tvertices[i] = vertices[other];\n\t\t\tvertices[i + 1] = vertices[other + 1];\n\t\t\tvertices[other] = x;\n\t\t\tvertices[other + 1] = y;\n\t\t}\n\t}\n}\n","import {\n BufferMesh,\n Engine,\n Buffer,\n VertexElement,\n VertexElementFormat,\n BufferBindFlag,\n IndexFormat,\n BufferUsage,\n} from '@galacean/engine';\nimport { MeshGenerator } from './MeshGenerator';\n\nexport class SpineMesh {\n\n private _mesh: BufferMesh;\n\n private _indexBuffer: Buffer;\n private _vertexBuffer: Buffer;\n\n get mesh() {\n return this._mesh;\n }\n\n get indexBuffer() {\n return this._indexBuffer;\n }\n\n get vertexBuffer() {\n return this._vertexBuffer;\n }\n\n initialize(engine: Engine, vertexCount: number) {\n const mesh = this._mesh = new BufferMesh(engine);\n\n const vertexElements = [\n new VertexElement('POSITION', 0, VertexElementFormat.Vector3, 0),\n new VertexElement('COLOR_0', 12, VertexElementFormat.Vector4, 0),\n new VertexElement('TEXCOORD_0', 28, VertexElementFormat.Vector2, 0),\n ];\n\n const vertexStride = (MeshGenerator.VERTEX_STRIDE) * 4; // position + color + uv * Float32 byteLen\n const byteLength = vertexStride * vertexCount;\n const vertexBuffer = new Buffer(\n engine,\n BufferBindFlag.VertexBuffer,\n byteLength,\n BufferUsage.Dynamic\n );\n\n const indexBuffer = new Buffer(\n engine,\n BufferBindFlag.IndexBuffer,\n vertexCount * 2,\n BufferUsage.Dynamic\n );\n\n this._indexBuffer = indexBuffer;\n this._vertexBuffer = vertexBuffer;\n\n mesh.setVertexBufferBinding(vertexBuffer, vertexStride);\n mesh.setIndexBufferBinding(indexBuffer, IndexFormat.UInt16);\n mesh.setVertexElements(vertexElements);\n mesh.addSubMesh(0, vertexCount);\n }\n\n changeBuffer(engine: Engine, vertexCount: number) {\n const vertexStride = (MeshGenerator.VERTEX_STRIDE) * 4; // position + color + uv * Float32 byteLen\n const byteLength = vertexStride * vertexCount;\n const vertexBuffer = new Buffer(\n engine,\n BufferBindFlag.VertexBuffer,\n byteLength,\n BufferUsage.Dynamic\n );\n\n const indexBuffer = new Buffer(\n engine,\n BufferBindFlag.IndexBuffer,\n vertexCount * 2,\n BufferUsage.Dynamic\n );\n const mesh = this._mesh;\n this._indexBuffer = indexBuffer;\n this._vertexBuffer = vertexBuffer;\n mesh.setVertexBufferBinding(vertexBuffer, vertexStride);\n mesh.setIndexBufferBinding(indexBuffer, IndexFormat.UInt16);\n }\n}","import {\n Engine,\n Entity,\n MeshRenderer,\n SubMesh,\n} from '@galacean/engine';\nimport { Skeleton } from '../spine-core/Skeleton';\nimport { SkeletonData } from '../spine-core/SkeletonData';\nimport { RegionAttachment } from '../spine-core/attachments/RegionAttachment';\nimport { MeshAttachment } from '../spine-core/attachments/MeshAttachment';\nimport { ClippingAttachment } from '../spine-core/attachments/ClippingAttachment';\nimport { ArrayLike, Color } from '../spine-core/Utils';\nimport { SkeletonClipping } from '../spine-core/SkeletonClipping';\nimport { SpineMesh } from './SpineMesh';\nimport { SpineRenderSetting } from '../types';\n\ntype SubMeshItem = {\n subMesh: SubMesh;\n name: string;\n}\nexport class MeshGenerator {\n static QUAD_TRIANGLES = [0, 1, 2, 2, 3, 0];\n static VERTEX_SIZE = 8; // 2 2 4 position without z, uv, color\n static VERTEX_STRIDE = 9; // 3 2 4 position with z, uv, color\n static tempColor: Color = new Color();\n\n private _setting: SpineRenderSetting;\n private _engine: Engine;\n private _entity: Entity;\n private _clipper: SkeletonClipping = new SkeletonClipping();\n private _spineMesh: SpineMesh = new SpineMesh();\n\n private _vertexCount: number;\n private _vertices: Float32Array;\n private _verticesWithZ: Float32Array;\n private _indices: Uint16Array;\n private _needResize: boolean = false;\n private _meshRenderer: MeshRenderer;\n private _subMeshItems: SubMeshItem[] = [];\n readonly separateSlots: string[] = [];\n\n get mesh() {\n return this._spineMesh.mesh;\n }\n\n get subMeshItems() {\n return this._subMeshItems;\n }\n\n constructor(engine: Engine, entity: Entity) {\n this._engine = engine;\n this._entity = entity;\n }\n\n initialize(skeletonData: SkeletonData, setting?: SpineRenderSetting) {\n if (!skeletonData) return;\n\n const meshRenderer = this._entity.getComponent(MeshRenderer);\n if (!meshRenderer) {\n console.warn('You need add MeshRenderer component to entity first');\n return;\n }\n this._meshRenderer = meshRenderer;\n\n if (setting) {\n this._setting = setting;\n }\n\n // Prepare buffer by using all attachment data but clippingAttachment\n const { defaultSkin: { attachments } } = skeletonData;\n let vertexCount: number = 0;\n const QUAD_TRIANGLE_LENGTH = MeshGenerator.QUAD_TRIANGLES.length;\n for (let i = 0, n = attachments.length; i < n; i++) {\n const slotAttachment = attachments[i];\n for (let key in slotAttachment) {\n const attachment = slotAttachment[key];\n if (!attachment) {\n continue;\n } else if (attachment instanceof RegionAttachment) {\n vertexCount += QUAD_TRIANGLE_LENGTH;\n } else if (attachment instanceof MeshAttachment) {\n let mesh = attachment;\n vertexCount += mesh.triangles.length;\n } else continue;\n }\n }\n this._vertexCount = vertexCount;\n this._prepareBufferData(this._vertexCount);\n const { _spineMesh } = this;\n _spineMesh.initialize(this._engine, this._vertexCount);\n meshRenderer.mesh = _spineMesh.mesh;\n }\n\n buildMesh(skeleton: Skeleton) {\n const {\n useClipping = true,\n zSpacing = 0.01,\n } = this._setting || {};\n\n let verticesLength = 0;\n let indicesLength = 0;\n this._subMeshItems.length = 0;\n \n const meshRenderer = this._meshRenderer;\n const drawOrder = skeleton.drawOrder;\n const maxSlotCount = drawOrder.length;\n const { _clipper, _spineMesh } = this;\n const { mesh } = _spineMesh;\n const subMeshItems = this._subMeshItems;\n let vertices: ArrayLike<number> = this._vertices;\n let triangles: Array<number>;\n let uvs: ArrayLike<number>;\n let start = 0;\n let count = 0;\n for (let slotIndex = 0; slotIndex < maxSlotCount; slotIndex += 1) {\n const slot = drawOrder[slotIndex];\n\n if (!slot.bone.active) {\n _clipper.clipEndWithSlot(slot);\n continue;\n }\n const attachment = slot.getAttachment();\n let attachmentColor: Color = null;\n let texture = null;\n const z = zSpacing * slotIndex;\n let numFloats = 0;\n let vertexSize = _clipper.isClipping() ? 2 : MeshGenerator.VERTEX_SIZE;\n if (\n attachment instanceof RegionAttachment\n ) {\n let regionAttachment = <RegionAttachment>attachment;\n attachmentColor = regionAttachment.color;\n vertices = this._vertices;\n numFloats = vertexSize * 4;\n regionAttachment.computeWorldVertices(slot.bone, vertices, 0, vertexSize);\n triangles = MeshGenerator.QUAD_TRIANGLES;\n uvs = regionAttachment.uvs;\n texture = regionAttachment.region.renderObject.texture;\n } else if (\n attachment instanceof MeshAttachment\n ) {\n let meshAttachment = <MeshAttachment>attachment;\n attachmentColor = meshAttachment.color;\n vertices = this._vertices;\n numFloats = (meshAttachment.worldVerticesLength >> 1) * vertexSize;\n if (numFloats > vertices.length) {\n vertices = this._vertices = new Float32Array(numFloats);\n }\n meshAttachment.computeWorldVertices(slot, 0, meshAttachment.worldVerticesLength, vertices, 0, vertexSize);\n triangles = meshAttachment.triangles;\n uvs = meshAttachment.uvs;\n texture = meshAttachment.region.renderObject.texture;\n } else if (\n attachment instanceof ClippingAttachment\n ) {\n if (useClipping) {\n let clip = <ClippingAttachment>(attachment);\n _clipper.clipStart(slot, clip);\n continue;\n }\n } else if (useClipping) { // attachment might be null or BoundingBoxAttachment\n _clipper.clipEndWithSlot(slot);\n continue;\n }\n\n if (texture != null) {\n let finalVertices: ArrayLike<number>;\n let finalVerticesLength: number;\n let finalIndices: ArrayLike<number>;\n let finalIndicesLength: number;\n\n let skeleton = slot.bone.skeleton;\n let skeletonColor = skeleton.color;\n let slotColor = slot.color;\n let alpha = skeletonColor.a * slotColor.a * attachmentColor.a;\n let color = MeshGenerator.tempColor;\n color.set(skeletonColor.r * slotColor.r * attachmentColor.r,\n skeletonColor.g * slotColor.g * attachmentColor.g,\n skeletonColor.b * slotColor.b * attachmentColor.b,\n alpha);\n\n if (_clipper.isClipping()) {\n _clipper.clipTriangles(vertices, numFloats, triangles, triangles.length, uvs, color, null, false);\n let clippedVertices = _clipper.clippedVertices;\n let clippedTriangles = _clipper.clippedTriangles;\n finalVertices = clippedVertices;\n finalVerticesLength = clippedVertices.length;\n finalIndices = clippedTriangles;\n finalIndicesLength = clippedTriangles.length;\n } else {\n let verts = vertices;\n for (let v = 2, u = 0, n = numFloats; v < n; v += vertexSize, u += 2) {\n verts[v] = color.r;\n verts[v + 1] = color.g;\n verts[v + 2] = color.b;\n verts[v + 3] = color.a;\n verts[v + 4] = uvs[u];\n verts[v + 5] = uvs[u + 1];\n }\n finalVertices = vertices;\n finalVerticesLength = numFloats;\n finalIndices = triangles;\n finalIndicesLength = triangles.length;\n }\n\n let indexStart = verticesLength / MeshGenerator.VERTEX_STRIDE;\n let verticesWithZ = this._verticesWithZ;\n let i = verticesLength;\n let j = 0;\n for (; j < finalVerticesLength;) {\n verticesWithZ[i++] = finalVertices[j++];\n verticesWithZ[i++] = finalVertices[j++];\n verticesWithZ[i++] = z;\n verticesWithZ[i++] = finalVertices[j++];\n verticesWithZ[i++] = finalVertices[j++];\n verticesWithZ[i++] = finalVertices[j++];\n verticesWithZ[i++] = finalVertices[j++];\n verticesWithZ[i++] = finalVertices[j++];\n verticesWithZ[i++] = finalVertices[j++];\n }\n verticesLength = i;\n\n let indicesArray = this._indices;\n for (i = indicesLength, j = 0; j < finalIndicesLength; i++, j++) {\n indicesArray[i] = finalIndices[j] + indexStart;\n }\n\n // add submesh\n const slotName = slot.data.name;\n const needSeparate = this.separateSlots.includes(slotName);\n\n if (needSeparate) {\n const subMesh = new SubMesh(indicesLength, finalIndicesLength);\n subMeshItems.push({\n name: slotName,\n subMesh,\n });\n if (count > 0) {\n const prevSubMesh = new SubMesh(start, count);\n subMeshItems.push({\n name: 'default',\n subMesh: prevSubMesh,\n });\n count = 0;\n }\n start = indicesLength + finalIndicesLength;\n } else {\n count += finalIndicesLength;\n }\n \n indicesLength += finalIndicesLength;\n\n const materials = meshRenderer.getMaterials();\n const materialLength = materials.length;\n for (let i = 0; i < materialLength; i += 1) {\n const mtl = materials[i];\n if (!mtl.shaderData.getTexture('material_SpineTexture')) {\n mtl.shaderData.setTexture('material_SpineTexture', texture.texture);\n }\n }\n }\n\n _clipper.clipEndWithSlot(slot);\n\n } // slot traverse end\n\n _clipper.clipEnd();\n\n // add reset sub mesh\n if (count > 0) {\n const subMesh = new SubMesh(start, count);\n subMeshItems.push({\n name: 'default',\n subMesh,\n });\n count = 0;\n }\n\n // sort sub-mesh\n subMeshItems.sort((a, b) => a.subMesh.start - b.subMesh.start);\n\n // update buffer when vertex count change\n if (indicesLength > 0 && indicesLength !== this._vertexCount) {\n if (indicesLength > this._vertexCount) {\n this._vertexCount = indicesLength;\n this._prepareBufferData(this._vertexCount);\n this._needResize = true;\n return;\n }\n }\n\n // update sub-mesh\n mesh.clearSubMesh();\n const subMeshItemLength = subMeshItems.length;\n for (let i = 0; i < subMeshItemLength; i += 1) {\n mesh.addSubMesh(subMeshItems[i].subMesh);\n }\n\n if (this._needResize) {\n // #1\n _spineMesh.vertexBuffer.resize(this._verticesWithZ.byteLength);\n _spineMesh.indexBuffer.resize(this._indices.byteLength);\n // #2 https://github.com/galacean/engine/issues/376\n // spineMesh.changeBuffer(this.engine, this.vertexCount);\n this._needResize = false;\n }\n _spineMesh.vertexBuffer.setData(this._verticesWithZ);\n _spineMesh.indexBuffer.setData(this._indices);\n }\n\n addSeparateSlot(slotName: string) {\n this.separateSlots.push(slotName);\n }\n\n private _prepareBufferData(vertexCount: number) {\n this._vertices = new Float32Array(vertexCount * MeshGenerator.VERTEX_SIZE);\n this._verticesWithZ = new Float32Array(vertexCount * MeshGenerator.VERTEX_STRIDE);\n this._indices = new Uint16Array(vertexCount);\n }\n}","import {\n BlendFactor,\n BlendOperation,\n CullMode,\n Engine,\n Material,\n RenderQueueType,\n Shader,\n} from \"@galacean/engine\";\n\nexport class SpineMaterial extends Material {\n private static _spineVS = `\n uniform mat4 renderer_MVPMat;\n\n attribute vec3 POSITION;\n attribute vec2 TEXCOORD_0;\n attribute vec4 COLOR_0;\n \n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n gl_Position = renderer_MVPMat * vec4(POSITION, 1.0);\n \n v_uv = TEXCOORD_0;\n v_color = COLOR_0;\n }\n `;\n\n private static _spineFS = `\n uniform sampler2D material_SpineTexture;\n\n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n vec4 baseColor = texture2D(material_SpineTexture, v_uv);\n gl_FragColor = baseColor * v_color;\n }\n `;\n constructor(engine: Engine) {\n const shader =\n Shader.find(\"galacean-spine-shader\") ||\n Shader.create(\n \"galacean-spine-shader\",\n SpineMaterial._spineVS,\n SpineMaterial._spineFS\n );\n super(engine, shader);\n const renderState = this.renderState;\n const target = renderState.blendState.targetBlendState;\n target.enabled = true;\n target.sourceColorBlendFactor = BlendFactor.SourceAlpha;\n target.destinationColorBlendFactor = BlendFactor.OneMinusSourceAlpha;\n target.sourceAlphaBlendFactor = BlendFactor.One;\n target.destinationAlphaBlendFactor = BlendFactor.OneMinusSourceAlpha;\n target.colorBlendOperation = target.alphaBlendOperation =\n BlendOperation.Add;\n renderState.depthState.writeEnabled = false;\n renderState.rasterState.cullMode = CullMode.Off;\n renderState.renderQueueType = RenderQueueType.Transparent;\n }\n}\n","import { Skeleton } from \"./spine-core/Skeleton\";\nimport { SkeletonData } from \"./spine-core/SkeletonData\";\nimport { AnimationState } from \"./spine-core/AnimationState\";\nimport { AnimationStateData } from \"./spine-core/AnimationStateData\";\nimport { MeshGenerator } from \"./core/MeshGenerator\";\nimport { SpineRenderSetting } from \"./types\";\nimport { Vector2 } from \"./spine-core/Utils\";\nimport {\n Script,\n Entity,\n ignoreClone,\n MeshRenderer,\n Texture2D,\n Material,\n Engine,\n} from \"@galacean/engine\";\nimport { SpineMaterial } from \"./SpineMaterial\";\n\nexport class SpineAnimation extends Script {\n /** Spine 材质 */\n private static _defaultMaterial: Material;\n static getDefaultMaterial(engine: Engine): Material {\n if (!this._defaultMaterial) {\n this._defaultMaterial = new SpineMaterial(engine);\n this._defaultMaterial.isGCIgnored = true;\n }\n return this._defaultMaterial.clone();\n }\n\n @ignoreClone\n private _skeletonData: SkeletonData;\n @ignoreClone\n private _skeleton: Skeleton;\n @ignoreClone\n private _state: AnimationState;\n @ignoreClone\n private _tempOffset: Vector2 = new Vector2();\n @ignoreClone\n private _tempSize: Vector2 = new Vector2();\n @ignoreClone\n private _tempArray: Array<number> = [0, 0];\n @ignoreClone\n protected _meshGenerator: MeshGenerator;\n @ignoreClone\n setting: SpineRenderSetting;\n\n autoUpdate: boolean = true;\n autoUpdateBounds: boolean = false;\n\n get skeletonData() {\n return this._skeletonData;\n }\n\n get skeleton() {\n return this._skeleton;\n }\n\n get state() {\n return this._state;\n }\n\n get mesh() {\n return this._meshGenerator.mesh;\n }\n\n set scale(v: number) {\n if (this._skeleton) {\n this._skeleton.scaleX = v;\n this._skeleton.scaleY = v;\n }\n }\n\n constructor(entity: Entity) {\n super(entity);\n this._meshGenerator = new MeshGenerator(this.engine, entity);\n }\n\n setSkeletonData(skeletonData: SkeletonData, setting?: SpineRenderSetting) {\n if (!skeletonData) {\n console.error('SkeletonData is undefined');\n }\n this.setting = setting;\n this._skeletonData = skeletonData;\n this._skeleton = new Skeleton(skeletonData);\n const animationData = new AnimationStateData(skeletonData);\n this._state = new AnimationState(animationData);\n this._meshGenerator.initialize(skeletonData, this.setting);\n }\n\n /**\n * Separate slot by slot name. This will add a new sub mesh, and new materials.\n */\n addSeparateSlot(slotName: string) {\n if (!this.skeleton) {\n console.error('Skeleton not found!');\n }\n const meshRenderer = this.entity.getComponent(MeshRenderer);\n if (!meshRenderer) {\n console.warn('You need add MeshRenderer component to entity first');\n }\n const slot = this.skeleton.findSlot(slotName);\n if (slot) {\n this._meshGenerator.addSeparateSlot(slotName);\n // add sprite default material for new sub mesh\n const mtl1 = SpineAnimation._defaultMaterial.clone();\n const mtl2 = SpineAnimation._defaultMaterial.clone();\n const { materialCount } = meshRenderer;\n // one split will generate two sub mesh, thus two materials required\n // if no sub mesh generated, redundant material will ignored by renderer\n meshRenderer.setMaterial(materialCount, mtl1);\n meshRenderer.setMaterial(materialCount + 1, mtl2);\n } else {\n console.warn(`Slot: ${slotName} not find.`);\n }\n }\n\n /**\n * Change texture of a separated slot by name.\n */\n hackSeparateSlotTexture(slotName: string, texture: Texture2D) {\n this._meshGenerator.buildMesh(this._skeleton);\n const { separateSlots, subMeshItems } = this._meshGenerator;\n if (separateSlots.length === 0) {\n console.warn('You need add separate slot');\n return;\n }\n if (separateSlots.includes(slotName)) {\n const meshRenderer = this.entity.getComponent(MeshRenderer);\n const subMeshIndex = subMeshItems.findIndex(item => item.name === slotName);\n const mtl = meshRenderer.getMaterial(subMeshIndex);\n mtl.shaderData.setTexture('material_SpineTexture', texture);\n } else {\n console.warn(`Slot ${slotName} is not separated. You should use addSeparateSlot to separate it`);\n }\n }\n\n onUpdate(delta: number) {\n if (this.autoUpdate) {\n this.updateState(delta);\n }\n }\n\n updateState(deltaTime: number) {\n if (!this._skeleton || !this.state) return;\n const state = this._state;\n const skeleton = this._skeleton;\n\n state.update(deltaTime);\n state.apply(skeleton);\n skeleton.updateWorldTransform();\n\n this.updateGeometry();\n }\n\n updateGeometry() {\n if (!this._skeleton) return;\n this._meshGenerator.buildMesh(this._skeleton);\n if (this.autoUpdateBounds) {\n this.updateBounds();\n }\n }\n\n updateBounds() {\n const meshRenderer = this.entity.getComponent(MeshRenderer);\n const bounds = meshRenderer.bounds;\n const offset = this._tempOffset;\n const size = this._tempSize;\n const temp = this._tempArray;\n const zSpacing = this.setting?.zSpacing || 0.01;\n const skeleton = this._skeleton;\n skeleton.getBounds(offset, size, temp);\n const drawOrder = skeleton.drawOrder;\n bounds.min.set(offset.x, offset.y, 0);\n bounds.max.set(offset.x + size.x, offset.y + size.y, drawOrder.length * zSpacing);\n }\n\n /**\n * Spine animation custom clone.\n */\n _cloneTo(target: SpineAnimation) {\n target.setSkeletonData(this.skeletonData);\n const _cloneSetting = {...this.setting};\n target.setting = _cloneSetting;\n }\n\n private _disposeCurrentSkeleton() {\n this._skeletonData = null;\n this._skeleton = null;\n this._state = null;\n }\n\n onDestroy() {\n this._disposeCurrentSkeleton();\n this._meshGenerator = null;\n this.setting = null;\n }\n\n}","export function _array_like_to_array(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n}\nexport { _array_like_to_array as _ };\n","import { _unsupported_iterable_to_array } from \"./_unsupported_iterable_to_array.js\";\n\nexport function _create_for_of_iterator_helper_loose(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n\n if (it) return (it = it.call(o)).next.bind(it);\n // Fallback for engines without symbol support\n if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n\n var i = 0;\n\n return function() {\n if (i >= o.length) return { done: true };\n\n return { done: false, value: o[i++] };\n };\n }\n\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nexport { _create_for_of_iterator_helper_loose as _ };\n","import { _array_like_to_array } from \"./_array_like_to_array.js\";\n\nexport function _unsupported_iterable_to_array(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _array_like_to_array(o, minLen);\n\n var n = Object.prototype.toString.call(o).slice(8, -1);\n\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(n);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);\n}\nexport { _unsupported_iterable_to_array as _ };\n","import { Disposable, Map } from \"./Utils\";\r\nimport { TextureAtlas } from \"./TextureAtlas\";\r\nimport { FakeTexture } from \"./Texture\";\r\nimport { AdaptiveTexture } from \"../SpineLoader\";\r\nimport { request } from \"@galacean/engine\";\r\n\r\nexport class AssetManager implements Disposable {\r\n\t// todo: enhance asset manager: load image data\r\n\tprotected pathPrefix: string;\r\n\tprotected textureLoader: (image: HTMLImageElement) => AdaptiveTexture;\r\n\tprotected assets: Map<any> = {};\r\n\tprotected errors: Map<string> = {};\r\n\tprotected toLoad = 0;\r\n\tprotected loaded = 0;\r\n\tprotected rawDataUris: Map<string> = {};\r\n\tonLoadComplete: any;\r\n\r\n\tconstructor (pathPrefix?: string, textureLoader?: (image: HTMLImageElement) => AdaptiveTexture) {\r\n\t\tthis.pathPrefix = pathPrefix || '';\r\n\t\tthis.textureLoader = textureLoader;\r\n\t}\r\n\r\n\tprivate downloadText (url: string, success: (data: any) => void, error: (error: any) => void) {\r\n\t\trequest(url, { type: 'text' }).then((res) => {\r\n\t\t\tsuccess(res);\r\n\t\t}).catch((err) => {\r\n\t\t\terror(err);\r\n\t\t});\r\n\t}\r\n\r\n\tprotected downloadBinary (url: string, success: (data: Uint8Array) => void, error: (status: number, responseText: string) => void) {\r\n\t\tlet request = new XMLHttpRequest();\r\n\t\tif (this.rawDataUris[url]) url = this.rawDataUris[url];\r\n\t\trequest.open(\"GET\", url, true);\r\n\t\trequest.responseType = \"arraybuffer\";\r\n\t\trequest.onload = () => {\r\n\t\t\tif (request.status == 200) {\r\n\t\t\t\tsuccess(new Uint8Array(request.response as ArrayBuffer));\r\n\t\t\t} else {\r\n\t\t\t\terror(request.status, request.responseText);\r\n\t\t\t}\r\n\t\t}\r\n\t\trequest.onerror = () => {\r\n\t\t\terror(request.status, request.responseText);\r\n\t\t}\r\n\t\trequest.send();\r\n\t}\r\n\r\n\tsetRawDataURI(path: string, data: string) {\r\n\t\tthis.rawDataUris[this.pathPrefix + path] = data;\r\n\t}\r\n\r\n\tloadBinary(path: string,\r\n\t\tsuccess: (path: string, binary: Uint8Array) => void = null,\r\n\t\terror: (path: string, error: string) => void = null) {\r\n\t\tpath = this.pathPrefix + path;\r\n\t\tthis.toLoad++;\r\n\r\n\t\tthis.downloadBinary(path, (data: Uint8Array): void => {\r\n\t\t\tthis.assets[path] = data;\r\n\t\t\tif (success) success(path, data);\r\n\t\t\tthis.onLoad();\r\n\t\t\tthis.loaded++;\r\n\t\t}, (state: number, responseText: string): void => {\r\n\t\t\tthis.errors[path] = `Couldn't load binary ${path}: status ${status}, ${responseText}`;\r\n\t\t\tif (error) error(path, `Couldn't load binary ${path}: status ${status}, ${responseText}`);\r\n\t\t\tthis.onLoad();\r\n\t\t\tthis.loaded++;\r\n\t\t});\r\n\t}\r\n\r\n\tloadText(path: string,\r\n\t\tsuccess: (path: string, text: string) => void = null,\r\n\t\terror: (path: string, error: string) => void = null) {\r\n\t\tpath = this.pathPrefix + path;\r\n\t\tthis.toLoad++;\r\n\r\n\t\tthis.downloadText(path, (data: string): void => {\r\n\t\t\tthis.assets[path] = data;\r\n\t\t\tif (success) success(path, data);\r\n\t\t\tthis.onLoad();\r\n\t\t\tthis.loaded++;\r\n\t\t}, (error: any): void => {\r\n\t\t\tthis.errors[path] = `Couldn't load text ${path}: ${JSON.stringify(error)}`;\r\n\t\t\tif (error) error(path, `Couldn't load text ${path}: ${JSON.stringify(error)}`);\r\n\t\t\tthis.onLoad();\r\n\t\t\tthis.loaded++;\r\n\t\t});\r\n\t}\r\n\r\n\tloadImage (path: string,\r\n\t\tsuccess: (path: string, image: HTMLImageElement) => void = null,\r\n\t\terror: (path: string, error: string) => void = null) {\r\n\t\tpath = this.pathPrefix + path;\r\n\t\tlet storagePath = path;\r\n\t\tthis.toLoad++;\r\n\t\tlet img = new Image();\r\n\t\timg.crossOrigin = \"anonymous\";\r\n\t\timg.onload = (ev) => {\r\n\t\t\tthis.assets[storagePath] = img;\r\n\t\t\tthis.onLoad();\r\n\t\t\tthis.loaded++;\r\n\t\t\tif (success) success(path, img);\r\n\t\t}\r\n\t\timg.onerror = (ev) => {\r\n\t\t\tthis.errors[path] = `Couldn't load image ${path}`;\r\n\t\t\tthis.onLoad();\r\n\t\t\tthis.loaded++;\r\n\t\t\tif (error) error(path, `Couldn't load image ${path}`);\r\n\t\t}\r\n\t\tif (this.rawDataUris[path]) path = this.rawDataUris[path];\r\n\t\timg.src = path;\r\n\t}\r\n\r\n\tloadTexture (path: string,\r\n\t\tsuccess: (path: string, texture: AdaptiveTexture) => void = null,\r\n\t\terror: (path: string, error: string) => void = null) {\r\n\t\tpath = this.pathPrefix + path;\r\n\t\tlet storagePath = path;\r\n\t\tthis.toLoad++;\r\n\t\tif (this.rawDataUris[path]) path = this.rawDataUris[path];\r\n\t\trequest(path, { type: 'image' }).then((res: any) => {\r\n\t\t\tlet texture = this.textureLoader(res);\r\n\t\t\tthis.assets[storagePath] = texture;\r\n\t\t\tthis.onLoad();\r\n\t\t\tthis.loaded++;\r\n\t\t\tif (success) success(path, texture);\r\n\t\t}).catch((err) => {\r\n\t\t\terror(path, err);\r\n\t\t});\r\n\r\n\t}\r\n\r\n\tloadTextureAtlas (path: string,\r\n\t\tsuccess: (path: string, atlas: TextureAtlas) => void = null,\r\n\t\terror: (path: string, error: string) => void = null\r\n\t) {\r\n\t\tlet parent = path.lastIndexOf(\"/\") >= 0 ? path.substring(0, path.lastIndexOf(\"/\")) : \"\";\r\n\t\tpath = this.pathPrefix + path;\r\n\t\tthis.toLoad++;\r\n\r\n\t\tthis.downloadText(path, (atlasData: string): void => {\r\n\t\t\tlet pagesLoaded: any = { count: 0 };\r\n\t\t\tlet atlasPages = new Array<string>();\r\n\t\t\ttry {\r\n\t\t\t\tlet atlas = new TextureAtlas(atlasData, (path: string) => {\r\n\t\t\t\t\tatlasPages.push(parent == \"\" ? path : parent + \"/\" + path);\r\n\t\t\t\t\tlet image = document.createElement(\"img\") as HTMLImageElement;\r\n\t\t\t\t\timage.width = 16;\r\n\t\t\t\t\timage.height = 16;\r\n\t\t\t\t\treturn new FakeTexture(image);\r\n\t\t\t\t});\r\n\t\t\t} catch (e) {\r\n\t\t\t\tlet ex = e as Error;\r\n\t\t\t\tthis.errors[path] = `Couldn't load texture atlas ${path}: ${ex.message}`;\r\n\t\t\t\tif (error) error(path, `Couldn't load texture atlas ${path}: ${ex.message}`);\r\n\t\t\t\tthis.onLoad();\r\n\t\t\t\tthis.loaded++;\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tfor (let atlasPage of atlasPages) {\r\n\t\t\t\tlet pageLoadError = false;\r\n\r\n\t\t\t\tthis.loadTexture(atlasPage, (imagePath: string, texture: AdaptiveTexture) => {\r\n\t\t\t\t\tpagesLoaded.count++;\r\n\t\t\t\t\tif (pagesLoaded.count == atlasPages.length) {\r\n\t\t\t\t\t\tif (!pageLoadError) {\r\n\t\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\t\tlet atlas = new TextureAtlas(atlasData, (path: string) => {\r\n\t\t\t\t\t\t\t\t\treturn this.get(parent == \"\" ? path : parent + \"/\" + path);\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\tthis.assets[path] = atlas;\r\n\t\t\t\t\t\t\t\tif (success) success(path, atlas);\r\n\t\t\t\t\t\t\t\tthis.onLoad();\r\n\t\t\t\t\t\t\t\tthis.loaded++;\r\n\t\t\t\t\t\t\t} catch (e) {\r\n\t\t\t\t\t\t\t\tlet ex = e as Error;\r\n\t\t\t\t\t\t\t\tthis.errors[path] = `Couldn't load texture atlas ${path}: ${ex.message}`;\r\n\t\t\t\t\t\t\t\tif (error) error(path, `Couldn't load texture atlas ${path}: ${ex.message}`);\r\n\t\t\t\t\t\t\t\tthis.onLoad();\r\n\t\t\t\t\t\t\t\tthis.loaded++;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tthis.errors[path] = `Couldn't load texture atlas page ${imagePath}} of atlas ${path}`;\r\n\t\t\t\t\t\t\tif (error) error(path, `Couldn't load texture atlas page ${imagePath} of atlas ${path}`);\r\n\t\t\t\t\t\t\tthis.onLoad();\r\n\t\t\t\t\t\t\tthis.loaded++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}, (imagePath: string, errorMessage: string) => {\r\n\t\t\t\t\tpageLoadError = true;\r\n\t\t\t\t\tpagesLoaded.count++;\r\n\r\n\t\t\t\t\tif (pagesLoaded.count == atlasPages.length) {\r\n\t\t\t\t\t\tthis.errors[path] = `Couldn't load texture atlas page ${imagePath}} of atlas ${path}`;\r\n\t\t\t\t\t\tif (error) error(path, `Couldn't load texture atlas page ${imagePath} of atlas ${path}`);\r\n\t\t\t\t\t\tthis.onLoad();\r\n\t\t\t\t\t\tthis.loaded++;\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}, (error: any): void => {\r\n\t\t\tthis.errors[path] = `Couldn't load texture atlas ${path}: ${JSON.stringify(error)}`;\r\n\t\t\tif (error) error(path, `Couldn't load texture atlas ${path}: ${JSON.stringify(error)}`);\r\n\t\t\tthis.onLoad();\r\n\t\t\tthis.loaded++;\r\n\t\t});\r\n\t}\r\n\r\n\tget (path: string) {\r\n\t\tpath = this.pathPrefix + path;\r\n\t\treturn this.assets[path];\r\n\t}\r\n\r\n\tremove (path: string) {\r\n\t\tpath = this.pathPrefix + path;\r\n\t\tlet asset = this.assets[path];\r\n\t\tif ((<any>asset).dispose) (<any>asset).dispose();\r\n\t\tthis.assets[path] = null;\r\n\t}\r\n\r\n\tremoveAll () {\r\n\t\tfor (let key in this.assets) {\r\n\t\t\tlet asset = this.assets[key];\r\n\t\t\tif ((<any>asset).dispose) (<any>asset).dispose();\r\n\t\t}\r\n\t\tthis.assets = {};\r\n\t}\r\n\r\n\tisLoadingComplete (): boolean {\r\n\t\treturn this.toLoad == 0;\r\n\t}\r\n\r\n\tonLoad() {\r\n\t\tthis.toLoad--;\r\n\t\tif (this.toLoad === 0) {\r\n\t\t\tthis.onLoadComplete();\r\n\t\t}\r\n\t}\r\n\r\n\tgetToLoad (): number {\r\n\t\treturn this.toLoad;\r\n\t}\r\n\r\n\tgetLoaded (): number {\r\n\t\treturn this.loaded;\r\n\t}\r\n\r\n\tdispose () {\r\n\t\tthis.removeAll();\r\n\t}\r\n\r\n\thasErrors() {\r\n\t\treturn Object.keys(this.errors).length > 0;\r\n\t}\r\n\r\n\tgetErrors() {\r\n\t\treturn this.errors;\r\n\t}\r\n}\r\n","\r\n\r\n\r\n\r\n\t/** Determines how images are blended with existing pixels when drawn. */\r\n\texport enum BlendMode {\r\n\t\tNormal,\r\n\t\tAdditive,\r\n\t\tMultiply,\r\n\t\tScreen\r\n\t}\r\n","\r\n\r\nimport { VertexAttachment, Attachment } from \"./Attachment\";\r\nimport { Color } from \"../Utils\";\r\n\r\n\r\n\r\n/** An attachment with vertices that make up a polygon. Can be used for hit detection, creating physics bodies, spawning particle\r\n * effects, and more.\r\n *\r\n * See {@link SkeletonBounds} and [Bounding Boxes](http://esotericsoftware.com/spine-bounding-boxes) in the Spine User\r\n * Guide. */\r\nexport class BoundingBoxAttachment extends VertexAttachment {\r\ncolor = new Color(1, 1, 1, 1);\r\n\r\nconstructor (name: string) {\r\n\tsuper(name);\r\n}\r\n\r\ncopy (): Attachment {\r\n\tlet copy = new BoundingBoxAttachment(this.name);\r\n\tthis.copyTo(copy);\r\n\tcopy.color.setFromColor(this.color);\r\n\treturn copy;\r\n}\r\n}\r\n","\n\nimport { VertexAttachment, Attachment } from \"./Attachment\";\nimport { Color, MathUtils, Vector2 } from \"../Utils\";\nimport { Bone } from \"../Bone\";\n\n\n/** An attachment which is a single point and a rotation. This can be used to spawn projectiles, particles, etc. A bone can be\n * used in similar ways, but a PointAttachment is slightly less expensive to compute and can be hidden, shown, and placed in a\n * skin.\n *\n * See [Point Attachments](http://esotericsoftware.com/spine-point-attachments) in the Spine User Guide. */\nexport class PointAttachment extends VertexAttachment {\n\tx: number; y: number; rotation: number;\n\n\t/** The color of the point attachment as it was in Spine. Available only when nonessential data was exported. Point attachments\n\t * are not usually rendered at runtime. */\n\tcolor = new Color(0.38, 0.94, 0, 1);\n\n\tconstructor (name: string) {\n\t\tsuper(name);\n\t\tthis.name = name;\n\t}\n\n\tcomputeWorldPosition (bone: Bone, point: Vector2) {\n\t\tpoint.x = this.x * bone.a + this.y * bone.b + bone.worldX;\n\t\tpoint.y = this.x * bone.c + this.y * bone.d + bone.worldY;\n\t\treturn point;\n\t}\n\n\tcomputeWorldRotation (bone: Bone) {\n\t\tlet cos = MathUtils.cosDeg(this.rotation), sin = MathUtils.sinDeg(this.rotation);\n\t\tlet x = cos * bone.a + sin * bone.b;\n\t\tlet y = cos * bone.c + sin * bone.d;\n\t\treturn Math.atan2(y, x) * MathUtils.radDeg;\n\t}\n\n\tcopy (): Attachment {\n\t\tlet copy = new PointAttachment(this.name);\n\t\tcopy.x = this.x;\n\t\tcopy.y = this.y;\n\t\tcopy.rotation = this.rotation;\n\t\tcopy.color.setFromColor(this.color);\n\t\treturn copy;\n\t}\n}\n","\n\nimport { AttachmentLoader } from \"./attachments/AttachmentLoader\";\nimport { TextureAtlas } from \"./TextureAtlas\";\nimport { Skin } from \"./Skin\";\nimport { RegionAttachment } from \"./attachments/RegionAttachment\";\nimport { MeshAttachment } from \"./attachments/MeshAttachment\";\nimport { BoundingBoxAttachment } from \"./attachments/BoundingBoxAttachment\";\nimport { PathAttachment } from \"./attachments/PathAttachment\";\nimport { PointAttachment } from \"./attachments/PointAttachment\";\nimport { ClippingAttachment } from \"./attachments/ClippingAttachment\";\n\n/** An {@link AttachmentLoader} that configures attachments using texture regions from an {@link TextureAtlas}.\n *\n * See [Loading skeleton data](http://esotericsoftware.com/spine-loading-skeleton-data#JSON-and-binary-data) in the\n * Spine Runtimes Guide. */\nexport class AtlasAttachmentLoader implements AttachmentLoader {\n\tatlas: TextureAtlas;\n\n\tconstructor (atlas: TextureAtlas) {\n\t\tthis.atlas = atlas;\n\t}\n\n\tnewRegionAttachment (skin: Skin, name: string, path: string): RegionAttachment {\n\t\tlet region = this.atlas.findRegion(path);\n\t\tif (region == null) throw new Error(\"Region not found in atlas: \" + path + \" (region attachment: \" + name + \")\");\n\t\tregion.renderObject = region;\n\t\tlet attachment = new RegionAttachment(name);\n\t\tattachment.setRegion(region);\n\t\treturn attachment;\n\t}\n\n\tnewMeshAttachment (skin: Skin, name: string, path: string) : MeshAttachment {\n\t\tlet region = this.atlas.findRegion(path);\n\t\tif (region == null) throw new Error(\"Region not found in atlas: \" + path + \" (mesh attachment: \" + name + \")\");\n\t\tregion.renderObject = region;\n\t\tlet attachment = new MeshAttachment(name);\n\t\tattachment.region = region;\n\t\treturn attachment;\n\t}\n\n\tnewBoundingBoxAttachment (skin: Skin, name: string) : BoundingBoxAttachment {\n\t\treturn new BoundingBoxAttachment(name);\n\t}\n\n\tnewPathAttachment (skin: Skin, name: string): PathAttachment {\n\t\treturn new PathAttachment(name);\n\t}\n\n\tnewPointAttachment(skin: Skin, name: string): PointAttachment {\n\t\treturn new PointAttachment(name);\n\t}\n\n\tnewClippingAttachment(skin: Skin, name: string): ClippingAttachment {\n\t\treturn new ClippingAttachment(name);\n\t}\n}\n","\r\n\r\nimport { BoneData } from \"./BoneData\";\r\nimport { SlotData } from \"./SlotData\";\r\nimport { Skin } from \"./Skin\";\r\nimport { EventData } from \"./EventData\";\r\nimport { IkConstraintData } from \"./IkConstraintData\";\r\nimport { TransformConstraintData } from \"./TransformConstraintData\";\r\nimport { PathConstraintData } from \"./PathConstraintData\";\r\nimport { Animation} from \"./Animation\";\r\n\r\n\r\n/** Stores the setup pose and all of the stateless data for a skeleton.\r\n *\r\n * See [Data objects](http://esotericsoftware.com/spine-runtime-architecture#Data-objects) in the Spine Runtimes\r\n * Guide. */\r\nexport class SkeletonData {\r\n\r\n\t/** The skeleton's name, which by default is the name of the skeleton data file, if possible. May be null. */\r\n\tname: string;\r\n\r\n\t/** The skeleton's bones, sorted parent first. The root bone is always the first bone. */\r\n\tbones = new Array<BoneData>(); // Ordered parents first.\r\n\r\n\t/** The skeleton's slots. */\r\n\tslots = new Array<SlotData>(); // Setup pose draw order.\r\n\tskins = new Array<Skin>();\r\n\r\n\t/** The skeleton's default skin. By default this skin contains all attachments that were not in a skin in Spine.\r\n\t *\r\n\t * See {@link Skeleton#getAttachmentByName()}.\r\n\t * May be null. */\r\n\tdefaultSkin: Skin;\r\n\r\n\t/** The skeleton's events. */\r\n\tevents = new Array<EventData>();\r\n\r\n\t/** The skeleton's animations. */\r\n\tanimations = new Array<Animation>();\r\n\r\n\t/** The skeleton's IK constraints. */\r\n\tikConstraints = new Array<IkConstraintData>();\r\n\r\n\t/** The skeleton's transform constraints. */\r\n\ttransformConstraints = new Array<TransformConstraintData>();\r\n\r\n\t/** The skeleton's path constraints. */\r\n\tpathConstraints = new Array<PathConstraintData>();\r\n\r\n\t/** The X coordinate of the skeleton's axis aligned bounding box in the setup pose. */\r\n\tx: number;\r\n\r\n\t/** The Y coordinate of the skeleton's axis aligned bounding box in the setup pose. */\r\n\ty: number;\r\n\r\n\t/** The width of the skeleton's axis aligned bounding box in the setup pose. */\r\n\twidth: number;\r\n\r\n\t/** The height of the skeleton's axis aligned bounding box in the setup pose. */\r\n\theight: number;\r\n\r\n\t/** The Spine version used to export the skeleton data, or null. */\r\n\tversion: string;\r\n\r\n\t/** The skeleton data hash. This value will change if any of the skeleton data has changed. May be null. */\r\n\thash: string;\r\n\r\n\t// Nonessential\r\n\t/** The dopesheet FPS in Spine. Available only when nonessential data was exported. */\r\n\tfps = 0;\r\n\r\n\t/** The path to the images directory as defined in Spine. Available only when nonessential data was exported. May be null. */\r\n\timagesPath: string;\r\n\r\n\t/** The path to the audio directory as defined in Spine. Available only when nonessential data was exported. May be null. */\r\n\taudioPath: string;\r\n\r\n\t/** Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it\r\n\t * multiple times.\r\n\t * @returns May be null. */\r\n\tfindBone (boneName: string) {\r\n\t\tif (boneName == null) throw new Error(\"boneName cannot be null.\");\r\n\t\tlet bones = this.bones;\r\n\t\tfor (let i = 0, n = bones.length; i < n; i++) {\r\n\t\t\tlet bone = bones[i];\r\n\t\t\tif (bone.name == boneName) return bone;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\tfindBoneIndex (boneName: string) {\r\n\t\tif (boneName == null) throw new Error(\"boneName cannot be null.\");\r\n\t\tlet bones = this.bones;\r\n\t\tfor (let i = 0, n = bones.length; i < n; i++)\r\n\t\t\tif (bones[i].name == boneName) return i;\r\n\t\treturn -1;\r\n\t}\r\n\r\n\t/** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it\r\n\t * multiple times.\r\n\t * @returns May be null. */\r\n\tfindSlot (slotName: string) {\r\n\t\tif (slotName == null) throw new Error(\"slotName cannot be null.\");\r\n\t\tlet slots = this.slots;\r\n\t\tfor (let i = 0, n = slots.length; i < n; i++) {\r\n\t\t\tlet slot = slots[i];\r\n\t\t\tif (slot.name == slotName) return slot;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\tfindSlotIndex (slotName: string) {\r\n\t\tif (slotName == null) throw new Error(\"slotName cannot be null.\");\r\n\t\tlet slots = this.slots;\r\n\t\tfor (let i = 0, n = slots.length; i < n; i++)\r\n\t\t\tif (slots[i].name == slotName) return i;\r\n\t\treturn -1;\r\n\t}\r\n\r\n\t/** Finds a skin by comparing each skin's name. It is more efficient to cache the results of this method than to call it\r\n\t * multiple times.\r\n\t * @returns May be null. */\r\n\tfindSkin (skinName: string) {\r\n\t\tif (skinName == null) throw new Error(\"skinName cannot be null.\");\r\n\t\tlet skins = this.skins;\r\n\t\tfor (let i = 0, n = skins.length; i < n; i++) {\r\n\t\t\tlet skin = skins[i];\r\n\t\t\tif (skin.name == skinName) return skin;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/** Finds an event by comparing each events's name. It is more efficient to cache the results of this method than to call it\r\n\t * multiple times.\r\n\t * @returns May be null. */\r\n\tfindEvent (eventDataName: string) {\r\n\t\tif (eventDataName == null) throw new Error(\"eventDataName cannot be null.\");\r\n\t\tlet events = this.events;\r\n\t\tfor (let i = 0, n = events.length; i < n; i++) {\r\n\t\t\tlet event = events[i];\r\n\t\t\tif (event.name == eventDataName) return event;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/** Finds an animation by comparing each animation's name. It is more efficient to cache the results of this method than to\r\n\t * call it multiple times.\r\n\t * @returns May be null. */\r\n\tfindAnimation (animationName: string) {\r\n\t\tif (animationName == null) throw new Error(\"animationName cannot be null.\");\r\n\t\tlet animations = this.animations;\r\n\t\tfor (let i = 0, n = animations.length; i < n; i++) {\r\n\t\t\tlet animation = animations[i];\r\n\t\t\tif (animation.name == animationName) return animation;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method\r\n\t * than to call it multiple times.\r\n\t * @return May be null. */\r\n\tfindIkConstraint (constraintName: string) {\r\n\t\tif (constraintName == null) throw new Error(\"constraintName cannot be null.\");\r\n\t\tlet ikConstraints = this.ikConstraints;\r\n\t\tfor (let i = 0, n = ikConstraints.length; i < n; i++) {\r\n\t\t\tlet constraint = ikConstraints[i];\r\n\t\t\tif (constraint.name == constraintName) return constraint;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of\r\n\t * this method than to call it multiple times.\r\n\t * @return May be null. */\r\n\tfindTransformConstraint (constraintName: string) {\r\n\t\tif (constraintName == null) throw new Error(\"constraintName cannot be null.\");\r\n\t\tlet transformConstraints = this.transformConstraints;\r\n\t\tfor (let i = 0, n = transformConstraints.length; i < n; i++) {\r\n\t\t\tlet constraint = transformConstraints[i];\r\n\t\t\tif (constraint.name == constraintName) return constraint;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method\r\n\t * than to call it multiple times.\r\n\t * @return May be null. */\r\n\tfindPathConstraint (constraintName: string) {\r\n\t\tif (constraintName == null) throw new Error(\"constraintName cannot be null.\");\r\n\t\tlet pathConstraints = this.pathConstraints;\r\n\t\tfor (let i = 0, n = pathConstraints.length; i < n; i++) {\r\n\t\t\tlet constraint = pathConstraints[i];\r\n\t\t\tif (constraint.name == constraintName) return constraint;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\tfindPathConstraintIndex (pathConstraintName: string) {\r\n\t\tif (pathConstraintName == null) throw new Error(\"pathConstraintName cannot be null.\");\r\n\t\tlet pathConstraints = this.pathConstraints;\r\n\t\tfor (let i = 0, n = pathConstraints.length; i < n; i++)\r\n\t\t\tif (pathConstraints[i].name == pathConstraintName) return i;\r\n\t\treturn -1;\r\n\t}\r\n}\r\n","\r\n\r\nimport { BoneData } from \"./BoneData\";\r\nimport { Color } from \"./Utils\";\r\nimport { BlendMode } from \"./BlendMode\";\r\n\r\n\r\n\r\n/** Stores the setup pose for a {@link Slot}. */\r\nexport class SlotData {\r\n\r\n\t/** The index of the slot in {@link Skeleton#getSlots()}. */\r\n\tindex: number;\r\n\r\n\t/** The name of the slot, which is unique across all slots in the skeleton. */\r\n\tname: string;\r\n\r\n\t/** The bone this slot belongs to. */\r\n\tboneData: BoneData;\r\n\r\n\t/** The color used to tint the slot's attachment. If {@link #getDarkColor()} is set, this is used as the light color for two\r\n\t * color tinting. */\r\n\tcolor = new Color(1, 1, 1, 1);\r\n\r\n\t/** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark\r\n\t * color's alpha is not used. */\r\n\tdarkColor: Color;\r\n\r\n\t/** The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible. */\r\n\tattachmentName: string;\r\n\r\n\t/** The blend mode for drawing the slot's attachment. */\r\n\tblendMode: BlendMode;\r\n\r\n\tconstructor (index: number, name: string, boneData: BoneData) {\r\n\t\tif (index < 0) throw new Error(\"index must be >= 0.\");\r\n\t\tif (name == null) throw new Error(\"name cannot be null.\");\r\n\t\tif (boneData == null) throw new Error(\"boneData cannot be null.\");\r\n\t\tthis.index = index;\r\n\t\tthis.name = name;\r\n\t\tthis.boneData = boneData;\r\n\t}\r\n}\r\n","\r\n\r\nimport { ConstraintData } from \"./ConstraintData\";\r\nimport { BoneData } from \"./BoneData\";\r\n\r\n\r\n\r\n/** Stores the setup pose for an {@link IkConstraint}.\r\n * <p>\r\n * See [IK constraints](http://esotericsoftware.com/spine-ik-constraints) in the Spine User Guide. */\r\nexport class IkConstraintData extends ConstraintData {\r\n\t/** The bones that are constrained by this IK constraint. */\r\n\tbones = new Array<BoneData>();\r\n\r\n\t/** The bone that is the IK target. */\r\n\ttarget: BoneData;\r\n\r\n\t/** Controls the bend direction of the IK bones, either 1 or -1. */\r\n\tbendDirection = 1;\r\n\r\n\t/** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */\r\n\tcompress = false;\r\n\r\n\t/** When true, if the target is out of range, the parent bone is scaled to reach it. If more than one bone is being constrained\r\n\t * and the parent bone has local nonuniform scale, stretch is not applied. */\r\n\tstretch = false;\r\n\r\n\t/** When true, only a single bone is being constrained, and {@link #getCompress()} or {@link #getStretch()} is used, the bone\r\n\t * is scaled on both the X and Y axes. */\r\n\tuniform = false;\r\n\r\n\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */\r\n\tmix = 1;\r\n\r\n\t/** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */\r\n\tsoftness = 0;\r\n\r\n\tconstructor (name: string) {\r\n\t\tsuper(name, 0, false);\r\n\t}\r\n}\r\n","\r\n\r\nimport { ConstraintData } from \"./ConstraintData\";\r\nimport { BoneData } from \"./BoneData\";\r\n\r\n\r\n/** Stores the setup pose for a {@link TransformConstraint}.\r\n *\r\n * See [Transform constraints](http://esotericsoftware.com/spine-transform-constraints) in the Spine User Guide. */\r\nexport class TransformConstraintData extends ConstraintData {\r\n\r\n\t/** The bones that will be modified by this transform constraint. */\r\n\tbones = new Array<BoneData>();\r\n\r\n\t/** The target bone whose world transform will be copied to the constrained bones. */\r\n\ttarget: BoneData;\r\n\r\n\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */\r\n\trotateMix = 0;\r\n\r\n\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained translations. */\r\n\ttranslateMix = 0;\r\n\r\n\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained scales. */\r\n\tscaleMix = 0;\r\n\r\n\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained shears. */\r\n\tshearMix = 0;\r\n\r\n\t/** An offset added to the constrained bone rotation. */\r\n\toffsetRotation = 0;\r\n\r\n\t/** An offset added to the constrained bone X translation. */\r\n\toffsetX = 0;\r\n\r\n\t/** An offset added to the constrained bone Y translation. */\r\n\toffsetY = 0;\r\n\r\n\t/** An offset added to the constrained bone scaleX. */\r\n\toffsetScaleX = 0;\r\n\r\n\t/** An offset added to the constrained bone scaleY. */\r\n\toffsetScaleY = 0;\r\n\r\n\t/** An offset added to the constrained bone shearY. */\r\n\toffsetShearY = 0;\r\n\r\n\trelative = false;\r\n\tlocal = false;\r\n\r\n\tconstructor (name: string) {\r\n\t\tsuper(name, 0, false);\r\n\t}\r\n}\r\n","\r\n\r\nimport { Attachment } from \"./attachments/Attachment\";\r\nimport { BoneData } from \"./BoneData\";\r\nimport { ConstraintData } from \"./ConstraintData\";\r\nimport { Skeleton } from \"./Skeleton\";\r\nimport { MeshAttachment } from \"./attachments/MeshAttachment\";\r\nimport { Map } from './Utils'\r\n\r\n/** Stores an entry in the skin consisting of the slot index, name, and attachment **/\r\nexport class SkinEntry {\r\n\tconstructor(public slotIndex: number, public name: string, public attachment: Attachment) { }\r\n}\r\n\r\n/** Stores attachments by slot index and attachment name.\r\n *\r\n * See SkeletonData {@link SkeletonData#defaultSkin}, Skeleton {@link Skeleton#skin}, and\r\n * [Runtime skins](http://esotericsoftware.com/spine-runtime-skins) in the Spine Runtimes Guide. */\r\nexport class Skin {\r\n\t/** The skin's name, which is unique across all skins in the skeleton. */\r\n\tname: string;\r\n\r\n\tattachments = new Array<Map<Attachment>>();\r\n\tbones = Array<BoneData>();\r\n\tconstraints = new Array<ConstraintData>();\r\n\r\n\tconstructor (name: string) {\r\n\t\tif (name == null) throw new Error(\"name cannot be null.\");\r\n\t\tthis.name = name;\r\n\t}\r\n\r\n\t/** Adds an attachment to the skin for the specified slot index and name. */\r\n\tsetAttachment (slotIndex: number, name: string, attachment: Attachment) {\r\n\t\tif (attachment == null) throw new Error(\"attachment cannot be null.\");\r\n\t\tlet attachments = this.attachments;\r\n\t\tif (slotIndex >= attachments.length) attachments.length = slotIndex + 1;\r\n\t\tif (!attachments[slotIndex]) attachments[slotIndex] = { };\r\n\t\tattachments[slotIndex][name] = attachment;\r\n\t}\r\n\r\n\t/** Adds all attachments, bones, and constraints from the specified skin to this skin. */\r\n\taddSkin (skin: Skin) {\r\n\t\tfor(let i = 0; i < skin.bones.length; i++) {\r\n\t\t\tlet bone = skin.bones[i];\r\n\t\t\tlet contained = false;\r\n\t\t\tfor (let j = 0; j < this.bones.length; j++) {\r\n\t\t\t\tif (this.bones[j] == bone) {\r\n\t\t\t\t\tcontained = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (!contained) this.bones.push(bone);\r\n\t\t}\r\n\r\n\t\tfor(let i = 0; i < skin.constraints.length; i++) {\r\n\t\t\tlet constraint = skin.constraints[i];\r\n\t\t\tlet contained = false;\r\n\t\t\tfor (let j = 0; j < this.constraints.length; j++) {\r\n\t\t\t\tif (this.constraints[j] == constraint) {\r\n\t\t\t\t\tcontained = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (!contained) this.constraints.push(constraint);\r\n\t\t}\r\n\r\n\t\tlet attachments = skin.getAttachments();\r\n\t\tfor (let i = 0; i < attachments.length; i++) {\r\n\t\t\tvar attachment = attachments[i];\r\n\t\t\tthis.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);\r\n\t\t}\r\n\t}\r\n\r\n\t/** Adds all bones and constraints and copies of all attachments from the specified skin to this skin. Mesh attachments are not\r\n\t * copied, instead a new linked mesh is created. The attachment copies can be modified without affecting the originals. */\r\n\tcopySkin (skin: Skin) {\r\n\t\tfor(let i = 0; i < skin.bones.length; i++) {\r\n\t\t\tlet bone = skin.bones[i];\r\n\t\t\tlet contained = false;\r\n\t\t\tfor (let j = 0; j < this.bones.length; j++) {\r\n\t\t\t\tif (this.bones[j] == bone) {\r\n\t\t\t\t\tcontained = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (!contained) this.bones.push(bone);\r\n\t\t}\r\n\r\n\t\tfor(let i = 0; i < skin.constraints.length; i++) {\r\n\t\t\tlet constraint = skin.constraints[i];\r\n\t\t\tlet contained = false;\r\n\t\t\tfor (let j = 0; j < this.constraints.length; j++) {\r\n\t\t\t\tif (this.constraints[j] == constraint) {\r\n\t\t\t\t\tcontained = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (!contained) this.constraints.push(constraint);\r\n\t\t}\r\n\r\n\t\tlet attachments = skin.getAttachments();\r\n\t\tfor (let i = 0; i < attachments.length; i++) {\r\n\t\t\tvar attachment = attachments[i];\r\n\t\t\tif (attachment.attachment == null) continue;\r\n\t\t\tif (attachment.attachment instanceof MeshAttachment) {\r\n\t\t\t\tattachment.attachment = attachment.attachment.newLinkedMesh();\r\n\t\t\t\tthis.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);\r\n\t\t\t} else {\r\n\t\t\t\tattachment.attachment = attachment.attachment.copy();\r\n\t\t\t\tthis.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/** Returns the attachment for the specified slot index and name, or null. */\r\n\tgetAttachment (slotIndex: number, name: string): Attachment {\r\n\t\tlet dictionary = this.attachments[slotIndex];\r\n\t\treturn dictionary ? dictionary[name] : null;\r\n\t}\r\n\r\n\t/** Removes the attachment in the skin for the specified slot index and name, if any. */\r\n\tremoveAttachment (slotIndex: number, name: string) {\r\n\t\tlet dictionary = this.attachments[slotIndex];\r\n\t\tif (dictionary) dictionary[name] = null;\r\n\t}\r\n\r\n\t/** Returns all attachments in this skin. */\r\n\tgetAttachments (): Array<SkinEntry> {\r\n\t\tlet entries = new Array<SkinEntry>();\r\n\t\tfor (var i = 0; i < this.attachments.length; i++) {\r\n\t\t\tlet slotAttachments = this.attachments[i];\r\n\t\t\tif (slotAttachments) {\r\n\t\t\t\tfor (let name in slotAttachments) {\r\n\t\t\t\t\tlet attachment = slotAttachments[name];\r\n\t\t\t\t\tif (attachment) entries.push(new SkinEntry(i, name, attachment));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn entries;\r\n\t}\r\n\r\n\t/** Returns all attachments in this skin for the specified slot index. */\r\n\tgetAttachmentsForSlot (slotIndex: number, attachments: Array<SkinEntry>) {\r\n\t\tlet slotAttachments = this.attachments[slotIndex];\r\n\t\tif (slotAttachments) {\r\n\t\t\tfor (let name in slotAttachments) {\r\n\t\t\t\tlet attachment = slotAttachments[name];\r\n\t\t\t\tif (attachment) attachments.push(new SkinEntry(slotIndex, name, attachment));\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/** Clears all attachments, bones, and constraints. */\r\n\tclear () {\r\n\t\tthis.attachments.length = 0;\r\n\t\tthis.bones.length = 0;\r\n\t\tthis.constraints.length = 0;\r\n\t}\r\n\r\n\t/** Attach each attachment in this skin if the corresponding attachment in the old skin is currently attached. */\r\n\tattachAll (skeleton: Skeleton, oldSkin: Skin) {\r\n\t\tlet slotIndex = 0;\r\n\t\tfor (let i = 0; i < skeleton.slots.length; i++) {\r\n\t\t\tlet slot = skeleton.slots[i];\r\n\t\t\tlet slotAttachment = slot.getAttachment();\r\n\t\t\tif (slotAttachment && slotIndex < oldSkin.attachments.length) {\r\n\t\t\t\tlet dictionary = oldSkin.attachments[slotIndex];\r\n\t\t\t\tfor (let key in dictionary) {\r\n\t\t\t\t\tlet skinAttachment:Attachment = dictionary[key];\r\n\t\t\t\t\tif (slotAttachment == skinAttachment) {\r\n\t\t\t\t\t\tlet attachment = this.getAttachment(slotIndex, key);\r\n\t\t\t\t\t\tif (attachment != null) slot.setAttachment(attachment);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tslotIndex++;\r\n\t\t}\r\n\t}\r\n}\r\n","\r\n\r\n\r\n\t/** Stores the setup pose values for an {@link Event}.\r\n\t *\r\n\t * See [Events](http://esotericsoftware.com/spine-events) in the Spine User Guide. */\r\n\texport class EventData {\r\n\t\tname: string;\r\n\t\tintValue: number;\r\n\t\tfloatValue: number;\r\n\t\tstringValue: string;\r\n\t\taudioPath: string;\r\n\t\tvolume: number;\r\n\t\tbalance: number;\r\n\r\n\t\tconstructor (name: string) {\r\n\t\t\tthis.name = name;\r\n\t\t}\r\n\t}\r\n","\r\n\r\nimport { EventData } from \"./EventData\";\r\n\r\n\r\n\r\n/** Stores the current pose values for an {@link Event}.\r\n *\r\n * See Timeline {@link Timeline#apply()},\r\n * AnimationStateListener {@link AnimationStateListener#event()}, and\r\n * [Events](http://esotericsoftware.com/spine-events) in the Spine User Guide. */\r\nexport class Event {\r\n\tdata: EventData;\r\n\tintValue: number;\r\n\tfloatValue: number;\r\n\tstringValue: string;\r\n\ttime: number;\r\n\tvolume: number;\r\n\tbalance: number;\r\n\r\n\tconstructor (time: number, data: EventData) {\r\n\t\tif (data == null) throw new Error(\"data cannot be null.\");\r\n\t\tthis.time = time;\r\n\t\tthis.data = data;\r\n\t}\r\n}\r\n","\r\n\r\n\r\nexport enum AttachmentType {\r\n\tRegion, BoundingBox, Mesh, LinkedMesh, Path, Point, Clipping\r\n}\r\n","\r\n\r\nimport { AttachmentLoader } from \"./attachments/AttachmentLoader\";\r\nimport { SkeletonData } from \"./SkeletonData\";\r\nimport { BoneData, TransformMode } from \"./BoneData\";\r\nimport { SlotData } from \"./SlotData\";\r\nimport { Color, Utils, ArrayLike } from \"./Utils\";\r\nimport { IkConstraintData } from \"./IkConstraintData\";\r\nimport { TransformConstraintData } from \"./TransformConstraintData\";\r\nimport { PathConstraintData, PositionMode, SpacingMode, RotateMode } from \"./PathConstraintData\";\r\nimport { Skin } from \"./Skin\";\r\nimport { VertexAttachment, Attachment } from \"./attachments/Attachment\";\r\nimport { MeshAttachment } from \"./attachments/MeshAttachment\";\r\nimport { EventData } from \"./EventData\";\r\nimport { Timeline, AttachmentTimeline, ColorTimeline, TwoColorTimeline, RotateTimeline, TranslateTimeline, ScaleTimeline, ShearTimeline, IkConstraintTimeline, TransformConstraintTimeline, PathConstraintPositionTimeline, PathConstraintSpacingTimeline, PathConstraintMixTimeline, DeformTimeline, DrawOrderTimeline, EventTimeline, CurveTimeline } from \"./Animation\";\r\nimport { BlendMode } from \"./BlendMode\";\r\nimport { Event } from \"./Event\";\r\nimport { Animation } from \"./Animation\";\r\n\r\n/** Loads skeleton data in the Spine JSON format.\r\n *\r\n * See [Spine JSON format](http://esotericsoftware.com/spine-json-format) and\r\n * [JSON and binary data](http://esotericsoftware.com/spine-loading-skeleton-data#JSON-and-binary-data) in the Spine\r\n * Runtimes Guide. */\r\nexport class SkeletonJson {\r\n\tattachmentLoader: AttachmentLoader;\r\n\r\n\t/** Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at\r\n\t * runtime than were used in Spine.\r\n\t *\r\n\t * See [Scaling](http://esotericsoftware.com/spine-loading-skeleton-data#Scaling) in the Spine Runtimes Guide. */\r\n\tscale = 1;\r\n\tprivate linkedMeshes = new Array<LinkedMesh>();\r\n\r\n\tconstructor (attachmentLoader: AttachmentLoader) {\r\n\t\tthis.attachmentLoader = attachmentLoader;\r\n\t}\r\n\r\n\treadSkeletonData (json: string | any): SkeletonData {\r\n\t\tlet scale = this.scale;\r\n\t\tlet skeletonData = new SkeletonData();\r\n\t\tlet root = typeof(json) === \"string\" ? JSON.parse(json) : json;\r\n\r\n\t\t// Skeleton\r\n\t\tlet skeletonMap = root.skeleton;\r\n\t\tif (skeletonMap != null) {\r\n\t\t\tskeletonData.hash = skeletonMap.hash;\r\n\t\t\tskeletonData.version = skeletonMap.spine;\r\n\t\t\tif (\"3.8.75\" == skeletonData.version)\r\n\t\t\t\tthrow new Error(\"Unsupported skeleton data, please export with a newer version of Spine.\");\r\n\t\t\tskeletonData.x = skeletonMap.x;\r\n\t\t\tskeletonData.y = skeletonMap.y;\r\n\t\t\tskeletonData.width = skeletonMap.width;\r\n\t\t\tskeletonData.height = skeletonMap.height;\r\n\t\t\tskeletonData.fps = skeletonMap.fps;\r\n\t\t\tskeletonData.imagesPath = skeletonMap.images;\r\n\t\t}\r\n\r\n\t\t// Bones\r\n\t\tif (root.bones) {\r\n\t\t\tfor (let i = 0; i < root.bones.length; i++) {\r\n\t\t\t\tlet boneMap = root.bones[i];\r\n\r\n\t\t\t\tlet parent: BoneData = null;\r\n\t\t\t\tlet parentName: string = this.getValue(boneMap, \"parent\", null);\r\n\t\t\t\tif (parentName != null) {\r\n\t\t\t\t\tparent = skeletonData.findBone(parentName);\r\n\t\t\t\t\tif (parent == null) throw new Error(\"Parent bone not found: \" + parentName);\r\n\t\t\t\t}\r\n\t\t\t\tlet data = new BoneData(skeletonData.bones.length, boneMap.name, parent);\r\n\t\t\t\tdata.length = this.getValue(boneMap, \"length\", 0) * scale;\r\n\t\t\t\tdata.x = this.getValue(boneMap, \"x\", 0) * scale;\r\n\t\t\t\tdata.y = this.getValue(boneMap, \"y\", 0) * scale;\r\n\t\t\t\tdata.rotation = this.getValue(boneMap, \"rotation\", 0);\r\n\t\t\t\tdata.scaleX = this.getValue(boneMap, \"scaleX\", 1);\r\n\t\t\t\tdata.scaleY = this.getValue(boneMap, \"scaleY\", 1);\r\n\t\t\t\tdata.shearX = this.getValue(boneMap, \"shearX\", 0);\r\n\t\t\t\tdata.shearY = this.getValue(boneMap, \"shearY\", 0);\r\n\t\t\t\tdata.transformMode = SkeletonJson.transformModeFromString(this.getValue(boneMap, \"transform\", \"normal\"));\r\n\t\t\t\tdata.skinRequired = this.getValue(boneMap, \"skin\", false);\r\n\r\n\t\t\t\tskeletonData.bones.push(data);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Slots.\r\n\t\tif (root.slots) {\r\n\t\t\tfor (let i = 0; i < root.slots.length; i++) {\r\n\t\t\t\tlet slotMap = root.slots[i];\r\n\t\t\t\tlet slotName: string = slotMap.name;\r\n\t\t\t\tlet boneName: string = slotMap.bone;\r\n\t\t\t\tlet boneData = skeletonData.findBone(boneName);\r\n\t\t\t\tif (boneData == null) throw new Error(\"Slot bone not found: \" + boneName);\r\n\t\t\t\tlet data = new SlotData(skeletonData.slots.length, slotName, boneData);\r\n\r\n\t\t\t\tlet color: string = this.getValue(slotMap, \"color\", null);\r\n\t\t\t\tif (color != null) data.color.setFromString(color);\r\n\r\n\t\t\t\tlet dark: string = this.getValue(slotMap, \"dark\", null);\r\n\t\t\t\tif (dark != null) {\r\n\t\t\t\t\tdata.darkColor = new Color(1, 1, 1, 1);\r\n\t\t\t\t\tdata.darkColor.setFromString(dark);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tdata.attachmentName = this.getValue(slotMap, \"attachment\", null);\r\n\t\t\t\tdata.blendMode = SkeletonJson.blendModeFromString(this.getValue(slotMap, \"blend\", \"normal\"));\r\n\t\t\t\tskeletonData.slots.push(data);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// IK constraints\r\n\t\tif (root.ik) {\r\n\t\t\tfor (let i = 0; i < root.ik.length; i++) {\r\n\t\t\t\tlet constraintMap = root.ik[i];\r\n\t\t\t\tlet data = new IkConstraintData(constraintMap.name);\r\n\t\t\t\tdata.order = this.getValue(constraintMap, \"order\", 0);\r\n\t\t\t\tdata.skinRequired = this.getValue(constraintMap, \"skin\", false);\r\n\r\n\t\t\t\tfor (let j = 0; j < constraintMap.bones.length; j++) {\r\n\t\t\t\t\tlet boneName = constraintMap.bones[j];\r\n\t\t\t\t\tlet bone = skeletonData.findBone(boneName);\r\n\t\t\t\t\tif (bone == null) throw new Error(\"IK bone not found: \" + boneName);\r\n\t\t\t\t\tdata.bones.push(bone);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlet targetName: string = constraintMap.target;\r\n\t\t\t\tdata.target = skeletonData.findBone(targetName);\r\n\t\t\t\tif (data.target == null) throw new Error(\"IK target bone not found: \" + targetName);\r\n\r\n\t\t\t\tdata.mix = this.getValue(constraintMap, \"mix\", 1);\r\n\t\t\t\tdata.softness = this.getValue(constraintMap, \"softness\", 0) * scale;\r\n\t\t\t\tdata.bendDirection = this.getValue(constraintMap, \"bendPositive\", true) ? 1 : -1;\r\n\t\t\t\tdata.compress = this.getValue(constraintMap, \"compress\", false);\r\n\t\t\t\tdata.stretch = this.getValue(constraintMap, \"stretch\", false);\r\n\t\t\t\tdata.uniform = this.getValue(constraintMap, \"uniform\", false);\r\n\r\n\t\t\t\tskeletonData.ikConstraints.push(data);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Transform constraints.\r\n\t\tif (root.transform) {\r\n\t\t\tfor (let i = 0; i < root.transform.length; i++) {\r\n\t\t\t\tlet constraintMap = root.transform[i];\r\n\t\t\t\tlet data = new TransformConstraintData(constraintMap.name);\r\n\t\t\t\tdata.order = this.getValue(constraintMap, \"order\", 0);\r\n\t\t\t\tdata.skinRequired = this.getValue(constraintMap, \"skin\", false);\r\n\r\n\t\t\t\tfor (let j = 0; j < constraintMap.bones.length; j++) {\r\n\t\t\t\t\tlet boneName = constraintMap.bones[j];\r\n\t\t\t\t\tlet bone = skeletonData.findBone(boneName);\r\n\t\t\t\t\tif (bone == null) throw new Error(\"Transform constraint bone not found: \" + boneName);\r\n\t\t\t\t\tdata.bones.push(bone);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlet targetName: string = constraintMap.target;\r\n\t\t\t\tdata.target = skeletonData.findBone(targetName);\r\n\t\t\t\tif (data.target == null) throw new Error(\"Transform constraint target bone not found: \" + targetName);\r\n\r\n\t\t\t\tdata.local = this.getValue(constraintMap, \"local\", false);\r\n\t\t\t\tdata.relative = this.getValue(constraintMap, \"relative\", false);\r\n\t\t\t\tdata.offsetRotation = this.getValue(constraintMap, \"rotation\", 0);\r\n\t\t\t\tdata.offsetX = this.getValue(constraintMap, \"x\", 0) * scale;\r\n\t\t\t\tdata.offsetY = this.getValue(constraintMap, \"y\", 0) * scale;\r\n\t\t\t\tdata.offsetScaleX = this.getValue(constraintMap, \"scaleX\", 0);\r\n\t\t\t\tdata.offsetScaleY = this.getValue(constraintMap, \"scaleY\", 0);\r\n\t\t\t\tdata.offsetShearY = this.getValue(constraintMap, \"shearY\", 0);\r\n\r\n\t\t\t\tdata.rotateMix = this.getValue(constraintMap, \"rotateMix\", 1);\r\n\t\t\t\tdata.translateMix = this.getValue(constraintMap, \"translateMix\", 1);\r\n\t\t\t\tdata.scaleMix = this.getValue(constraintMap, \"scaleMix\", 1);\r\n\t\t\t\tdata.shearMix = this.getValue(constraintMap, \"shearMix\", 1);\r\n\r\n\t\t\t\tskeletonData.transformConstraints.push(data);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Path constraints.\r\n\t\tif (root.path) {\r\n\t\t\tfor (let i = 0; i < root.path.length; i++) {\r\n\t\t\t\tlet constraintMap = root.path[i];\r\n\t\t\t\tlet data = new PathConstraintData(constraintMap.name);\r\n\t\t\t\tdata.order = this.getValue(constraintMap, \"order\", 0);\r\n\t\t\t\tdata.skinRequired = this.getValue(constraintMap, \"skin\", false);\r\n\r\n\t\t\t\tfor (let j = 0; j < constraintMap.bones.length; j++) {\r\n\t\t\t\t\tlet boneName = constraintMap.bones[j];\r\n\t\t\t\t\tlet bone = skeletonData.findBone(boneName);\r\n\t\t\t\t\tif (bone == null) throw new Error(\"Transform constraint bone not found: \" + boneName);\r\n\t\t\t\t\tdata.bones.push(bone);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlet targetName: string = constraintMap.target;\r\n\t\t\t\tdata.target = skeletonData.findSlot(targetName);\r\n\t\t\t\tif (data.target == null) throw new Error(\"Path target slot not found: \" + targetName);\r\n\r\n\t\t\t\tdata.positionMode = SkeletonJson.positionModeFromString(this.getValue(constraintMap, \"positionMode\", \"percent\"));\r\n\t\t\t\tdata.spacingMode = SkeletonJson.spacingModeFromString(this.getValue(constraintMap, \"spacingMode\", \"length\"));\r\n\t\t\t\tdata.rotateMode = SkeletonJson.rotateModeFromString(this.getValue(constraintMap, \"rotateMode\", \"tangent\"));\r\n\t\t\t\tdata.offsetRotation = this.getValue(constraintMap, \"rotation\", 0);\r\n\t\t\t\tdata.position = this.getValue(constraintMap, \"position\", 0);\r\n\t\t\t\tif (data.positionMode == PositionMode.Fixed) data.position *= scale;\r\n\t\t\t\tdata.spacing = this.getValue(constraintMap, \"spacing\", 0);\r\n\t\t\t\tif (data.spacingMode == SpacingMode.Length || data.spacingMode == SpacingMode.Fixed) data.spacing *= scale;\r\n\t\t\t\tdata.rotateMix = this.getValue(constraintMap, \"rotateMix\", 1);\r\n\t\t\t\tdata.translateMix = this.getValue(constraintMap, \"translateMix\", 1);\r\n\r\n\t\t\t\tskeletonData.pathConstraints.push(data);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Skins.\r\n\t\tif (root.skins) {\r\n\t\t\tfor (let i = 0; i < root.skins.length; i++) {\r\n\t\t\t\tlet skinMap = root.skins[i]\r\n\t\t\t\tlet skin = new Skin(skinMap.name);\r\n\r\n\t\t\t\tif (skinMap.bones) {\r\n\t\t\t\t\tfor (let ii = 0; ii < skinMap.bones.length; ii++) {\r\n\t\t\t\t\t\tlet bone = skeletonData.findBone(skinMap.bones[ii]);\r\n\t\t\t\t\t\tif (bone == null) throw new Error(\"Skin bone not found: \" + skinMap.bones[i]);\r\n\t\t\t\t\t\tskin.bones.push(bone);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (skinMap.ik) {\r\n\t\t\t\t\tfor (let ii = 0; ii < skinMap.ik.length; ii++) {\r\n\t\t\t\t\t\tlet constraint = skeletonData.findIkConstraint(skinMap.ik[ii]);\r\n\t\t\t\t\t\tif (constraint == null) throw new Error(\"Skin IK constraint not found: \" + skinMap.ik[i]);\r\n\t\t\t\t\t\tskin.constraints.push(constraint);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (skinMap.transform) {\r\n\t\t\t\t\tfor (let ii = 0; ii < skinMap.transform.length; ii++) {\r\n\t\t\t\t\t\tlet constraint = skeletonData.findTransformConstraint(skinMap.transform[ii]);\r\n\t\t\t\t\t\tif (constraint == null) throw new Error(\"Skin transform constraint not found: \" + skinMap.transform[i]);\r\n\t\t\t\t\t\tskin.constraints.push(constraint);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (skinMap.path) {\r\n\t\t\t\t\tfor (let ii = 0; ii < skinMap.path.length; ii++) {\r\n\t\t\t\t\t\tlet constraint = skeletonData.findPathConstraint(skinMap.path[ii]);\r\n\t\t\t\t\t\tif (constraint == null) throw new Error(\"Skin path constraint not found: \" + skinMap.path[i]);\r\n\t\t\t\t\t\tskin.constraints.push(constraint);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor (let slotName in skinMap.attachments) {\r\n\t\t\t\t\tlet slot = skeletonData.findSlot(slotName);\r\n\t\t\t\t\tif (slot == null) throw new Error(\"Slot not found: \" + slotName);\r\n\t\t\t\t\tlet slotMap = skinMap.attachments[slotName];\r\n\t\t\t\t\tfor (let entryName in slotMap) {\r\n\t\t\t\t\t\tlet attachment = this.readAttachment(slotMap[entryName], skin, slot.index, entryName, skeletonData);\r\n\t\t\t\t\t\tif (attachment != null) skin.setAttachment(slot.index, entryName, attachment);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tskeletonData.skins.push(skin);\r\n\t\t\t\tif (skin.name == \"default\") skeletonData.defaultSkin = skin;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Linked meshes.\r\n\t\tfor (let i = 0, n = this.linkedMeshes.length; i < n; i++) {\r\n\t\t\tlet linkedMesh = this.linkedMeshes[i];\r\n\t\t\tlet skin = linkedMesh.skin == null ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);\r\n\t\t\tif (skin == null) throw new Error(\"Skin not found: \" + linkedMesh.skin);\r\n\t\t\tlet parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);\r\n\t\t\tif (parent == null) throw new Error(\"Parent mesh not found: \" + linkedMesh.parent);\r\n\t\t\tlinkedMesh.mesh.deformAttachment = linkedMesh.inheritDeform ? <VertexAttachment>parent : <VertexAttachment>linkedMesh.mesh;\r\n\t\t\tlinkedMesh.mesh.setParentMesh(<MeshAttachment> parent);\r\n\t\t\tlinkedMesh.mesh.updateUVs();\r\n\t\t}\r\n\t\tthis.linkedMeshes.length = 0;\r\n\r\n\t\t// Events.\r\n\t\tif (root.events) {\r\n\t\t\tfor (let eventName in root.events) {\r\n\t\t\t\tlet eventMap = root.events[eventName];\r\n\t\t\t\tlet data = new EventData(eventName);\r\n\t\t\t\tdata.intValue = this.getValue(eventMap, \"int\", 0);\r\n\t\t\t\tdata.floatValue = this.getValue(eventMap, \"float\", 0);\r\n\t\t\t\tdata.stringValue = this.getValue(eventMap, \"string\", \"\");\r\n\t\t\t\tdata.audioPath = this.getValue(eventMap, \"audio\", null);\r\n\t\t\t\tif (data.audioPath != null) {\r\n\t\t\t\t\tdata.volume = this.getValue(eventMap, \"volume\", 1);\r\n\t\t\t\t\tdata.balance = this.getValue(eventMap, \"balance\", 0);\r\n\t\t\t\t}\r\n\t\t\t\tskeletonData.events.push(data);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Animations.\r\n\t\tif (root.animations) {\r\n\t\t\tfor (let animationName in root.animations) {\r\n\t\t\t\tlet animationMap = root.animations[animationName];\r\n\t\t\t\tthis.readAnimation(animationMap, animationName, skeletonData);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn skeletonData;\r\n\t}\r\n\r\n\treadAttachment (map: any, skin: Skin, slotIndex: number, name: string, skeletonData: SkeletonData): Attachment {\r\n\t\tlet scale = this.scale;\r\n\t\tname = this.getValue(map, \"name\", name);\r\n\r\n\t\tlet type = this.getValue(map, \"type\", \"region\");\r\n\r\n\t\tswitch (type) {\r\n\t\t\tcase \"region\": {\r\n\t\t\t\tlet path = this.getValue(map, \"path\", name);\r\n\t\t\t\tlet region = this.attachmentLoader.newRegionAttachment(skin, name, path);\r\n\t\t\t\tif (region == null) return null;\r\n\t\t\t\tregion.path = path;\r\n\t\t\t\tregion.x = this.getValue(map, \"x\", 0) * scale;\r\n\t\t\t\tregion.y = this.getValue(map, \"y\", 0) * scale;\r\n\t\t\t\tregion.scaleX = this.getValue(map, \"scaleX\", 1);\r\n\t\t\t\tregion.scaleY = this.getValue(map, \"scaleY\", 1);\r\n\t\t\t\tregion.rotation = this.getValue(map, \"rotation\", 0);\r\n\t\t\t\tregion.width = map.width * scale;\r\n\t\t\t\tregion.height = map.height * scale;\r\n\r\n\t\t\t\tlet color: string = this.getValue(map, \"color\", null);\r\n\t\t\t\tif (color != null) region.color.setFromString(color);\r\n\r\n\t\t\t\tregion.updateOffset();\r\n\t\t\t\treturn region;\r\n\t\t\t}\r\n\t\t\tcase \"boundingbox\": {\r\n\t\t\t\tlet box = this.attachmentLoader.newBoundingBoxAttachment(skin, name);\r\n\t\t\t\tif (box == null) return null;\r\n\t\t\t\tthis.readVertices(map, box, map.vertexCount << 1);\r\n\t\t\t\tlet color: string = this.getValue(map, \"color\", null);\r\n\t\t\t\tif (color != null) box.color.setFromString(color);\r\n\t\t\t\treturn box;\r\n\t\t\t}\r\n\t\t\tcase \"mesh\":\r\n\t\t\tcase \"linkedmesh\": {\r\n\t\t\t\tlet path = this.getValue(map, \"path\", name);\r\n\t\t\t\tlet mesh = this.attachmentLoader.newMeshAttachment(skin, name, path);\r\n\t\t\t\tif (mesh == null) return null;\r\n\t\t\t\tmesh.path = path;\r\n\r\n\t\t\t\tlet color = this.getValue(map, \"color\", null);\r\n\t\t\t\tif (color != null) mesh.color.setFromString(color);\r\n\r\n\t\t\t\tmesh.width = this.getValue(map, \"width\", 0) * scale;\r\n\t\t\t\tmesh.height = this.getValue(map, \"height\", 0) * scale;\r\n\r\n\t\t\t\tlet parent: string = this.getValue(map, \"parent\", null);\r\n\t\t\t\tif (parent != null) {\r\n\t\t\t\t\tthis.linkedMeshes.push(new LinkedMesh(mesh, <string> this.getValue(map, \"skin\", null), slotIndex, parent, this.getValue(map, \"deform\", true)));\r\n\t\t\t\t\treturn mesh;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlet uvs: Array<number> = map.uvs;\r\n\t\t\t\tthis.readVertices(map, mesh, uvs.length);\r\n\t\t\t\tmesh.triangles = map.triangles;\r\n\t\t\t\tmesh.regionUVs = uvs;\r\n\t\t\t\tmesh.updateUVs();\r\n\r\n\t\t\t\tmesh.edges = this.getValue(map, \"edges\", null);\r\n\t\t\t\tmesh.hullLength = this.getValue(map, \"hull\", 0) * 2;\r\n\t\t\t\treturn mesh;\r\n\t\t\t}\r\n\t\t\tcase \"path\": {\r\n\t\t\t\tlet path = this.attachmentLoader.newPathAttachment(skin, name);\r\n\t\t\t\tif (path == null) return null;\r\n\t\t\t\tpath.closed = this.getValue(map, \"closed\", false);\r\n\t\t\t\tpath.constantSpeed = this.getValue(map, \"constantSpeed\", true);\r\n\r\n\t\t\t\tlet vertexCount = map.vertexCount;\r\n\t\t\t\tthis.readVertices(map, path, vertexCount << 1);\r\n\r\n\t\t\t\tlet lengths: Array<number> = Utils.newArray(vertexCount / 3, 0);\r\n\t\t\t\tfor (let i = 0; i < map.lengths.length; i++)\r\n\t\t\t\t\tlengths[i] = map.lengths[i] * scale;\r\n\t\t\t\tpath.lengths = lengths;\r\n\r\n\t\t\t\tlet color: string = this.getValue(map, \"color\", null);\r\n\t\t\t\tif (color != null) path.color.setFromString(color);\r\n\t\t\t\treturn path;\r\n\t\t\t}\r\n\t\t\tcase \"point\": {\r\n\t\t\t\tlet point = this.attachmentLoader.newPointAttachment(skin, name);\r\n\t\t\t\tif (point == null) return null;\r\n\t\t\t\tpoint.x = this.getValue(map, \"x\", 0) * scale;\r\n\t\t\t\tpoint.y = this.getValue(map, \"y\", 0) * scale;\r\n\t\t\t\tpoint.rotation = this.getValue(map, \"rotation\", 0);\r\n\r\n\t\t\t\tlet color = this.getValue(map, \"color\", null);\r\n\t\t\t\tif (color != null) point.color.setFromString(color);\r\n\t\t\t\treturn point;\r\n\t\t\t}\r\n\t\t\tcase \"clipping\": {\r\n\t\t\t\tlet clip = this.attachmentLoader.newClippingAttachment(skin, name);\r\n\t\t\t\tif (clip == null) return null;\r\n\r\n\t\t\t\tlet end = this.getValue(map, \"end\", null);\r\n\t\t\t\tif (end != null) {\r\n\t\t\t\t\tlet slot = skeletonData.findSlot(end);\r\n\t\t\t\t\tif (slot == null) throw new Error(\"Clipping end slot not found: \" + end);\r\n\t\t\t\t\tclip.endSlot = slot;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlet vertexCount = map.vertexCount;\r\n\t\t\t\tthis.readVertices(map, clip, vertexCount << 1);\r\n\r\n\t\t\t\tlet color: string = this.getValue(map, \"color\", null);\r\n\t\t\t\tif (color != null) clip.color.setFromString(color);\r\n\t\t\t\treturn clip;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\treadVertices (map: any, attachment: VertexAttachment, verticesLength: number) {\r\n\t\tlet scale = this.scale;\r\n\t\tattachment.worldVerticesLength = verticesLength;\r\n\t\tlet vertices: Array<number> = map.vertices;\r\n\t\tif (verticesLength == vertices.length) {\r\n\t\t\tlet scaledVertices = Utils.toFloatArray(vertices);\r\n\t\t\tif (scale != 1) {\r\n\t\t\t\tfor (let i = 0, n = vertices.length; i < n; i++)\r\n\t\t\t\t\tscaledVertices[i] *= scale;\r\n\t\t\t}\r\n\t\t\tattachment.vertices = scaledVertices;\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tlet weights = new Array<number>();\r\n\t\tlet bones = new Array<number>();\r\n\t\tfor (let i = 0, n = vertices.length; i < n;) {\r\n\t\t\tlet boneCount = vertices[i++];\r\n\t\t\tbones.push(boneCount);\r\n\t\t\tfor (let nn = i + boneCount * 4; i < nn; i += 4) {\r\n\t\t\t\tbones.push(vertices[i]);\r\n\t\t\t\tweights.push(vertices[i + 1] * scale);\r\n\t\t\t\tweights.push(vertices[i + 2] * scale);\r\n\t\t\t\tweights.push(vertices[i + 3]);\r\n\t\t\t}\r\n\t\t}\r\n\t\tattachment.bones = bones;\r\n\t\tattachment.vertices = Utils.toFloatArray(weights);\r\n\t}\r\n\r\n\treadAnimation (map: any, name: string, skeletonData: SkeletonData) {\r\n\t\tlet scale = this.scale;\r\n\t\tlet timelines = new Array<Timeline>();\r\n\t\tlet duration = 0;\r\n\r\n\t\t// Slot timelines.\r\n\t\tif (map.slots) {\r\n\t\t\tfor (let slotName in map.slots) {\r\n\t\t\t\tlet slotMap = map.slots[slotName];\r\n\t\t\t\tlet slotIndex = skeletonData.findSlotIndex(slotName);\r\n\t\t\t\tif (slotIndex == -1) throw new Error(\"Slot not found: \" + slotName);\r\n\t\t\t\tfor (let timelineName in slotMap) {\r\n\t\t\t\t\tlet timelineMap = slotMap[timelineName];\r\n\t\t\t\t\tif (timelineName == \"attachment\") {\r\n\t\t\t\t\t\tlet timeline = new AttachmentTimeline(timelineMap.length);\r\n\t\t\t\t\t\ttimeline.slotIndex = slotIndex;\r\n\r\n\t\t\t\t\t\tlet frameIndex = 0;\r\n\t\t\t\t\t\tfor (let i = 0; i < timelineMap.length; i++) {\r\n\t\t\t\t\t\t\tlet valueMap = timelineMap[i];\r\n\t\t\t\t\t\t\ttimeline.setFrame(frameIndex++, this.getValue(valueMap, \"time\", 0), valueMap.name);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttimelines.push(timeline);\r\n\t\t\t\t\t\tduration = Math.max(duration, timeline.frames[timeline.getFrameCount() - 1]);\r\n\t\t\t\t\t} else if (timelineName == \"color\") {\r\n\t\t\t\t\t\tlet timeline = new ColorTimeline(timelineMap.length);\r\n\t\t\t\t\t\ttimeline.slotIndex = slotIndex;\r\n\r\n\t\t\t\t\t\tlet frameIndex = 0;\r\n\t\t\t\t\t\tfor (let i = 0; i < timelineMap.length; i++) {\r\n\t\t\t\t\t\t\tlet valueMap = timelineMap[i];\r\n\t\t\t\t\t\t\tlet color = new Color();\r\n\t\t\t\t\t\t\tcolor.setFromString(valueMap.color);\r\n\t\t\t\t\t\t\ttimeline.setFrame(frameIndex, this.getValue(valueMap, \"time\", 0), color.r, color.g, color.b, color.a);\r\n\t\t\t\t\t\t\tthis.readCurve(valueMap, timeline, frameIndex);\r\n\t\t\t\t\t\t\tframeIndex++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttimelines.push(timeline);\r\n\t\t\t\t\t\tduration = Math.max(duration, timeline.frames[(timeline.getFrameCount() - 1) * ColorTimeline.ENTRIES]);\r\n\r\n\t\t\t\t\t} else if (timelineName == \"twoColor\") {\r\n\t\t\t\t\t\tlet timeline = new TwoColorTimeline(timelineMap.length);\r\n\t\t\t\t\t\ttimeline.slotIndex = slotIndex;\r\n\r\n\t\t\t\t\t\tlet frameIndex = 0;\r\n\t\t\t\t\t\tfor (let i = 0; i < timelineMap.length; i++) {\r\n\t\t\t\t\t\t\tlet valueMap = timelineMap[i];\r\n\t\t\t\t\t\t\tlet light = new Color();\r\n\t\t\t\t\t\t\tlet dark = new Color();\r\n\t\t\t\t\t\t\tlight.setFromString(valueMap.light);\r\n\t\t\t\t\t\t\tdark.setFromString(valueMap.dark);\r\n\t\t\t\t\t\t\ttimeline.setFrame(frameIndex, this.getValue(valueMap, \"time\", 0), light.r, light.g, light.b, light.a, dark.r, dark.g, dark.b);\r\n\t\t\t\t\t\t\tthis.readCurve(valueMap, timeline, frameIndex);\r\n\t\t\t\t\t\t\tframeIndex++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttimelines.push(timeline);\r\n\t\t\t\t\t\tduration = Math.max(duration, timeline.frames[(timeline.getFrameCount() - 1) * TwoColorTimeline.ENTRIES]);\r\n\r\n\t\t\t\t\t} else\r\n\t\t\t\t\t\tthrow new Error(\"Invalid timeline type for a slot: \" + timelineName + \" (\" + slotName + \")\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Bone timelines.\r\n\t\tif (map.bones) {\r\n\t\t\tfor (let boneName in map.bones) {\r\n\t\t\t\tlet boneMap = map.bones[boneName];\r\n\t\t\t\tlet boneIndex = skeletonData.findBoneIndex(boneName);\r\n\t\t\t\tif (boneIndex == -1) throw new Error(\"Bone not found: \" + boneName);\r\n\t\t\t\tfor (let timelineName in boneMap) {\r\n\t\t\t\t\tlet timelineMap = boneMap[timelineName];\r\n\t\t\t\t\tif (timelineName === \"rotate\") {\r\n\t\t\t\t\t\tlet timeline = new RotateTimeline(timelineMap.length);\r\n\t\t\t\t\t\ttimeline.boneIndex = boneIndex;\r\n\r\n\t\t\t\t\t\tlet frameIndex = 0;\r\n\t\t\t\t\t\tfor (let i = 0; i < timelineMap.length; i++) {\r\n\t\t\t\t\t\t\tlet valueMap = timelineMap[i];\r\n\t\t\t\t\t\t\ttimeline.setFrame(frameIndex, this.getValue(valueMap, \"time\", 0), this.getValue(valueMap, \"angle\", 0));\r\n\t\t\t\t\t\t\tthis.readCurve(valueMap, timeline, frameIndex);\r\n\t\t\t\t\t\t\tframeIndex++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttimelines.push(timeline);\r\n\t\t\t\t\t\tduration = Math.max(duration, timeline.frames[(timeline.getFrameCount() - 1) * RotateTimeline.ENTRIES]);\r\n\r\n\t\t\t\t\t} else if (timelineName === \"translate\" || timelineName === \"scale\" || timelineName === \"shear\") {\r\n\t\t\t\t\t\tlet timeline: TranslateTimeline = null;\r\n\t\t\t\t\t\tlet timelineScale = 1, defaultValue = 0;\r\n\t\t\t\t\t\tif (timelineName === \"scale\") {\r\n\t\t\t\t\t\t\ttimeline = new ScaleTimeline(timelineMap.length);\r\n\t\t\t\t\t\t\tdefaultValue = 1;\r\n\t\t\t\t\t\t} else if (timelineName === \"shear\")\r\n\t\t\t\t\t\t\ttimeline = new ShearTimeline(timelineMap.length);\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\ttimeline = new TranslateTimeline(timelineMap.length);\r\n\t\t\t\t\t\t\ttimelineScale = scale;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttimeline.boneIndex = boneIndex;\r\n\r\n\t\t\t\t\t\tlet frameIndex = 0;\r\n\t\t\t\t\t\tfor (let i = 0; i < timelineMap.length; i++) {\r\n\t\t\t\t\t\t\tlet valueMap = timelineMap[i];\r\n\t\t\t\t\t\t\tlet x = this.getValue(valueMap, \"x\", defaultValue), y = this.getValue(valueMap, \"y\", defaultValue);\r\n\t\t\t\t\t\t\ttimeline.setFrame(frameIndex, this.getValue(valueMap, \"time\", 0), x * timelineScale, y * timelineScale);\r\n\t\t\t\t\t\t\tthis.readCurve(valueMap, timeline, frameIndex);\r\n\t\t\t\t\t\t\tframeIndex++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttimelines.push(timeline);\r\n\t\t\t\t\t\tduration = Math.max(duration, timeline.frames[(timeline.getFrameCount() - 1) * TranslateTimeline.ENTRIES]);\r\n\r\n\t\t\t\t\t} else\r\n\t\t\t\t\t\tthrow new Error(\"Invalid timeline type for a bone: \" + timelineName + \" (\" + boneName + \")\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// IK constraint timelines.\r\n\t\tif (map.ik) {\r\n\t\t\tfor (let constraintName in map.ik) {\r\n\t\t\t\tlet constraintMap = map.ik[constraintName];\r\n\t\t\t\tlet constraint = skeletonData.findIkConstraint(constraintName);\r\n\t\t\t\tlet timeline = new IkConstraintTimeline(constraintMap.length);\r\n\t\t\t\ttimeline.ikConstraintIndex = skeletonData.ikConstraints.indexOf(constraint);\r\n\t\t\t\tlet frameIndex = 0;\r\n\t\t\t\tfor (let i = 0; i < constraintMap.length; i++) {\r\n\t\t\t\t\tlet valueMap = constraintMap[i];\r\n\t\t\t\t\ttimeline.setFrame(frameIndex, this.getValue(valueMap, \"time\", 0), this.getValue(valueMap, \"mix\", 1), this.getValue(valueMap, \"softness\", 0) * scale,\r\n\t\t\t\t\t\tthis.getValue(valueMap, \"bendPositive\", true) ? 1 : -1, this.getValue(valueMap, \"compress\", false), this.getValue(valueMap, \"stretch\", false));\r\n\t\t\t\t\tthis.readCurve(valueMap, timeline, frameIndex);\r\n\t\t\t\t\tframeIndex++;\r\n\t\t\t\t}\r\n\t\t\t\ttimelines.push(timeline);\r\n\t\t\t\tduration = Math.max(duration, timeline.frames[(timeline.getFrameCount() - 1) * IkConstraintTimeline.ENTRIES]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Transform constraint timelines.\r\n\t\tif (map.transform) {\r\n\t\t\tfor (let constraintName in map.transform) {\r\n\t\t\t\tlet constraintMap = map.transform[constraintName];\r\n\t\t\t\tlet constraint = skeletonData.findTransformConstraint(constraintName);\r\n\t\t\t\tlet timeline = new TransformConstraintTimeline(constraintMap.length);\r\n\t\t\t\ttimeline.transformConstraintIndex = skeletonData.transformConstraints.indexOf(constraint);\r\n\t\t\t\tlet frameIndex = 0;\r\n\t\t\t\tfor (let i = 0; i < constraintMap.length; i++) {\r\n\t\t\t\t\tlet valueMap = constraintMap[i];\r\n\t\t\t\t\ttimeline.setFrame(frameIndex, this.getValue(valueMap, \"time\", 0), this.getValue(valueMap, \"rotateMix\", 1),\r\n\t\t\t\t\t\tthis.getValue(valueMap, \"translateMix\", 1), this.getValue(valueMap, \"scaleMix\", 1), this.getValue(valueMap, \"shearMix\", 1));\r\n\t\t\t\t\tthis.readCurve(valueMap, timeline, frameIndex);\r\n\t\t\t\t\tframeIndex++;\r\n\t\t\t\t}\r\n\t\t\t\ttimelines.push(timeline);\r\n\t\t\t\tduration = Math.max(duration,\r\n\t\t\t\t\ttimeline.frames[(timeline.getFrameCount() - 1) * TransformConstraintTimeline.ENTRIES]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Path constraint timelines.\r\n\t\tif (map.path) {\r\n\t\t\tfor (let constraintName in map.path) {\r\n\t\t\t\tlet constraintMap = map.path[constraintName];\r\n\t\t\t\tlet index = skeletonData.findPathConstraintIndex(constraintName);\r\n\t\t\t\tif (index == -1) throw new Error(\"Path constraint not found: \" + constraintName);\r\n\t\t\t\tlet data = skeletonData.pathConstraints[index];\r\n\t\t\t\tfor (let timelineName in constraintMap) {\r\n\t\t\t\t\tlet timelineMap = constraintMap[timelineName];\r\n\t\t\t\t\tif (timelineName === \"position\" || timelineName === \"spacing\") {\r\n\t\t\t\t\t\tlet timeline: PathConstraintPositionTimeline = null;\r\n\t\t\t\t\t\tlet timelineScale = 1;\r\n\t\t\t\t\t\tif (timelineName === \"spacing\") {\r\n\t\t\t\t\t\t\ttimeline = new PathConstraintSpacingTimeline(timelineMap.length);\r\n\t\t\t\t\t\t\tif (data.spacingMode == SpacingMode.Length || data.spacingMode == SpacingMode.Fixed) timelineScale = scale;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\ttimeline = new PathConstraintPositionTimeline(timelineMap.length);\r\n\t\t\t\t\t\t\tif (data.positionMode == PositionMode.Fixed) timelineScale = scale;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttimeline.pathConstraintIndex = index;\r\n\t\t\t\t\t\tlet frameIndex = 0;\r\n\t\t\t\t\t\tfor (let i = 0; i < timelineMap.length; i++) {\r\n\t\t\t\t\t\t\tlet valueMap = timelineMap[i];\r\n\t\t\t\t\t\t\ttimeline.setFrame(frameIndex, this.getValue(valueMap, \"time\", 0), this.getValue(valueMap, timelineName, 0) * timelineScale);\r\n\t\t\t\t\t\t\tthis.readCurve(valueMap, timeline, frameIndex);\r\n\t\t\t\t\t\t\tframeIndex++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttimelines.push(timeline);\r\n\t\t\t\t\t\tduration = Math.max(duration,\r\n\t\t\t\t\t\t\ttimeline.frames[(timeline.getFrameCount() - 1) * PathConstraintPositionTimeline.ENTRIES]);\r\n\t\t\t\t\t} else if (timelineName === \"mix\") {\r\n\t\t\t\t\t\tlet timeline = new PathConstraintMixTimeline(timelineMap.length);\r\n\t\t\t\t\t\ttimeline.pathConstraintIndex = index;\r\n\t\t\t\t\t\tlet frameIndex = 0;\r\n\t\t\t\t\t\tfor (let i = 0; i < timelineMap.length; i++) {\r\n\t\t\t\t\t\t\tlet valueMap = timelineMap[i];\r\n\t\t\t\t\t\t\ttimeline.setFrame(frameIndex, this.getValue(valueMap, \"time\", 0), this.getValue(valueMap, \"rotateMix\", 1),\r\n\t\t\t\t\t\t\t\tthis.getValue(valueMap, \"translateMix\", 1));\r\n\t\t\t\t\t\t\tthis.readCurve(valueMap, timeline, frameIndex);\r\n\t\t\t\t\t\t\tframeIndex++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttimelines.push(timeline);\r\n\t\t\t\t\t\tduration = Math.max(duration,\r\n\t\t\t\t\t\t\ttimeline.frames[(timeline.getFrameCount() - 1) * PathConstraintMixTimeline.ENTRIES]);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Deform timelines.\r\n\t\tif (map.deform) {\r\n\t\t\tfor (let deformName in map.deform) {\r\n\t\t\t\tlet deformMap = map.deform[deformName];\r\n\t\t\t\tlet skin = skeletonData.findSkin(deformName);\r\n\t\t\t\tif (skin == null) throw new Error(\"Skin not found: \" + deformName);\r\n\t\t\t\tfor (let slotName in deformMap) {\r\n\t\t\t\t\tlet slotMap = deformMap[slotName];\r\n\t\t\t\t\tlet slotIndex = skeletonData.findSlotIndex(slotName);\r\n\t\t\t\t\tif (slotIndex == -1) throw new Error(\"Slot not found: \" + slotMap.name);\r\n\t\t\t\t\tfor (let timelineName in slotMap) {\r\n\t\t\t\t\t\tlet timelineMap = slotMap[timelineName];\r\n\t\t\t\t\t\tlet attachment = <VertexAttachment>skin.getAttachment(slotIndex, timelineName);\r\n\t\t\t\t\t\tif (attachment == null) throw new Error(\"Deform attachment not found: \" + timelineMap.name);\r\n\t\t\t\t\t\tlet weighted = attachment.bones != null;\r\n\t\t\t\t\t\tlet vertices = attachment.vertices;\r\n\t\t\t\t\t\tlet deformLength = weighted ? vertices.length / 3 * 2 : vertices.length;\r\n\r\n\t\t\t\t\t\tlet timeline = new DeformTimeline(timelineMap.length);\r\n\t\t\t\t\t\ttimeline.slotIndex = slotIndex;\r\n\t\t\t\t\t\ttimeline.attachment = attachment;\r\n\r\n\t\t\t\t\t\tlet frameIndex = 0;\r\n\t\t\t\t\t\tfor (let j = 0; j < timelineMap.length; j++) {\r\n\t\t\t\t\t\t\tlet valueMap = timelineMap[j];\r\n\t\t\t\t\t\t\tlet deform: ArrayLike<number>;\r\n\t\t\t\t\t\t\tlet verticesValue: Array<Number> = this.getValue(valueMap, \"vertices\", null);\r\n\t\t\t\t\t\t\tif (verticesValue == null)\r\n\t\t\t\t\t\t\t\tdeform = weighted ? Utils.newFloatArray(deformLength) : vertices;\r\n\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\tdeform = Utils.newFloatArray(deformLength);\r\n\t\t\t\t\t\t\t\tlet start = <number>this.getValue(valueMap, \"offset\", 0);\r\n\t\t\t\t\t\t\t\tUtils.arrayCopy(verticesValue, 0, deform, start, verticesValue.length);\r\n\t\t\t\t\t\t\t\tif (scale != 1) {\r\n\t\t\t\t\t\t\t\t\tfor (let i = start, n = i + verticesValue.length; i < n; i++)\r\n\t\t\t\t\t\t\t\t\t\tdeform[i] *= scale;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tif (!weighted) {\r\n\t\t\t\t\t\t\t\t\tfor (let i = 0; i < deformLength; i++)\r\n\t\t\t\t\t\t\t\t\t\tdeform[i] += vertices[i];\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\ttimeline.setFrame(frameIndex, this.getValue(valueMap, \"time\", 0), deform);\r\n\t\t\t\t\t\t\tthis.readCurve(valueMap, timeline, frameIndex);\r\n\t\t\t\t\t\t\tframeIndex++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttimelines.push(timeline);\r\n\t\t\t\t\t\tduration = Math.max(duration, timeline.frames[timeline.getFrameCount() - 1]);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Draw order timeline.\r\n\t\tlet drawOrderNode = map.drawOrder;\r\n\t\tif (drawOrderNode == null) drawOrderNode = map.draworder;\r\n\t\tif (drawOrderNode != null) {\r\n\t\t\tlet timeline = new DrawOrderTimeline(drawOrderNode.length);\r\n\t\t\tlet slotCount = skeletonData.slots.length;\r\n\t\t\tlet frameIndex = 0;\r\n\t\t\tfor (let j = 0; j < drawOrderNode.length; j++) {\r\n\t\t\t\tlet drawOrderMap = drawOrderNode[j];\r\n\t\t\t\tlet drawOrder: Array<number> = null;\r\n\t\t\t\tlet offsets = this.getValue(drawOrderMap, \"offsets\", null);\r\n\t\t\t\tif (offsets != null) {\r\n\t\t\t\t\tdrawOrder = Utils.newArray<number>(slotCount, -1);\r\n\t\t\t\t\tlet unchanged = Utils.newArray<number>(slotCount - offsets.length, 0);\r\n\t\t\t\t\tlet originalIndex = 0, unchangedIndex = 0;\r\n\t\t\t\t\tfor (let i = 0; i < offsets.length; i++) {\r\n\t\t\t\t\t\tlet offsetMap = offsets[i];\r\n\t\t\t\t\t\tlet slotIndex = skeletonData.findSlotIndex(offsetMap.slot);\r\n\t\t\t\t\t\tif (slotIndex == -1) throw new Error(\"Slot not found: \" + offsetMap.slot);\r\n\t\t\t\t\t\t// Collect unchanged items.\r\n\t\t\t\t\t\twhile (originalIndex != slotIndex)\r\n\t\t\t\t\t\t\tunchanged[unchangedIndex++] = originalIndex++;\r\n\t\t\t\t\t\t// Set changed items.\r\n\t\t\t\t\t\tdrawOrder[originalIndex + offsetMap.offset] = originalIndex++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// Collect remaining unchanged items.\r\n\t\t\t\t\twhile (originalIndex < slotCount)\r\n\t\t\t\t\t\tunchanged[unchangedIndex++] = originalIndex++;\r\n\t\t\t\t\t// Fill in unchanged items.\r\n\t\t\t\t\tfor (let i = slotCount - 1; i >= 0; i--)\r\n\t\t\t\t\t\tif (drawOrder[i] == -1) drawOrder[i] = unchanged[--unchangedIndex];\r\n\t\t\t\t}\r\n\t\t\t\ttimeline.setFrame(frameIndex++, this.getValue(drawOrderMap, \"time\", 0), drawOrder);\r\n\t\t\t}\r\n\t\t\ttimelines.push(timeline);\r\n\t\t\tduration = Math.max(duration, timeline.frames[timeline.getFrameCount() - 1]);\r\n\t\t}\r\n\r\n\t\t// Event timeline.\r\n\t\tif (map.events) {\r\n\t\t\tlet timeline = new EventTimeline(map.events.length);\r\n\t\t\tlet frameIndex = 0;\r\n\t\t\tfor (let i = 0; i < map.events.length; i++) {\r\n\t\t\t\tlet eventMap = map.events[i];\r\n\t\t\t\tlet eventData = skeletonData.findEvent(eventMap.name);\r\n\t\t\t\tif (eventData == null) throw new Error(\"Event not found: \" + eventMap.name);\r\n\t\t\t\tlet event = new Event(Utils.toSinglePrecision(this.getValue(eventMap, \"time\", 0)), eventData);\r\n\t\t\t\tevent.intValue = this.getValue(eventMap, \"int\", eventData.intValue);\r\n\t\t\t\tevent.floatValue = this.getValue(eventMap, \"float\", eventData.floatValue);\r\n\t\t\t\tevent.stringValue = this.getValue(eventMap, \"string\", eventData.stringValue);\r\n\t\t\t\tif (event.data.audioPath != null) {\r\n\t\t\t\t\tevent.volume = this.getValue(eventMap, \"volume\", 1);\r\n\t\t\t\t\tevent.balance = this.getValue(eventMap, \"balance\", 0);\r\n\t\t\t\t}\r\n\t\t\t\ttimeline.setFrame(frameIndex++, event);\r\n\t\t\t}\r\n\t\t\ttimelines.push(timeline);\r\n\t\t\tduration = Math.max(duration, timeline.frames[timeline.getFrameCount() - 1]);\r\n\t\t}\r\n\r\n\t\tif (isNaN(duration)) {\r\n\t\t\tthrow new Error(\"Error while parsing animation, duration is NaN\");\r\n\t\t}\r\n\r\n\t\tskeletonData.animations.push(new Animation(name, timelines, duration));\r\n\t}\r\n\r\n\treadCurve (map: any, timeline: CurveTimeline, frameIndex: number) {\r\n\t\tif (!map.hasOwnProperty(\"curve\")) return;\r\n\t\tif (map.curve == \"stepped\")\r\n\t\t\ttimeline.setStepped(frameIndex);\r\n\t\telse {\r\n\t\t\tlet curve: number = map.curve;\r\n\t\t\ttimeline.setCurve(frameIndex, curve, this.getValue(map, \"c2\", 0), this.getValue(map, \"c3\", 1), this.getValue(map, \"c4\", 1));\r\n\t\t}\r\n\t}\r\n\r\n\tgetValue (map: any, prop: string, defaultValue: any) {\r\n\t\treturn map[prop] !== undefined ? map[prop] : defaultValue;\r\n\t}\r\n\r\n\tstatic blendModeFromString (str: string) {\r\n\t\tstr = str.toLowerCase();\r\n\t\tif (str == \"normal\") return BlendMode.Normal;\r\n\t\tif (str == \"additive\") return BlendMode.Additive;\r\n\t\tif (str == \"multiply\") return BlendMode.Multiply;\r\n\t\tif (str == \"screen\") return BlendMode.Screen;\r\n\t\tthrow new Error(`Unknown blend mode: ${str}`);\r\n\t}\r\n\r\n\tstatic positionModeFromString (str: string) {\r\n\t\tstr = str.toLowerCase();\r\n\t\tif (str == \"fixed\") return PositionMode.Fixed;\r\n\t\tif (str == \"percent\") return PositionMode.Percent;\r\n\t\tthrow new Error(`Unknown position mode: ${str}`);\r\n\t}\r\n\r\n\tstatic spacingModeFromString (str: string) {\r\n\t\tstr = str.toLowerCase();\r\n\t\tif (str == \"length\") return SpacingMode.Length;\r\n\t\tif (str == \"fixed\") return SpacingMode.Fixed;\r\n\t\tif (str == \"percent\") return SpacingMode.Percent;\r\n\t\tthrow new Error(`Unknown position mode: ${str}`);\r\n\t}\r\n\r\n\tstatic rotateModeFromString (str: string) {\r\n\t\tstr = str.toLowerCase();\r\n\t\tif (str == \"tangent\") return RotateMode.Tangent;\r\n\t\tif (str == \"chain\") return RotateMode.Chain;\r\n\t\tif (str == \"chainscale\") return RotateMode.ChainScale;\r\n\t\tthrow new Error(`Unknown rotate mode: ${str}`);\r\n\t}\r\n\r\n\tstatic transformModeFromString(str: string) {\r\n\t\tstr = str.toLowerCase();\r\n\t\tif (str == \"normal\") return TransformMode.Normal;\r\n\t\tif (str == \"onlytranslation\") return TransformMode.OnlyTranslation;\r\n\t\tif (str == \"norotationorreflection\") return TransformMode.NoRotationOrReflection;\r\n\t\tif (str == \"noscale\") return TransformMode.NoScale;\r\n\t\tif (str == \"noscaleorreflection\") return TransformMode.NoScaleOrReflection;\r\n\t\tthrow new Error(`Unknown transform mode: ${str}`);\r\n\t}\r\n}\r\n\r\nclass LinkedMesh {\r\n\tparent: string; skin: string;\r\n\tslotIndex: number;\r\n\tmesh: MeshAttachment;\r\n\tinheritDeform: boolean;\r\n\r\n\tconstructor (mesh: MeshAttachment, skin: string, slotIndex: number, parent: string, inheritDeform: boolean) {\r\n\t\tthis.mesh = mesh;\r\n\t\tthis.skin = skin;\r\n\t\tthis.slotIndex = slotIndex;\r\n\t\tthis.parent = parent;\r\n\t\tthis.inheritDeform = inheritDeform;\r\n\t}\r\n}\r\n","\n\nimport { TransformMode, BoneData } from \"./BoneData\";\nimport { PositionMode, SpacingMode, RotateMode, PathConstraintData } from \"./PathConstraintData\";\nimport { BlendMode } from \"./BlendMode\";\nimport { AttachmentLoader } from \"./attachments/AttachmentLoader\";\nimport { SkeletonData } from \"./SkeletonData\";\nimport { Color, Utils } from \"./Utils\";\nimport { SlotData } from \"./SlotData\";\nimport { IkConstraintData } from \"./IkConstraintData\";\nimport { TransformConstraintData } from \"./TransformConstraintData\";\nimport { VertexAttachment, Attachment } from \"./attachments/Attachment\";\nimport { MeshAttachment } from \"./attachments/MeshAttachment\";\nimport { EventData } from \"./EventData\";\nimport { Skin } from \"./Skin\";\nimport { AttachmentType } from \"./attachments/AttachmentType\";\nimport { Timeline, AttachmentTimeline, ColorTimeline, TwoColorTimeline, RotateTimeline, ScaleTimeline, ShearTimeline, TranslateTimeline, IkConstraintTimeline, TransformConstraintTimeline, PathConstraintSpacingTimeline, PathConstraintPositionTimeline, PathConstraintMixTimeline, DeformTimeline, DrawOrderTimeline, EventTimeline, CurveTimeline } from \"./Animation\";\nimport { Animation } from \"./Animation\";\nimport { Event } from \"./Event\";\n\n/** Loads skeleton data in the Spine binary format.\n *\n * See [Spine binary format](http://esotericsoftware.com/spine-binary-format) and\n * [JSON and binary data](http://esotericsoftware.com/spine-loading-skeleton-data#JSON-and-binary-data) in the Spine\n * Runtimes Guide. */\nexport class SkeletonBinary {\n\tstatic AttachmentTypeValues = [ 0 /*AttachmentType.Region*/, 1/*AttachmentType.BoundingBox*/, 2/*AttachmentType.Mesh*/, 3/*AttachmentType.LinkedMesh*/, 4/*AttachmentType.Path*/, 5/*AttachmentType.Point*/, 6/*AttachmentType.Clipping*/ ];\n\tstatic TransformModeValues = [TransformMode.Normal, TransformMode.OnlyTranslation, TransformMode.NoRotationOrReflection, TransformMode.NoScale, TransformMode.NoScaleOrReflection];\n\tstatic PositionModeValues = [ PositionMode.Fixed, PositionMode.Percent ];\n\tstatic SpacingModeValues = [ SpacingMode.Length, SpacingMode.Fixed, SpacingMode.Percent];\n\tstatic RotateModeValues = [ RotateMode.Tangent, RotateMode.Chain, RotateMode.ChainScale ];\n\tstatic BlendModeValues = [ BlendMode.Normal, BlendMode.Additive, BlendMode.Multiply, BlendMode.Screen];\n\n\tstatic BONE_ROTATE = 0;\n\tstatic BONE_TRANSLATE = 1;\n\tstatic BONE_SCALE = 2;\n\tstatic BONE_SHEAR = 3;\n\n\tstatic SLOT_ATTACHMENT = 0;\n\tstatic SLOT_COLOR = 1;\n\tstatic SLOT_TWO_COLOR = 2;\n\n\tstatic PATH_POSITION = 0;\n\tstatic PATH_SPACING = 1;\n\tstatic PATH_MIX = 2;\n\n\tstatic CURVE_LINEAR = 0;\n\tstatic CURVE_STEPPED = 1;\n\tstatic CURVE_BEZIER = 2;\n\n\t/** Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at\n\t * runtime than were used in Spine.\n\t *\n\t * See [Scaling](http://esotericsoftware.com/spine-loading-skeleton-data#Scaling) in the Spine Runtimes Guide. */\n\tscale = 1;\n\n\tattachmentLoader: AttachmentLoader;\n\tprivate linkedMeshes = new Array<LinkedMesh>();\n\n\tconstructor (attachmentLoader: AttachmentLoader) {\n\t\tthis.attachmentLoader = attachmentLoader;\n\t}\n\n\treadSkeletonData (binary: Uint8Array): SkeletonData {\n\t\tlet scale = this.scale;\n\n\t\tlet skeletonData = new SkeletonData();\n\t\tskeletonData.name = \"\"; // BOZO\n\n\t\tlet input = new BinaryInput(binary);\n\n\t\tskeletonData.hash = input.readString();\n\t\tskeletonData.version = input.readString();\n\t\tif (\"3.8.75\" == skeletonData.version)\n\t\t\t\tthrow new Error(\"Unsupported skeleton data, please export with a newer version of Spine.\");\n\t\tskeletonData.x = input.readFloat();\n\t\tskeletonData.y = input.readFloat();\n\t\tskeletonData.width = input.readFloat();\n\t\tskeletonData.height = input.readFloat();\n\n\t\tlet nonessential = input.readBoolean();\n\t\tif (nonessential) {\n\t\t\tskeletonData.fps = input.readFloat();\n\n\t\t\tskeletonData.imagesPath = input.readString();\n\t\t\tskeletonData.audioPath = input.readString();\n\t\t}\n\n\t\tlet n = 0;\n\t\t// Strings.\n\t\tn = input.readInt(true)\n\t\tfor (let i = 0; i < n; i++)\n\t\t\tinput.strings.push(input.readString());\n\n\t\t// Bones.\n\t\tn = input.readInt(true)\n\t\tfor (let i = 0; i < n; i++) {\n\t\t\tlet name = input.readString();\n\t\t\tlet parent = i == 0 ? null : skeletonData.bones[input.readInt(true)];\n\t\t\tlet data = new BoneData(i, name, parent);\n\t\t\tdata.rotation = input.readFloat();\n\t\t\tdata.x = input.readFloat() * scale;\n\t\t\tdata.y = input.readFloat() * scale;\n\t\t\tdata.scaleX = input.readFloat();\n\t\t\tdata.scaleY = input.readFloat();\n\t\t\tdata.shearX = input.readFloat();\n\t\t\tdata.shearY = input.readFloat();\n\t\t\tdata.length = input.readFloat() * scale;\n\t\t\tdata.transformMode = SkeletonBinary.TransformModeValues[input.readInt(true)];\n\t\t\tdata.skinRequired = input.readBoolean();\n\t\t\tif (nonessential) Color.rgba8888ToColor(data.color, input.readInt32());\n\t\t\tskeletonData.bones.push(data);\n\t\t}\n\n\t\t// Slots.\n\t\tn = input.readInt(true);\n\t\tfor (let i = 0; i < n; i++) {\n\t\t\tlet slotName = input.readString();\n\t\t\tlet boneData = skeletonData.bones[input.readInt(true)];\n\t\t\tlet data = new SlotData(i, slotName, boneData);\n\t\t\tColor.rgba8888ToColor(data.color, input.readInt32());\n\n\t\t\tlet darkColor = input.readInt32();\n\t\t\tif (darkColor != -1) Color.rgb888ToColor(data.darkColor = new Color(), darkColor);\n\n\t\t\tdata.attachmentName = input.readStringRef();\n\t\t\tdata.blendMode = SkeletonBinary.BlendModeValues[input.readInt(true)];\n\t\t\tskeletonData.slots.push(data);\n\t\t}\n\n\t\t// IK constraints.\n\t\tn = input.readInt(true);\n\t\tfor (let i = 0, nn; i < n; i++) {\n\t\t\tlet data = new IkConstraintData(input.readString());\n\t\t\tdata.order = input.readInt(true);\n\t\t\tdata.skinRequired = input.readBoolean();\n\t\t\tnn = input.readInt(true);\n\t\t\tfor (let ii = 0; ii < nn; ii++)\n\t\t\t\tdata.bones.push(skeletonData.bones[input.readInt(true)]);\n\t\t\tdata.target = skeletonData.bones[input.readInt(true)];\n\t\t\tdata.mix = input.readFloat();\n\t\t\tdata.softness = input.readFloat() * scale;\n\t\t\tdata.bendDirection = input.readByte();\n\t\t\tdata.compress = input.readBoolean();\n\t\t\tdata.stretch = input.readBoolean();\n\t\t\tdata.uniform = input.readBoolean();\n\t\t\tskeletonData.ikConstraints.push(data);\n\t\t}\n\n\t\t// Transform constraints.\n\t\tn = input.readInt(true);\n\t\tfor (let i = 0, nn; i < n; i++) {\n\t\t\tlet data = new TransformConstraintData(input.readString());\n\t\t\tdata.order = input.readInt(true);\n\t\t\tdata.skinRequired = input.readBoolean();\n\t\t\tnn = input.readInt(true);\n\t\t\tfor (let ii = 0; ii < nn; ii++)\n\t\t\t\tdata.bones.push(skeletonData.bones[input.readInt(true)]);\n\t\t\tdata.target = skeletonData.bones[input.readInt(true)];\n\t\t\tdata.local = input.readBoolean();\n\t\t\tdata.relative = input.readBoolean();\n\t\t\tdata.offsetRotation = input.readFloat();\n\t\t\tdata.offsetX = input.readFloat() * scale;\n\t\t\tdata.offsetY = input.readFloat() * scale;\n\t\t\tdata.offsetScaleX = input.readFloat();\n\t\t\tdata.offsetScaleY = input.readFloat();\n\t\t\tdata.offsetShearY = input.readFloat();\n\t\t\tdata.rotateMix = input.readFloat();\n\t\t\tdata.translateMix = input.readFloat();\n\t\t\tdata.scaleMix = input.readFloat();\n\t\t\tdata.shearMix = input.readFloat();\n\t\t\tskeletonData.transformConstraints.push(data);\n\t\t}\n\n\t\t// Path constraints.\n\t\tn = input.readInt(true);\n\t\tfor (let i = 0, nn; i < n; i++) {\n\t\t\tlet data = new PathConstraintData(input.readString());\n\t\t\tdata.order = input.readInt(true);\n\t\t\tdata.skinRequired = input.readBoolean();\n\t\t\tnn = input.readInt(true);\n\t\t\tfor (let ii = 0; ii < nn; ii++)\n\t\t\t\tdata.bones.push(skeletonData.bones[input.readInt(true)]);\n\t\t\tdata.target = skeletonData.slots[input.readInt(true)];\n\t\t\tdata.positionMode = SkeletonBinary.PositionModeValues[input.readInt(true)];\n\t\t\tdata.spacingMode = SkeletonBinary.SpacingModeValues[input.readInt(true)];\n\t\t\tdata.rotateMode = SkeletonBinary.RotateModeValues[input.readInt(true)];\n\t\t\tdata.offsetRotation = input.readFloat();\n\t\t\tdata.position = input.readFloat();\n\t\t\tif (data.positionMode == PositionMode.Fixed) data.position *= scale;\n\t\t\tdata.spacing = input.readFloat();\n\t\t\tif (data.spacingMode == SpacingMode.Length || data.spacingMode == SpacingMode.Fixed) data.spacing *= scale;\n\t\t\tdata.rotateMix = input.readFloat();\n\t\t\tdata.translateMix = input.readFloat();\n\t\t\tskeletonData.pathConstraints.push(data);\n\t\t}\n\n\t\t// Default skin.\n\t\tlet defaultSkin = this.readSkin(input, skeletonData, true, nonessential);\n\t\tif (defaultSkin != null) {\n\t\t\tskeletonData.defaultSkin = defaultSkin;\n\t\t\tskeletonData.skins.push(defaultSkin);\n\t\t}\n\n\t\t// Skins.\n\t\t{\n\t\t\tlet i = skeletonData.skins.length;\n\t\t\tUtils.setArraySize(skeletonData.skins, n = i + input.readInt(true));\n\t\t\tfor (; i < n; i++)\n\t\t\t\tskeletonData.skins[i] = this.readSkin(input, skeletonData, false, nonessential);\n\t\t}\n\n\t\t// Linked meshes.\n\t\tn = this.linkedMeshes.length;\n\t\tfor (let i = 0; i < n; i++) {\n\t\t\tlet linkedMesh = this.linkedMeshes[i];\n\t\t\tlet skin = linkedMesh.skin == null ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);\n\t\t\tif (skin == null) throw new Error(\"Skin not found: \" + linkedMesh.skin);\n\t\t\tlet parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);\n\t\t\tif (parent == null) throw new Error(\"Parent mesh not found: \" + linkedMesh.parent);\n\t\t\tlinkedMesh.mesh.deformAttachment = linkedMesh.inheritDeform ? parent as VertexAttachment : linkedMesh.mesh;\n\t\t\tlinkedMesh.mesh.setParentMesh(parent as MeshAttachment);\n\t\t\tlinkedMesh.mesh.updateUVs();\n\t\t}\n\t\tthis.linkedMeshes.length = 0;\n\n\t\t// Events.\n\t\tn = input.readInt(true);\n\t\tfor (let i = 0; i < n; i++) {\n\t\t\tlet data = new EventData(input.readStringRef());\n\t\t\tdata.intValue = input.readInt(false);\n\t\t\tdata.floatValue = input.readFloat();\n\t\t\tdata.stringValue = input.readString();\n\t\t\tdata.audioPath = input.readString();\n\t\t\tif (data.audioPath != null) {\n\t\t\t\tdata.volume = input.readFloat();\n\t\t\t\tdata.balance = input.readFloat();\n\t\t\t}\n\t\t\tskeletonData.events.push(data);\n\t\t}\n\n\t\t// Animations.\n\t\tn = input.readInt(true);\n\t\tfor (let i = 0; i < n; i++)\n\t\t\tskeletonData.animations.push(this.readAnimation(input, input.readString(), skeletonData));\n\t\treturn skeletonData;\n\t}\n\n\tprivate readSkin (input: BinaryInput, skeletonData: SkeletonData, defaultSkin: boolean, nonessential: boolean): Skin {\n\t\tlet skin = null;\n\t\tlet slotCount = 0;\n\n\t\tif (defaultSkin) {\n\t\t\tslotCount = input.readInt(true)\n\t\t\tif (slotCount == 0) return null;\n\t\t\tskin = new Skin(\"default\");\n\t\t} else {\n\t\t\tskin = new Skin(input.readStringRef());\n\t\t\tskin.bones.length = input.readInt(true);\n\t\t\tfor (let i = 0, n = skin.bones.length; i < n; i++)\n\t\t\t\tskin.bones[i] = skeletonData.bones[input.readInt(true)];\n\n\t\t\tfor (let i = 0, n = input.readInt(true); i < n; i++)\n\t\t\t\tskin.constraints.push(skeletonData.ikConstraints[input.readInt(true)]);\n\t\t\tfor (let i = 0, n = input.readInt(true); i < n; i++)\n\t\t\t\tskin.constraints.push(skeletonData.transformConstraints[input.readInt(true)]);\n\t\t\tfor (let i = 0, n = input.readInt(true); i < n; i++)\n\t\t\t\tskin.constraints.push(skeletonData.pathConstraints[input.readInt(true)]);\n\n\t\t\tslotCount = input.readInt(true);\n\t\t}\n\n\t\tfor (let i = 0; i < slotCount; i++) {\n\t\t\tlet slotIndex = input.readInt(true);\n\t\t\tfor (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {\n\t\t\t\tlet name = input.readStringRef();\n\t\t\t\tlet attachment = this.readAttachment(input, skeletonData, skin, slotIndex, name, nonessential);\n\t\t\t\tif (attachment != null) skin.setAttachment(slotIndex, name, attachment);\n\t\t\t}\n\t\t}\n\t\treturn skin;\n\t}\n\n\tprivate readAttachment(input: BinaryInput, skeletonData: SkeletonData, skin: Skin, slotIndex: number, attachmentName: string, nonessential: boolean): Attachment {\n\t\tlet scale = this.scale;\n\n\t\tlet name = input.readStringRef();\n\t\tif (name == null) name = attachmentName;\n\n\t\tlet typeIndex = input.readByte();\n\t\tlet type = SkeletonBinary.AttachmentTypeValues[typeIndex];\n\t\tswitch (type) {\n\t\tcase AttachmentType.Region: {\n\t\t\tlet path = input.readStringRef();\n\t\t\tlet rotation = input.readFloat();\n\t\t\tlet x = input.readFloat();\n\t\t\tlet y = input.readFloat();\n\t\t\tlet scaleX = input.readFloat();\n\t\t\tlet scaleY = input.readFloat();\n\t\t\tlet width = input.readFloat();\n\t\t\tlet height = input.readFloat();\n\t\t\tlet color = input.readInt32();\n\n\t\t\tif (path == null) path = name;\n\t\t\tlet region = this.attachmentLoader.newRegionAttachment(skin, name, path);\n\t\t\tif (region == null) return null;\n\t\t\tregion.path = path;\n\t\t\tregion.x = x * scale;\n\t\t\tregion.y = y * scale;\n\t\t\tregion.scaleX = scaleX;\n\t\t\tregion.scaleY = scaleY;\n\t\t\tregion.rotation = rotation;\n\t\t\tregion.width = width * scale;\n\t\t\tregion.height = height * scale;\n\t\t\tColor.rgba8888ToColor(region.color, color);\n\t\t\tregion.updateOffset();\n\t\t\treturn region;\n\t\t}\n\t\tcase AttachmentType.BoundingBox: {\n\t\t\tlet vertexCount = input.readInt(true);\n\t\t\tlet vertices = this.readVertices(input, vertexCount);\n\t\t\tlet color = nonessential ? input.readInt32() : 0;\n\n\t\t\tlet box = this.attachmentLoader.newBoundingBoxAttachment(skin, name);\n\t\t\tif (box == null) return null;\n\t\t\tbox.worldVerticesLength = vertexCount << 1;\n\t\t\tbox.vertices = vertices.vertices;\n\t\t\tbox.bones = vertices.bones;\n\t\t\tif (nonessential) Color.rgba8888ToColor(box.color, color);\n\t\t\treturn box;\n\t\t}\n\t\tcase AttachmentType.Mesh: {\n\t\t\tlet path = input.readStringRef();\n\t\t\tlet color = input.readInt32();\n\t\t\tlet vertexCount = input.readInt(true);\n\t\t\tlet uvs = this.readFloatArray(input, vertexCount << 1, 1);\n\t\t\tlet triangles = this.readShortArray(input);\n\t\t\tlet vertices = this.readVertices(input, vertexCount);\n\t\t\tlet hullLength = input.readInt(true);\n\t\t\tlet edges = null;\n\t\t\tlet width = 0, height = 0;\n\t\t\tif (nonessential) {\n\t\t\t\tedges = this.readShortArray(input);\n\t\t\t\twidth = input.readFloat();\n\t\t\t\theight = input.readFloat();\n\t\t\t}\n\n\t\t\tif (path == null) path = name;\n\t\t\tlet mesh = this.attachmentLoader.newMeshAttachment(skin, name, path);\n\t\t\tif (mesh == null) return null;\n\t\t\tmesh.path = path;\n\t\t\tColor.rgba8888ToColor(mesh.color, color);\n\t\t\tmesh.bones = vertices.bones;\n\t\t\tmesh.vertices = vertices.vertices;\n\t\t\tmesh.worldVerticesLength = vertexCount << 1;\n\t\t\tmesh.triangles = triangles;\n\t\t\tmesh.regionUVs = uvs;\n\t\t\tmesh.updateUVs();\n\t\t\tmesh.hullLength = hullLength << 1;\n\t\t\tif (nonessential) {\n\t\t\t\tmesh.edges = edges;\n\t\t\t\tmesh.width = width * scale;\n\t\t\t\tmesh.height = height * scale;\n\t\t\t}\n\t\t\treturn mesh;\n\t\t}\n\t\tcase AttachmentType.LinkedMesh: {\n\t\t\tlet path = input.readStringRef();\n\t\t\tlet color = input.readInt32();\n\t\t\tlet skinName = input.readStringRef();\n\t\t\tlet parent = input.readStringRef();\n\t\t\tlet inheritDeform = input.readBoolean();\n\t\t\tlet width = 0, height = 0;\n\t\t\tif (nonessential) {\n\t\t\t\twidth = input.readFloat();\n\t\t\t\theight = input.readFloat();\n\t\t\t}\n\n\t\t\tif (path == null) path = name;\n\t\t\tlet mesh = this.attachmentLoader.newMeshAttachment(skin, name, path);\n\t\t\tif (mesh == null) return null;\n\t\t\tmesh.path = path;\n\t\t\tColor.rgba8888ToColor(mesh.color, color);\n\t\t\tif (nonessential) {\n\t\t\t\tmesh.width = width * scale;\n\t\t\t\tmesh.height = height * scale;\n\t\t\t}\n\t\t\tthis.linkedMeshes.push(new LinkedMesh(mesh, skinName, slotIndex, parent, inheritDeform));\n\t\t\treturn mesh;\n\t\t}\n\t\tcase AttachmentType.Path: {\n\t\t\tlet closed = input.readBoolean();\n\t\t\tlet constantSpeed = input.readBoolean();\n\t\t\tlet vertexCount = input.readInt(true);\n\t\t\tlet vertices = this.readVertices(input, vertexCount);\n\t\t\tlet lengths = Utils.newArray(vertexCount / 3, 0);\n\t\t\tfor (let i = 0, n = lengths.length; i < n; i++)\n\t\t\t\tlengths[i] = input.readFloat() * scale;\n\t\t\tlet color = nonessential ? input.readInt32() : 0;\n\n\t\t\tlet path = this.attachmentLoader.newPathAttachment(skin, name);\n\t\t\tif (path == null) return null;\n\t\t\tpath.closed = closed;\n\t\t\tpath.constantSpeed = constantSpeed;\n\t\t\tpath.worldVerticesLength = vertexCount << 1;\n\t\t\tpath.vertices = vertices.vertices;\n\t\t\tpath.bones = vertices.bones;\n\t\t\tpath.lengths = lengths;\n\t\t\tif (nonessential) Color.rgba8888ToColor(path.color, color);\n\t\t\treturn path;\n\t\t}\n\t\tcase AttachmentType.Point: {\n\t\t\tlet rotation = input.readFloat();\n\t\t\tlet x = input.readFloat();\n\t\t\tlet y = input.readFloat();\n\t\t\tlet color = nonessential ? input.readInt32() : 0;\n\n\t\t\tlet point = this.attachmentLoader.newPointAttachment(skin, name);\n\t\t\tif (point == null) return null;\n\t\t\tpoint.x = x * scale;\n\t\t\tpoint.y = y * scale;\n\t\t\tpoint.rotation = rotation;\n\t\t\tif (nonessential) Color.rgba8888ToColor(point.color, color);\n\t\t\treturn point;\n\t\t}\n\t\tcase AttachmentType.Clipping: {\n\t\t\tlet endSlotIndex = input.readInt(true);\n\t\t\tlet vertexCount = input.readInt(true);\n\t\t\tlet vertices = this.readVertices(input, vertexCount);\n\t\t\tlet color = nonessential ? input.readInt32() : 0;\n\n\t\t\tlet clip = this.attachmentLoader.newClippingAttachment(skin, name);\n\t\t\tif (clip == null) return null;\n\t\t\tclip.endSlot = skeletonData.slots[endSlotIndex];\n\t\t\tclip.worldVerticesLength = vertexCount << 1;\n\t\t\tclip.vertices = vertices.vertices;\n\t\t\tclip.bones = vertices.bones;\n\t\t\tif (nonessential) Color.rgba8888ToColor(clip.color, color);\n\t\t\treturn clip;\n\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprivate readVertices (input: BinaryInput, vertexCount: number): Vertices {\n\t\tlet verticesLength = vertexCount << 1;\n\t\tlet vertices = new Vertices();\n\t\tlet scale = this.scale;\n\t\tif (!input.readBoolean()) {\n\t\t\tvertices.vertices = this.readFloatArray(input, verticesLength, scale);\n\t\t\treturn vertices;\n\t\t}\n\t\tlet weights = new Array<number>();\n\t\tlet bonesArray = new Array<number>();\n\t\tfor (let i = 0; i < vertexCount; i++) {\n\t\t\tlet boneCount = input.readInt(true);\n\t\t\tbonesArray.push(boneCount);\n\t\t\tfor (let ii = 0; ii < boneCount; ii++) {\n\t\t\t\tbonesArray.push(input.readInt(true));\n\t\t\t\tweights.push(input.readFloat() * scale);\n\t\t\t\tweights.push(input.readFloat() * scale);\n\t\t\t\tweights.push(input.readFloat());\n\t\t\t}\n\t\t}\n\t\tvertices.vertices = Utils.toFloatArray(weights);\n\t\tvertices.bones = bonesArray;\n\t\treturn vertices;\n\t}\n\n\tprivate readFloatArray (input: BinaryInput, n: number, scale: number): number[] {\n\t\tlet array = new Array<number>(n);\n\t\tif (scale == 1) {\n\t\t\tfor (let i = 0; i < n; i++)\n\t\t\t\tarray[i] = input.readFloat();\n\t\t} else {\n\t\t\tfor (let i = 0; i < n; i++)\n\t\t\t\tarray[i] = input.readFloat() * scale;\n\t\t}\n\t\treturn array;\n\t}\n\n\tprivate readShortArray (input: BinaryInput): number[] {\n\t\tlet n = input.readInt(true);\n\t\tlet array = new Array<number>(n);\n\t\tfor (let i = 0; i < n; i++)\n\t\t\tarray[i] = input.readShort();\n\t\treturn array;\n\t}\n\n\tprivate readAnimation (input: BinaryInput, name: string, skeletonData: SkeletonData): Animation {\n\t\tlet timelines = new Array<Timeline>();\n\t\tlet scale = this.scale;\n\t\tlet duration = 0;\n\t\tlet tempColor1 = new Color();\n\t\tlet tempColor2 = new Color();\n\n\t\t// Slot timelines.\n\t\tfor (let i = 0, n = input.readInt(true); i < n; i++) {\n\t\t\tlet slotIndex = input.readInt(true);\n\t\t\tfor (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {\n\t\t\t\tlet timelineType = input.readByte();\n\t\t\t\tlet frameCount = input.readInt(true);\n\t\t\t\tswitch (timelineType) {\n\t\t\t\tcase SkeletonBinary.SLOT_ATTACHMENT: {\n\t\t\t\t\tlet timeline = new AttachmentTimeline(frameCount);\n\t\t\t\t\ttimeline.slotIndex = slotIndex;\n\t\t\t\t\tfor (let frameIndex = 0; frameIndex < frameCount; frameIndex++)\n\t\t\t\t\t\ttimeline.setFrame(frameIndex, input.readFloat(), input.readStringRef());\n\t\t\t\t\ttimelines.push(timeline);\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[frameCount - 1]);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase SkeletonBinary.SLOT_COLOR: {\n\t\t\t\t\tlet timeline = new ColorTimeline(frameCount);\n\t\t\t\t\ttimeline.slotIndex = slotIndex;\n\t\t\t\t\tfor (let frameIndex = 0; frameIndex < frameCount; frameIndex++) {\n\t\t\t\t\t\tlet time = input.readFloat();\n\t\t\t\t\t\tColor.rgba8888ToColor(tempColor1, input.readInt32());\n\t\t\t\t\t\ttimeline.setFrame(frameIndex, time, tempColor1.r, tempColor1.g, tempColor1.b, tempColor1.a);\n\t\t\t\t\t\tif (frameIndex < frameCount - 1) this.readCurve(input, frameIndex, timeline);\n\t\t\t\t\t}\n\t\t\t\t\ttimelines.push(timeline);\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[(frameCount - 1) * ColorTimeline.ENTRIES]);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase SkeletonBinary.SLOT_TWO_COLOR: {\n\t\t\t\t\tlet timeline = new TwoColorTimeline(frameCount);\n\t\t\t\t\ttimeline.slotIndex = slotIndex;\n\t\t\t\t\tfor (let frameIndex = 0; frameIndex < frameCount; frameIndex++) {\n\t\t\t\t\t\tlet time = input.readFloat();\n\t\t\t\t\t\tColor.rgba8888ToColor(tempColor1, input.readInt32());\n\t\t\t\t\t\tColor.rgb888ToColor(tempColor2, input.readInt32());\n\t\t\t\t\t\ttimeline.setFrame(frameIndex, time, tempColor1.r, tempColor1.g, tempColor1.b, tempColor1.a, tempColor2.r,\n\t\t\t\t\t\t\ttempColor2.g, tempColor2.b);\n\t\t\t\t\t\tif (frameIndex < frameCount - 1) this.readCurve(input, frameIndex, timeline);\n\t\t\t\t\t}\n\t\t\t\t\ttimelines.push(timeline);\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[(frameCount - 1) * TwoColorTimeline.ENTRIES]);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Bone timelines.\n\t\tfor (let i = 0, n = input.readInt(true); i < n; i++) {\n\t\t\tlet boneIndex = input.readInt(true);\n\t\t\tfor (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {\n\t\t\t\tlet timelineType = input.readByte();\n\t\t\t\tlet frameCount = input.readInt(true);\n\t\t\t\tswitch (timelineType) {\n\t\t\t\tcase SkeletonBinary.BONE_ROTATE: {\n\t\t\t\t\tlet timeline = new RotateTimeline(frameCount);\n\t\t\t\t\ttimeline.boneIndex = boneIndex;\n\t\t\t\t\tfor (let frameIndex = 0; frameIndex < frameCount; frameIndex++) {\n\t\t\t\t\t\ttimeline.setFrame(frameIndex, input.readFloat(), input.readFloat());\n\t\t\t\t\t\tif (frameIndex < frameCount - 1) this.readCurve(input, frameIndex, timeline);\n\t\t\t\t\t}\n\t\t\t\t\ttimelines.push(timeline);\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[(frameCount - 1) * RotateTimeline.ENTRIES]);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase SkeletonBinary.BONE_TRANSLATE:\n\t\t\t\tcase SkeletonBinary.BONE_SCALE:\n\t\t\t\tcase SkeletonBinary.BONE_SHEAR: {\n\t\t\t\t\tlet timeline;\n\t\t\t\t\tlet timelineScale = 1;\n\t\t\t\t\tif (timelineType == SkeletonBinary.BONE_SCALE)\n\t\t\t\t\t\ttimeline = new ScaleTimeline(frameCount);\n\t\t\t\t\telse if (timelineType == SkeletonBinary.BONE_SHEAR)\n\t\t\t\t\t\ttimeline = new ShearTimeline(frameCount);\n\t\t\t\t\telse {\n\t\t\t\t\t\ttimeline = new TranslateTimeline(frameCount);\n\t\t\t\t\t\ttimelineScale = scale;\n\t\t\t\t\t}\n\t\t\t\t\ttimeline.boneIndex = boneIndex;\n\t\t\t\t\tfor (let frameIndex = 0; frameIndex < frameCount; frameIndex++) {\n\t\t\t\t\t\ttimeline.setFrame(frameIndex, input.readFloat(), input.readFloat() * timelineScale,\n\t\t\t\t\t\t\tinput.readFloat() * timelineScale);\n\t\t\t\t\t\tif (frameIndex < frameCount - 1) this.readCurve(input, frameIndex, timeline);\n\t\t\t\t\t}\n\t\t\t\t\ttimelines.push(timeline);\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[(frameCount - 1) * TranslateTimeline.ENTRIES]);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// IK constraint timelines.\n\t\tfor (let i = 0, n = input.readInt(true); i < n; i++) {\n\t\t\tlet index = input.readInt(true);\n\t\t\tlet frameCount = input.readInt(true);\n\t\t\tlet timeline = new IkConstraintTimeline(frameCount);\n\t\t\ttimeline.ikConstraintIndex = index;\n\t\t\tfor (let frameIndex = 0; frameIndex < frameCount; frameIndex++) {\n\t\t\t\ttimeline.setFrame(frameIndex, input.readFloat(), input.readFloat(), input.readFloat() * scale, input.readByte(), input.readBoolean(),\n\t\t\t\t\tinput.readBoolean());\n\t\t\t\tif (frameIndex < frameCount - 1) this.readCurve(input, frameIndex, timeline);\n\t\t\t}\n\t\t\ttimelines.push(timeline);\n\t\t\tduration = Math.max(duration, timeline.frames[(frameCount - 1) * IkConstraintTimeline.ENTRIES]);\n\t\t}\n\n\t\t// Transform constraint timelines.\n\t\tfor (let i = 0, n = input.readInt(true); i < n; i++) {\n\t\t\tlet index = input.readInt(true);\n\t\t\tlet frameCount = input.readInt(true);\n\t\t\tlet timeline = new TransformConstraintTimeline(frameCount);\n\t\t\ttimeline.transformConstraintIndex = index;\n\t\t\tfor (let frameIndex = 0; frameIndex < frameCount; frameIndex++) {\n\t\t\t\ttimeline.setFrame(frameIndex, input.readFloat(), input.readFloat(), input.readFloat(), input.readFloat(),\n\t\t\t\t\tinput.readFloat());\n\t\t\t\tif (frameIndex < frameCount - 1) this.readCurve(input, frameIndex, timeline);\n\t\t\t}\n\t\t\ttimelines.push(timeline);\n\t\t\tduration = Math.max(duration, timeline.frames[(frameCount - 1) * TransformConstraintTimeline.ENTRIES]);\n\t\t}\n\n\t\t// Path constraint timelines.\n\t\tfor (let i = 0, n = input.readInt(true); i < n; i++) {\n\t\t\tlet index = input.readInt(true);\n\t\t\tlet data = skeletonData.pathConstraints[index];\n\t\t\tfor (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {\n\t\t\t\tlet timelineType = input.readByte();\n\t\t\t\tlet frameCount = input.readInt(true);\n\t\t\t\tswitch (timelineType) {\n\t\t\t\tcase SkeletonBinary.PATH_POSITION:\n\t\t\t\tcase SkeletonBinary.PATH_SPACING: {\n\t\t\t\t\tlet timeline;\n\t\t\t\t\tlet timelineScale = 1;\n\t\t\t\t\tif (timelineType == SkeletonBinary.PATH_SPACING) {\n\t\t\t\t\t\ttimeline = new PathConstraintSpacingTimeline(frameCount);\n\t\t\t\t\t\tif (data.spacingMode == SpacingMode.Length || data.spacingMode == SpacingMode.Fixed) timelineScale = scale;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttimeline = new PathConstraintPositionTimeline(frameCount);\n\t\t\t\t\t\tif (data.positionMode == PositionMode.Fixed) timelineScale = scale;\n\t\t\t\t\t}\n\t\t\t\t\ttimeline.pathConstraintIndex = index;\n\t\t\t\t\tfor (let frameIndex = 0; frameIndex < frameCount; frameIndex++) {\n\t\t\t\t\t\ttimeline.setFrame(frameIndex, input.readFloat(), input.readFloat() * timelineScale);\n\t\t\t\t\t\tif (frameIndex < frameCount - 1) this.readCurve(input, frameIndex, timeline);\n\t\t\t\t\t}\n\t\t\t\t\ttimelines.push(timeline);\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[(frameCount - 1) * PathConstraintPositionTimeline.ENTRIES]);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase SkeletonBinary.PATH_MIX: {\n\t\t\t\t\tlet timeline = new PathConstraintMixTimeline(frameCount);\n\t\t\t\t\ttimeline.pathConstraintIndex = index;\n\t\t\t\t\tfor (let frameIndex = 0; frameIndex < frameCount; frameIndex++) {\n\t\t\t\t\t\ttimeline.setFrame(frameIndex, input.readFloat(), input.readFloat(), input.readFloat());\n\t\t\t\t\t\tif (frameIndex < frameCount - 1) this.readCurve(input, frameIndex, timeline);\n\t\t\t\t\t}\n\t\t\t\t\ttimelines.push(timeline);\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[(frameCount - 1) * PathConstraintMixTimeline.ENTRIES]);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Deform timelines.\n\t\tfor (let i = 0, n = input.readInt(true); i < n; i++) {\n\t\t\tlet skin = skeletonData.skins[input.readInt(true)];\n\t\t\tfor (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {\n\t\t\t\tlet slotIndex = input.readInt(true);\n\t\t\t\tfor (let iii = 0, nnn = input.readInt(true); iii < nnn; iii++) {\n\t\t\t\t\tlet attachment = skin.getAttachment(slotIndex, input.readStringRef()) as VertexAttachment;\n\t\t\t\t\tlet weighted = attachment.bones != null;\n\t\t\t\t\tlet vertices = attachment.vertices;\n\t\t\t\t\tlet deformLength = weighted ? vertices.length / 3 * 2 : vertices.length;\n\n\t\t\t\t\tlet frameCount = input.readInt(true);\n\t\t\t\t\tlet timeline = new DeformTimeline(frameCount);\n\t\t\t\t\ttimeline.slotIndex = slotIndex;\n\t\t\t\t\ttimeline.attachment = attachment;\n\n\t\t\t\t\tfor (let frameIndex = 0; frameIndex < frameCount; frameIndex++) {\n\t\t\t\t\t\tlet time = input.readFloat();\n\t\t\t\t\t\tlet deform;\n\t\t\t\t\t\tlet end = input.readInt(true);\n\t\t\t\t\t\tif (end == 0)\n\t\t\t\t\t\t\tdeform = weighted ? Utils.newFloatArray(deformLength) : vertices;\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tdeform = Utils.newFloatArray(deformLength);\n\t\t\t\t\t\t\tlet start = input.readInt(true);\n\t\t\t\t\t\t\tend += start;\n\t\t\t\t\t\t\tif (scale == 1) {\n\t\t\t\t\t\t\t\tfor (let v = start; v < end; v++)\n\t\t\t\t\t\t\t\t\tdeform[v] = input.readFloat();\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tfor (let v = start; v < end; v++)\n\t\t\t\t\t\t\t\t\tdeform[v] = input.readFloat() * scale;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!weighted) {\n\t\t\t\t\t\t\t\tfor (let v = 0, vn = deform.length; v < vn; v++)\n\t\t\t\t\t\t\t\t\tdeform[v] += vertices[v];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttimeline.setFrame(frameIndex, time, deform);\n\t\t\t\t\t\tif (frameIndex < frameCount - 1) this.readCurve(input, frameIndex, timeline);\n\t\t\t\t\t}\n\t\t\t\t\ttimelines.push(timeline);\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[frameCount - 1]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Draw order timeline.\n\t\tlet drawOrderCount = input.readInt(true);\n\t\tif (drawOrderCount > 0) {\n\t\t\tlet timeline = new DrawOrderTimeline(drawOrderCount);\n\t\t\tlet slotCount = skeletonData.slots.length;\n\t\t\tfor (let i = 0; i < drawOrderCount; i++) {\n\t\t\t\tlet time = input.readFloat();\n\t\t\t\tlet offsetCount = input.readInt(true);\n\t\t\t\tlet drawOrder = Utils.newArray(slotCount, 0);\n\t\t\t\tfor (let ii = slotCount - 1; ii >= 0; ii--)\n\t\t\t\t\tdrawOrder[ii] = -1;\n\t\t\t\tlet unchanged = Utils.newArray(slotCount - offsetCount, 0);\n\t\t\t\tlet originalIndex = 0, unchangedIndex = 0;\n\t\t\t\tfor (let ii = 0; ii < offsetCount; ii++) {\n\t\t\t\t\tlet slotIndex = input.readInt(true);\n\t\t\t\t\t// Collect unchanged items.\n\t\t\t\t\twhile (originalIndex != slotIndex)\n\t\t\t\t\t\tunchanged[unchangedIndex++] = originalIndex++;\n\t\t\t\t\t// Set changed items.\n\t\t\t\t\tdrawOrder[originalIndex + input.readInt(true)] = originalIndex++;\n\t\t\t\t}\n\t\t\t\t// Collect remaining unchanged items.\n\t\t\t\twhile (originalIndex < slotCount)\n\t\t\t\t\tunchanged[unchangedIndex++] = originalIndex++;\n\t\t\t\t// Fill in unchanged items.\n\t\t\t\tfor (let ii = slotCount - 1; ii >= 0; ii--)\n\t\t\t\t\tif (drawOrder[ii] == -1) drawOrder[ii] = unchanged[--unchangedIndex];\n\t\t\t\ttimeline.setFrame(i, time, drawOrder);\n\t\t\t}\n\t\t\ttimelines.push(timeline);\n\t\t\tduration = Math.max(duration, timeline.frames[drawOrderCount - 1]);\n\t\t}\n\n\t\t// Event timeline.\n\t\tlet eventCount = input.readInt(true);\n\t\tif (eventCount > 0) {\n\t\t\tlet timeline = new EventTimeline(eventCount);\n\t\t\tfor (let i = 0; i < eventCount; i++) {\n\t\t\t\tlet time = input.readFloat();\n\t\t\t\tlet eventData = skeletonData.events[input.readInt(true)];\n\t\t\t\tlet event = new Event(time, eventData);\n\t\t\t\tevent.intValue = input.readInt(false);\n\t\t\t\tevent.floatValue = input.readFloat();\n\t\t\t\tevent.stringValue = input.readBoolean() ? input.readString() : eventData.stringValue;\n\t\t\t\tif (event.data.audioPath != null) {\n\t\t\t\t\tevent.volume = input.readFloat();\n\t\t\t\t\tevent.balance = input.readFloat();\n\t\t\t\t}\n\t\t\t\ttimeline.setFrame(i, event);\n\t\t\t}\n\t\t\ttimelines.push(timeline);\n\t\t\tduration = Math.max(duration, timeline.frames[eventCount - 1]);\n\t\t}\n\n\t\treturn new Animation(name, timelines, duration);\n\t}\n\n\tprivate readCurve (input: BinaryInput, frameIndex: number, timeline: CurveTimeline) {\n\t\tswitch (input.readByte()) {\n\t\tcase SkeletonBinary.CURVE_STEPPED:\n\t\t\ttimeline.setStepped(frameIndex);\n\t\t\tbreak;\n\t\tcase SkeletonBinary.CURVE_BEZIER:\n\t\t\tthis.setCurve(timeline, frameIndex, input.readFloat(), input.readFloat(), input.readFloat(), input.readFloat());\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tsetCurve (timeline: CurveTimeline, frameIndex: number, cx1: number, cy1: number, cx2: number, cy2: number) {\n\t\ttimeline.setCurve(frameIndex, cx1, cy1, cx2, cy2);\n\t}\n}\n\nclass BinaryInput {\n\tconstructor(data: Uint8Array, public strings = new Array<string>(), private index: number = 0, private buffer = new DataView(data.buffer)) { \n\n\t}\n\n\treadByte(): number {\n\t\treturn this.buffer.getInt8(this.index++);\n\t}\n\n\treadShort(): number {\n\t\tlet value = this.buffer.getInt16(this.index);\n\t\tthis.index += 2;\n\t\treturn value;\n\t}\n\n\treadInt32(): number {\n\t\t\tlet value = this.buffer.getInt32(this.index)\n\t\t\tthis.index += 4;\n\t\t\treturn value;\n\t}\n\n\treadInt(optimizePositive: boolean) {\n\t\tlet b = this.readByte();\n\t\tlet result = b & 0x7F;\n\t\tif ((b & 0x80) != 0) {\n\t\t\tb = this.readByte();\n\t\t\tresult |= (b & 0x7F) << 7;\n\t\t\tif ((b & 0x80) != 0) {\n\t\t\t\tb = this.readByte();\n\t\t\t\tresult |= (b & 0x7F) << 14;\n\t\t\t\tif ((b & 0x80) != 0) {\n\t\t\t\t\tb = this.readByte();\n\t\t\t\t\tresult |= (b & 0x7F) << 21;\n\t\t\t\t\tif ((b & 0x80) != 0) {\n\t\t\t\t\t\tb = this.readByte();\n\t\t\t\t\t\tresult |= (b & 0x7F) << 28;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn optimizePositive ? result : ((result >>> 1) ^ -(result & 1));\n\t}\n\n\treadStringRef (): string {\n\t\tlet index = this.readInt(true);\n\t\treturn index == 0 ? null : this.strings[index - 1];\n\t}\n\n\treadString (): string {\n\t\tlet byteCount = this.readInt(true);\n\t\tswitch (byteCount) {\n\t\tcase 0:\n\t\t\treturn null;\n\t\tcase 1:\n\t\t\treturn \"\";\n\t\t}\n\t\tbyteCount--;\n\t\tlet chars = \"\";\n\t\tlet charCount = 0;\n\t\tfor (let i = 0; i < byteCount;) {\n\t\t\tlet b = this.readByte();\n\t\t\tswitch (b >> 4) {\n\t\t\tcase 12:\n\t\t\tcase 13:\n\t\t\t\tchars += String.fromCharCode(((b & 0x1F) << 6 | this.readByte() & 0x3F));\n\t\t\t\ti += 2;\n\t\t\t\tbreak;\n\t\t\tcase 14:\n\t\t\t\tchars += String.fromCharCode(((b & 0x0F) << 12 | (this.readByte() & 0x3F) << 6 | this.readByte() & 0x3F));\n\t\t\t\ti += 3;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tchars += String.fromCharCode(b);\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t\treturn chars;\n\t}\n\n\treadFloat (): number {\n\t\tlet value = this.buffer.getFloat32(this.index);\n\t\tthis.index += 4;\n\t\treturn value;\n\t}\n\n\treadBoolean (): boolean {\n\t\treturn this.readByte() != 0;\n\t}\n}\n\nclass LinkedMesh {\n\tparent: string; skin: string;\n\tslotIndex: number;\n\tmesh: MeshAttachment;\n\tinheritDeform: boolean;\n\n\tconstructor (mesh: MeshAttachment, skin: string, slotIndex: number, parent: string, inheritDeform: boolean) {\n\t\tthis.mesh = mesh;\n\t\tthis.skin = skin;\n\t\tthis.slotIndex = slotIndex;\n\t\tthis.parent = parent;\n\t\tthis.inheritDeform = inheritDeform;\n\t}\n}\n\nclass Vertices {\n\tconstructor(public bones: Array<number> = null, public vertices: Array<number> | Float32Array = null) { }\n}","import {\n AssetPromise,\n Loader,\n LoadItem,\n resourceLoader,\n ResourceManager,\n TextureFilterMode,\n TextureWrapMode,\n Texture2D,\n Engine,\n Entity,\n MeshRenderer,\n} from '@galacean/engine';\nimport { AssetManager } from './spine-core/AssetManager';\nimport { TextureAtlas } from './spine-core/TextureAtlas';\nimport { Texture, TextureFilter } from './spine-core/Texture';\nimport { AtlasAttachmentLoader } from './spine-core/AtlasAttachmentLoader';\nimport { SkeletonJson } from './spine-core/SkeletonJson';\nimport { SkeletonBinary } from './spine-core/SkeletonBinary';\nimport { SpineAnimation } from './SpineAnimation';\n\ntype SpineResouce = {\n skeletonFile: string\n atlasFile: string\n textureFile?: string\n}\n\ntype SpineOpt = {\n scale: number;\n}\n\ntype SpineLoadItem = LoadItem & SpineOpt;\n\n// @ts-ignore\n@resourceLoader('spine', ['json', 'bin'])\nclass SpineLoader extends Loader<Entity> {\n load(item: SpineLoadItem, resourceManager: ResourceManager): AssetPromise<Entity> {\n return new AssetPromise((resolve, reject) => {\n const { engine } = resourceManager;\n // @ts-ignore\n if (item.type !== 'spine') {\n reject('Asset type must be spine.');\n }\n\n let resource: SpineResouce;\n\n if (!item.urls && item.url && this.checkUrl(item.url)) {\n resource = this.getResouceFromUrl(item.url);\n }\n\n if (item.urls && this.checkUrls(item.urls)) {\n resource = this.getResouceFromUrls(item.urls);\n }\n\n let autoLoadTexture: boolean = false;\n let assetManager: AssetManager;\n assetManager = new AssetManager(null, (img) => {\n return this.createAdaptiveTexture(img, engine);\n });\n\n const { skeletonFile, atlasFile, textureFile } = resource;\n\n // create spine entity on load complete\n assetManager.onLoadComplete = () => {\n try {\n let atlas: TextureAtlas;\n if (autoLoadTexture) {\n atlas = assetManager.get(atlasFile);\n } else {\n const atlasText = assetManager.get(atlasFile);\n atlas = new TextureAtlas(atlasText, this.textureAssetPicker.bind(this, assetManager, textureFile));\n }\n const atlasLoader = new AtlasAttachmentLoader(atlas);\n let skeletonLoader: SkeletonJson | SkeletonBinary;\n if (this.isBinFile(skeletonFile)) {\n skeletonLoader = new SkeletonBinary(atlasLoader);\n } else {\n skeletonLoader = new SkeletonJson(atlasLoader);\n }\n const skeletonData = skeletonLoader.readSkeletonData(assetManager.get(skeletonFile));\n const entity = new Entity(engine);\n const meshRenderer = entity.addComponent(MeshRenderer);\n const mtl = SpineAnimation.getDefaultMaterial(engine);\n meshRenderer.setMaterial(mtl);\n const spineAnimation = entity.addComponent(SpineAnimation);\n spineAnimation.setSkeletonData(skeletonData);\n resolve(entity);\n } catch (err) {\n reject(err);\n }\n }\n\n // load asset\n const isBinFile = this.isBinFile(skeletonFile);\n if (skeletonFile && atlasFile && textureFile) {\n if (isBinFile) {\n assetManager.loadBinary(skeletonFile, null, reject);\n } else {\n assetManager.loadText(skeletonFile, null, reject);\n }\n assetManager.loadText(atlasFile, null, reject);\n assetManager.loadTexture(textureFile, null, reject);\n } else if (skeletonFile && atlasFile && !textureFile) {\n autoLoadTexture = true;\n if (isBinFile) {\n assetManager.loadBinary(skeletonFile, null, reject);\n } else {\n assetManager.loadText(skeletonFile, null, reject);\n }\n assetManager.loadTextureAtlas(atlasFile, null, reject);\n } else {\n reject('Resouce param error');\n }\n });\n }\n\n textureAssetPicker(assetManager: AssetManager, textureFile: string) {\n return assetManager.get(textureFile);\n }\n\n createAdaptiveTexture(img, engine) {\n return new AdaptiveTexture(img, engine);\n }\n\n isBinFile(url: string): boolean {\n const ext = this.getExtFromUrl(url);\n return ext === 'bin';\n }\n\n checkUrl(url: string): boolean {\n const ext = this.getExtFromUrl(url);\n if (ext === 'json' || ext === 'bin') {\n return true\n }\n console.error('When use url as params, url must be json or bin file');\n return false;\n }\n\n getResouceFromUrl(url): SpineResouce {\n const skeletonFile = url;\n const atlasSuffix = '.atlas';\n let atlasFile = url;\n let queryStringPos = atlasFile.indexOf('?');\n if (queryStringPos > 0) {\n atlasFile = atlasFile.substr(0, queryStringPos);\n }\n atlasFile = atlasFile.substr(0, atlasFile.lastIndexOf('.')) + atlasSuffix;\n return { skeletonFile, atlasFile };\n }\n\n checkUrls(urls: string[]): boolean {\n if (urls.length < 2) {\n console.error('When use urls as params, urls should at least contain: json/bin and atlas');\n return false;\n }\n if (urls.length > 3) {\n console.error('Spine runtime dont support multiple texture now');\n return false;\n }\n \n const { skeletonFile, atlasFile, textureFile } = this.getResouceFromUrls(urls);\n if (skeletonFile && atlasFile) {\n return true;\n }\n console.error(`Lack ${skeletonFile ? '' : 'skeletonFile'}${!atlasFile ? '' : ' atlasFile'}`);\n return false;\n }\n\n getResouceFromUrls(urls: string[]): SpineResouce {\n let skeletonFile: string;\n let atlasFile: string;\n let textureFile: string;\n for (let i = 0; i < urls.length; i += 1) {\n const url = urls[i];\n const ext = this.getExtFromUrl(url);\n if (ext === 'json' || ext === 'bin') {\n skeletonFile = url;\n }\n if (ext === 'atlas') {\n atlasFile = url;\n }\n const imgMap = ['png', 'jpg', 'webp', 'jpeg'];\n if (imgMap.includes(ext)) {\n textureFile = url;\n }\n }\n return {\n skeletonFile,\n atlasFile,\n textureFile\n };\n }\n\n getExtFromUrl(url: string): string {\n return url.split(/[#?]/)[0].split('.').pop().trim();\n }\n}\n\n\nexport class AdaptiveTexture extends Texture {\n texture: Texture2D;\n\n constructor(data: HTMLImageElement, engine: Engine) {\n super(data);\n this.texture = new Texture2D(engine, data.width, data.height);\n this.texture.setImageSource(data);\n this.texture.generateMipmaps();\n }\n\n setFilters(minFilter: any, magFilter: any) {\n if (minFilter === TextureFilter.Nearest) {\n this.texture.filterMode = TextureFilterMode.Point;\n } else if (magFilter === TextureFilter.MipMapLinearLinear) {\n this.texture.filterMode = TextureFilterMode.Trilinear;\n } else {\n this.texture.filterMode = TextureFilterMode.Bilinear;\n }\n }\n\n // @ts-ignore\n setWraps(uWrap: TextureWrapMode, vWrap: TextureWrapMode) {\n this.texture.wrapModeU = uWrap;\n this.texture.wrapModeV = vWrap;\n }\n\n dispose() {}\n}\n\nexport { SpineLoader };\n","import {\n AssetPromise,\n Loader,\n LoadItem,\n resourceLoader,\n ResourceManager,\n TextureFilterMode,\n TextureWrapMode,\n Texture2D,\n Engine,\n Entity,\n MeshRenderer\n} from '@galacean/engine';\nimport { AssetManager } from './spine-core/AssetManager';\nimport { TextureAtlas } from './spine-core/TextureAtlas';\nimport { Texture, TextureFilter } from './spine-core/Texture';\nimport { AtlasAttachmentLoader } from './spine-core/AtlasAttachmentLoader';\nimport { SkeletonJson } from './spine-core/SkeletonJson';\nimport { SpineAnimation } from './SpineAnimation';\n\ntype SpineOpt = {\n scale: number;\n}\n\ntype SpineLoadItem = LoadItem & SpineOpt;\n\n@resourceLoader('antg_spine', ['json', 'bin'])\nclass SpineLoader extends Loader<Entity> {\n load(item: SpineLoadItem, resourceManager: ResourceManager): AssetPromise<Entity> {\n return new AssetPromise((resolve, reject) => {\n const { engine } = resourceManager;\n\n if (!item.url) {\n reject('AntG asset must be a json url.');\n return;\n }\n\n if (!this.checkUrl(item.url)) {\n reject('AntG asset must be a json url.');\n return;\n }\n\n const skeletonFile = item.url;\n let atlasFile: string;\n let textureFile: string;\n let jsonData: string;\n\n let assetManager: AssetManager;\n assetManager = new AssetManager(null, (img) => {\n return this.createAdaptiveTexture(img, engine);\n });\n\n loadText(skeletonFile).then((json: any) => {\n jsonData = json;\n if (!json._ext) {\n reject('AntG spine json must have ext data');\n } else {\n const { atlas, images } = json._ext;\n const imageKey = Object.keys(images)[0];\n const image = images[imageKey];\n atlasFile = atlas;\n textureFile = image;\n assetManager.loadText(atlas);\n assetManager.loadTexture(image);\n }\n }).catch(() => {\n reject('Resouce json load fail');\n });\n\n assetManager.onLoadComplete = () => {\n let atlas: TextureAtlas;\n const atlasText = assetManager.get(atlasFile);\n atlas = new TextureAtlas(atlasText, this.textureAssetPicker.bind(this, assetManager, textureFile));\n const atlasLoader = new AtlasAttachmentLoader(atlas);\n const skeletonLoader = new SkeletonJson(atlasLoader);\n const skeletonData = skeletonLoader.readSkeletonData(jsonData);\n const entity = new Entity(engine);\n const meshRenderer = entity.addComponent(MeshRenderer);\n meshRenderer.shaderData.enableMacro('USE_MODEL_MATRIX');\n meshRenderer.shaderData.enableMacro('USE_CUSTOM_TEXTURE');\n // @ts-ignore\n const mtl = engine._spriteDefaultMaterial.clone();\n meshRenderer.setMaterial(mtl);\n const spineAnimation = entity.addComponent(SpineAnimation);\n spineAnimation.setSkeletonData(skeletonData);\n resolve(entity);\n }\n });\n }\n\n textureAssetPicker(assetManager: AssetManager, textureFile: string) {\n return assetManager.get(textureFile);\n }\n\n createAdaptiveTexture(img, engine) {\n return new AdaptiveTexture(img, engine);\n }\n\n checkUrl(url: string): boolean {\n const ext = this.getExtFromUrl(url);\n if (ext === 'json') {\n return true\n }\n console.error('When use url as params, url must be a json file');\n return false;\n }\n\n getExtFromUrl(url: string): string {\n return url.split(/[#?]/)[0].split('.').pop().trim();\n }\n}\n\n\nexport class AdaptiveTexture extends Texture {\n texture: Texture2D;\n\n constructor(data: HTMLImageElement, engine: Engine) {\n super(data);\n this.texture = new Texture2D(engine, data.width, data.height);\n this.texture.setImageSource(data);\n this.texture.generateMipmaps();\n }\n\n setFilters(minFilter: any, magFilter: any) {\n if (minFilter === TextureFilter.Nearest) {\n this.texture.filterMode = TextureFilterMode.Point;\n } else if (magFilter === TextureFilter.MipMapLinearLinear) {\n this.texture.filterMode = TextureFilterMode.Trilinear;\n } else {\n this.texture.filterMode = TextureFilterMode.Bilinear;\n }\n }\n\n // @ts-ignore\n setWraps(uWrap: TextureWrapMode, vWrap: TextureWrapMode) {\n this.texture.wrapModeU = uWrap;\n this.texture.wrapModeV = vWrap;\n }\n\n dispose() {}\n}\n\nfunction loadText(url: string) {\n return new Promise((resolve, reject) => {\n let request = new XMLHttpRequest();\n request.responseType = 'json';\n request.open('GET', url, true);\n request.onload = () => {\n if (request.status == 200) {\n resolve(request.response);\n } else {\n reject(`status:${request.status}, ${request.responseText}`);\n }\n }\n request.onerror = () => {\n reject(`status:${request.status}, ${request.responseText}`);\n }\n request.send();\n });\n}\n\n\nexport { SpineLoader };\n","export { SpineAnimation } from './SpineAnimation';\nimport './SpineLoader';\nimport './AntGSpineLoader';\n\nexport { AssetManager } from './spine-core/AssetManager';\nexport { Texture } from './spine-core/Texture';\nexport { TextureAtlas } from './spine-core/TextureAtlas';\nexport { AtlasAttachmentLoader } from './spine-core/AtlasAttachmentLoader';\nexport { SkeletonJson } from './spine-core/SkeletonJson';\nexport { SkeletonBinary } from './spine-core/SkeletonBinary';\n\nexport const version = `__buildVersion`;\n\nconsole.log(`Galacean spine version :${version}`);\n"],"names":["_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","_create_class","Constructor","protoProps","staticProps","prototype","_extends","assign","arguments","source","hasOwnProperty","call","apply","this","_set_prototype_of","o","p","setPrototypeOf","__proto__","_inherits","subClass","superClass","TypeError","create","constructor","value","__decorate","decorators","desc","d","c","r","getOwnPropertyDescriptor","Reflect","decorate","_instanceof","left","right","Symbol","hasInstance","SuppressedError","IntSet","array","Array","add","contains","undefined","remove","clear","Color","g","b","a","set","clamp","setFromColor","setFromString","hex","charAt","substr","parseInt","rgba8888ToColor","color","rgb888ToColor","WHITE","RED","GREEN","BLUE","MAGENTA","MathUtils","min","max","cosDeg","degrees","Math","cos","degRad","sinDeg","sin","signum","toInt","x","floor","ceil","cbrt","y","pow","abs","randomTriangular","randomTriangularWith","mode","u","random","sqrt","PI","PI2","radiansToDegrees","radDeg","degreesToRadians","Utils","arrayCopy","sourceStart","dest","destStart","numElements","j","setArraySize","size","oldSize","ensureArrayCapacity","newArray","defaultValue","newFloatArray","SUPPORTS_TYPED_ARRAYS","Float32Array","newShortArray","Int16Array","toFloatArray","toSinglePrecision","fround","webkit602BugfixHelper","alpha","blend","element","identity","TransformMode","Pool","instantiator","items","obtain","pop","free","item","reset","push","freeAll","Vector2","normalize","len","BoneData","index","name","parent","rotation","scaleX","scaleY","shearX","shearY","transformMode","Normal","skinRequired","Error","OnlyTranslation","NoRotationOrReflection","NoScale","NoScaleOrReflection","PositionMode","SpacingMode","RotateMode","Bone","data","skeleton","children","ax","ay","arotation","ascaleX","ascaleY","ashearX","ashearY","appliedValid","worldY","worldX","sorted","active","setToSetupPose","isActive","update","updateWorldTransformWith","updateWorldTransform","rotationY","sx","sy","pa","pb","pc","pd","la","lb","lc","ld","s","prx","atan2","rx","ry","za","zc","zb","zd","getWorldRotationX","getWorldRotationY","getWorldScaleX","getWorldScaleY","updateAppliedTransform","pid","dx","dy","ia","id","ib","ic","ra","rb","rc","rd","det","worldToLocal","world","invDet","localToWorld","local","worldToLocalRotation","worldRotation","localToWorldRotation","localRotation","rotateWorld","Slot","bone","deform","darkColor","getSkeleton","getAttachment","attachment","setAttachment","attachmentTime","time","setAttachmentTime","getAttachmentTime","attachmentName","IkConstraint","bendDirection","compress","stretch","mix","softness","bones","findBone","apply1","uniform","apply2","targetX","targetY","rotationIK","tx","ty","sa","sc","dd","child","bendDir","px","py","psx","psy","csx","os1","os2","s2","cx","cy","cwx","cwy","pp","a1","a2","l1","l2","td","sd","outer","acos","aa","bb","ta","c1","c2","q","r0","r1","minAngle","minX","minDist","minY","maxAngle","maxX","maxDist","maxY","os","TransformConstraint","rotateMix","translateMix","scaleMix","shearMix","temp","relative","applyRelativeLocal","applyAbsoluteLocal","applyRelativeWorld","applyAbsoluteWorld","tb","tc","degRadReflect","offsetRotation","offsetShearY","n","modified","offsetX","offsetY","ts","offsetScaleX","offsetScaleY","by","ConstraintData","order","PathConstraintData","Fixed","Percent","Length","Tangent","Chain","ChainScale","Attachment","VertexAttachment","nextID","_this","worldVerticesLength","deformAttachment","self","ReferenceError","computeWorldVertices","slot","start","count","worldVertices","offset","stride","deformArray","vertices","v","skip","skeletonBones","w","wx","wy","vx","vy","weight","f","copyTo","PathAttachment","closed","constantSpeed","copy","lengths","PathConstraint","position","spacing","spaces","positions","curves","segments","findSlot","rotate","percentSpacing","spacingMode","rotateMode","tangents","scale","boneCount","spacesCount","lengthSpacing","setupLength","epsilon","computeWorldPositions","positionMode","boneX","boneY","tip","path","percentPosition","out","verticesLength","curveCount","prevCurve","NONE","pathLength","curve","space","BEFORE","addBeforePosition","AFTER","addAfterPosition","prev","addCurvePosition","x1","y1","cx1","cy1","cx2","cy2","x2","y2","tmpx","tmpy","dddfx","dddfy","ddfx","ddfy","dfx","dfy","curveLength","segment","ii","isNaN","tt","ttt","uu","uuu","ut","ut3","uut3","utt3","RegionAttachment","width","height","uvs","tempColor","updateOffset","regionScaleX","region","originalWidth","regionScaleY","originalHeight","localX","localY","localX2","localY2","radians","localXCos","localXSin","localYCos","localYSin","localX2Cos","localX2Sin","localY2Cos","localY2Sin","OX1","OY1","OX2","OY2","OX3","OY3","OX4","OY4","setRegion","v2","u2","vertexOffset","rendererObject","X1","Y1","C1R","C1G","C1B","C1A","U1","V1","X2","Y2","C2R","C2G","C2B","C2A","U2","V2","X3","Y3","C3R","C3G","C3B","C3A","U3","V3","X4","Y4","C4R","C4G","C4B","C4A","U4","V4","TextureFilter","TextureWrap","Texture","image","_image","getImage","filterFromString","text","toLowerCase","wrapFromString","Nearest","Linear","MipMap","MipMapNearestNearest","MipMapLinearNearest","MipMapNearestLinear","MipMapLinearLinear","MirroredRepeat","ClampToEdge","Repeat","MixBlend","MixDirection","TimelineType","TextureRegion","FakeTexture","setFilters","minFilter","magFilter","setWraps","uWrap","vWrap","dispose","TextureAtlas","atlasText","textureLoader","pages","regions","load","_proto","reader","TextureAtlasReader","tuple","page","line","readLine","trim","TextureAtlasRegion","rotateValue","readValue","toLocaleLowerCase","parseFloat","readTuple","texture","TextureAtlasPage","direction","findRegion","lines","split","colon","indexOf","substring","lastMatch","comma","MeshAttachment","updateUVs","regionUVs","textureWidth","textureHeight","getParentMesh","parentMesh","setParentMesh","triangles","hullLength","newLinkedMesh","edges","Skeleton","_updateCache","updateCacheReset","boneData","slots","drawOrder","slotData","ikConstraints","ikConstraintData","transformConstraints","transformConstraintData","pathConstraints","pathConstraintData","updateCache","skin","skinBones","ikCount","transformCount","pathCount","constraintCount","constraint","sortIkConstraint","sortTransformConstraint","sortPathConstraint","sortBone","constraints","constrained","sortReset","slotIndex","slotBone","sortPathConstraintAttachment","defaultSkin","skins","sortPathConstraintAttachmentWith","attachments","pathBones","boneIndex","setBonesToSetupPose","setSlotsToSetupPose","getRootBone","boneName","findBoneIndex","slotName","findSlotIndex","setSkinByName","skinName","findSkin","setSkin","newSkin","attachAll","getAttachmentByName","findIkConstraint","constraintName","ikConstraint","findTransformConstraint","findPathConstraint","getBounds","Number","POSITIVE_INFINITY","NEGATIVE_INFINITY","mesh","nn","delta","Animation","timelines","duration","timelineIds","getPropertyId","hasTimeline","lastTime","loop","events","binarySearch","values","step","low","high","current","linearSearch","last","setup","first","replace","mixIn","mixOut","translate","shear","event","transformConstraint","pathConstraintPosition","pathConstraintSpacing","pathConstraintMix","twoColor","CurveTimeline","frameCount","BEZIER_SIZE","getFrameCount","setLinear","frameIndex","LINEAR","setStepped","STEPPED","getCurveType","type","BEZIER","setCurve","getCurvePercent","percent","prevX","prevY","RotateTimeline","frames","setFrame","ROTATION","ENTRIES","PREV_ROTATION","frame","prevRotation","frameTime","PREV_TIME","TranslateTimeline","X","Y","PREV_X","PREV_Y","ScaleTimeline","bx","ShearTimeline","ColorTimeline","R","G","B","A","PREV_R","PREV_G","PREV_B","PREV_A","TwoColorTimeline","r2","g2","b2","R2","G2","B2","light","dark","setupLight","setupDark","PREV_R2","PREV_G2","PREV_B2","AttachmentTimeline","attachmentNames","zeros","DeformTimeline","frameVertices","firedEvents","slotAttachment","vertexCount","vertexAttachment","setupVertices","lastVertices","prevVertices","nextVertices","EventTimeline","MAX_VALUE","DrawOrderTimeline","drawOrders","drawOrderToSetupIndex","IkConstraintTimeline","ikConstraintIndex","MIX","SOFTNESS","BEND_DIRECTION","COMPRESS","STRETCH","PREV_MIX","PREV_SOFTNESS","PREV_BEND_DIRECTION","PREV_COMPRESS","PREV_STRETCH","TransformConstraintTimeline","transformConstraintIndex","ROTATE","TRANSLATE","SCALE","SHEAR","PREV_ROTATE","PREV_TRANSLATE","PREV_SCALE","PREV_SHEAR","PathConstraintPositionTimeline","pathConstraintIndex","VALUE","PREV_VALUE","PathConstraintSpacingTimeline","PathConstraintMixTimeline","AnimationState","tracks","timeScale","unkeyedState","listeners","queue","EventQueue","propertyIDs","animationsChanged","trackEntryPool","TrackEntry","animationLast","nextAnimationLast","trackLast","nextTrackLast","currentDelta","delay","next","nextTime","trackTime","setCurrent","mixingFrom","mixTime","trackEnd","end","disposeNext","updateMixingFrom","from","mixingTo","drain","to","finished","mixDuration","totalAlpha","interruptAlpha","_animationsChanged","applied","mixBlend","applyMixingFrom","animationTime","getAnimationTime","timelineCount","animation","timeline","applyAttachmentTimeline","timelineMode","firstFrame","timelinesRotation","timelineBlend","SUBSEQUENT","applyRotateTimeline","queueEvents","setupState","SETUP","attachmentState","eventThreshold","attachmentThreshold","drawOrderThreshold","alphaHold","alphaMix","timelineHoldMix","FIRST","HOLD_SUBSEQUENT","HOLD_FIRST","holdMix","CURRENT","rotateTimeline","total","diff","lastTotal","lastDiff","dir","entry","animationStart","animationEnd","trackLastWrapped","complete","clearTracks","oldDrainDisabled","drainDisabled","clearTrack","trackIndex","interrupt","expandToIndex","setAnimation","animationName","skeletonData","findAnimation","setAnimationWith","trackEntry","addAnimation","addAnimationWith","getMix","setEmptyAnimation","emptyAnimation","addEmptyAnimation","setEmptyAnimations","holdPrevious","computeHold","timelinesCount","timelineDipMix","HOLD_MIX","getCurrent","addListener","listener","removeListener","splice","clearListeners","clearListenerNotifications","EventType","setAnimationLast","isComplete","resetRotationDirections","animState","objects","AnimationStateData","animationToMixTime","defaultMix","setMix","fromName","toName","setMixWith","ClippingAttachment","endSlot","Triangulator","convexPolygons","convexPolygonsIndices","indicesArray","isConcaveArray","polygonPool","polygonIndicesPool","triangulate","verticesArray","indices","isConcave","previous","p1","p2","p3","p1x","p1y","p2x","p2y","p3x","p3y","positiveArea","previousIndex","nextIndex","decompose","polygonIndices","polygon","fanBaseIndex","lastWinding","t1","t2","t3","x3","y3","merged","winding1","winding","winding2","firstIndex","lastIndex","prevPrevX","prevPrevY","firstX","firstY","secondX","secondY","otherIndices","otherFirstIndex","otherSecondIndex","otherLastIndex","otherPoly","SkeletonClipping","triangulator","clippingPolygon","clipOutput","clippedVertices","clippedTriangles","scratch","clipStart","clip","clipAttachment","makeClockwise","clippingPolygons","clipEndWithSlot","clipEnd","isClipping","clipTriangles","trianglesLength","polygons","polygonsCount","vertexSize","u1","v1","u3","v3","clippedVerticesItems","clippedTrianglesItems","clipOutputLength","d0","d1","d2","d4","clipOutputCount","clipOutputItems","c0","clippingArea","output","originalOutput","clipped","input","clippingVertices","clippingVerticesLast","edgeX","edgeY","edgeX2","edgeY2","deltaX","deltaY","inputVertices","inputVerticesLength","outputStart","inputX","inputY","inputX2","inputY2","side2","ua","verticeslength","area","lastX","other","SpineMesh","initialize","engine","_mesh","BufferMesh","vertexElements","VertexElement","VertexElementFormat","Vector3","Vector4","vertexStride","MeshGenerator","VERTEX_STRIDE","byteLength","vertexBuffer","Buffer","BufferBindFlag","VertexBuffer","BufferUsage","Dynamic","indexBuffer","IndexBuffer","_indexBuffer","_vertexBuffer","setVertexBufferBinding","setIndexBufferBinding","IndexFormat","UInt16","setVertexElements","addSubMesh","changeBuffer","get","entity","_clipper","_spineMesh","_needResize","_subMeshItems","separateSlots","_engine","_entity","setting","meshRenderer","getComponent","MeshRenderer","_meshRenderer","_setting","QUAD_TRIANGLE_LENGTH","QUAD_TRIANGLES","_vertexCount","_prepareBufferData","console","warn","buildMesh","_ref","_ref_useClipping","useClipping","_ref_zSpacing","zSpacing","indicesLength","maxSlotCount","subMeshItems","_vertices","attachmentColor","z","numFloats","VERTEX_SIZE","regionAttachment","renderObject","meshAttachment","finalVertices","finalVerticesLength","finalIndices","finalIndicesLength","skeletonColor","slotColor","verts","indexStart","verticesWithZ","_verticesWithZ","_indices","includes","subMesh","SubMesh","prevSubMesh","materials","getMaterials","materialLength","mtl","shaderData","getTexture","setTexture","sort","clearSubMesh","subMeshItemLength","resize","setData","addSeparateSlot","Uint16Array","SpineMaterial","Material","shader","Shader","find","_spineVS","_spineFS","renderState","blendState","targetBlendState","enabled","sourceColorBlendFactor","BlendFactor","SourceAlpha","destinationColorBlendFactor","OneMinusSourceAlpha","sourceAlphaBlendFactor","One","destinationAlphaBlendFactor","colorBlendOperation","alphaBlendOperation","BlendOperation","Add","depthState","writeEnabled","rasterState","cullMode","CullMode","Off","renderQueueType","RenderQueueType","Transparent","SpineAnimation","Script","_tempOffset","_tempSize","_tempArray","autoUpdate","autoUpdateBounds","_meshGenerator","setSkeletonData","error","_skeletonData","_skeleton","animationData","_state","mtl1","_defaultMaterial","clone","mtl2","materialCount","setMaterial","hackSeparateSlotTexture","_this__meshGenerator","subMeshIndex","findIndex","getMaterial","onUpdate","updateState","deltaTime","state","updateGeometry","updateBounds","_this_setting","bounds","_cloneTo","_cloneSetting","_disposeCurrentSkeleton","onDestroy","getDefaultMaterial","isGCIgnored","_array_like_to_array","arr","arr2","_create_for_of_iterator_helper_loose","allowArrayLike","it","iterator","bind","isArray","minLen","toString","slice","test","_unsupported_iterable_to_array","done","ignoreClone","BlendMode","AssetManager","pathPrefix","assets","errors","toLoad","loaded","rawDataUris","downloadText","url","success","request","then","res","catch","err","downloadBinary","XMLHttpRequest","open","responseType","onload","status","Uint8Array","response","responseText","onerror","send","setRawDataURI","loadBinary","onLoad","loadText","JSON","stringify","loadImage","storagePath","img","Image","crossOrigin","ev","src","loadTexture","loadTextureAtlas","lastIndexOf","atlasData","atlasPage","pageLoadError","imagePath","pagesLoaded","atlasPages","atlas","e","ex","message","errorMessage","document","createElement","asset","removeAll","isLoadingComplete","onLoadComplete","getToLoad","getLoaded","hasErrors","keys","getErrors","BoundingBoxAttachment","PointAttachment","computeWorldPosition","point","computeWorldRotation","AtlasAttachmentLoader","newRegionAttachment","newMeshAttachment","newBoundingBoxAttachment","newPathAttachment","newPointAttachment","newClippingAttachment","SkeletonData","animations","fps","findEvent","eventDataName","findPathConstraintIndex","pathConstraintName","SlotData","IkConstraintData","TransformConstraintData","SkinEntry","Skin","addSkin","contained","getAttachments","copySkin","dictionary","removeAttachment","entries","slotAttachments","getAttachmentsForSlot","oldSkin","EventData","Additive","Multiply","Screen","AttachmentType","Event","SkeletonJson","attachmentLoader","linkedMeshes","readSkeletonData","json","root","parse","skeletonMap","hash","version","spine","imagesPath","images","boneMap","parentName","getValue","transformModeFromString","slotMap","blendMode","blendModeFromString","ik","constraintMap","targetName","transform","positionModeFromString","spacingModeFromString","rotateModeFromString","skinMap","entryName","readAttachment","linkedMesh","inheritDeform","eventName","eventMap","intValue","floatValue","stringValue","audioPath","volume","balance","animationMap","readAnimation","map","box","readVertices","LinkedMesh","weights","scaledVertices","timelineName","timelineMap","valueMap","readCurve","timelineScale","deformName","deformMap","weighted","deformLength","verticesValue","drawOrderNode","draworder","slotCount","drawOrderMap","offsets","unchanged","originalIndex","unchangedIndex","offsetMap","eventData","prop","str","Region","BoundingBox","Mesh","Path","Point","Clipping","SkeletonBinary","binary","BinaryInput","readString","readFloat","nonessential","readBoolean","readInt","strings","TransformModeValues","readInt32","readStringRef","BlendModeValues","readByte","PositionModeValues","SpacingModeValues","RotateModeValues","readSkin","typeIndex","AttachmentTypeValues","readFloatArray","readShortArray","endSlotIndex","Vertices","bonesArray","readShort","tempColor1","tempColor2","timelineType","SLOT_ATTACHMENT","SLOT_COLOR","SLOT_TWO_COLOR","BONE_ROTATE","BONE_TRANSLATE","BONE_SCALE","BONE_SHEAR","PATH_POSITION","PATH_SPACING","PATH_MIX","iii","nnn","vn","drawOrderCount","offsetCount","eventCount","CURVE_STEPPED","CURVE_BEZIER","CURVE_LINEAR","buffer","DataView","getInt8","getInt16","getInt32","optimizePositive","result","byteCount","chars","String","fromCharCode","getFloat32","SpineLoader","Loader","resourceManager","AssetPromise","resolve","reject","resource","urls","checkUrl","getResouceFromUrl","checkUrls","getResouceFromUrls","assetManager","autoLoadTexture","createAdaptiveTexture","skeletonFile","atlasFile","textureFile","textureAssetPicker","atlasLoader","isBinFile","Entity","addComponent","AdaptiveTexture","getExtFromUrl","ext","queryStringPos","_this_getResouceFromUrls","resourceLoader","Texture2D","setImageSource","generateMipmaps","filterMode","TextureFilterMode","Trilinear","Bilinear","wrapModeU","wrapModeV","jsonData","Promise","_ext","enableMacro","_spriteDefaultMaterial","log"],"mappings":"2aAAA,SAASA,EAAkBC,EAAQC,GAC/B,IAAK,IAAIC,EAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CACnC,IAAIE,EAAaH,EAAMC,GACvBE,EAAWC,WAAaD,EAAWC,aAAc,EACjDD,EAAWE,cAAe,EAEtB,UAAWF,IAAYA,EAAWG,UAAW,GAEjDC,OAAOC,eAAeT,EAAQI,EAAWM,IAAKN,EACjD,CACL,CACO,SAASO,EAAcC,EAAaC,EAAYC,GAInD,OAHID,GAAYd,EAAkBa,EAAYG,UAAWF,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BI17B,YAAM07B,EAGClxC,EAAwBm1B,gBAC5Bn1B,EAAAA,EAAAA,KAAAA,KAAAA,IAAAA,MACD0Y,QAAU,IAAI84B,EAAUrc,EAAQn1B,EAAKkR,MAAOlR,EAAKmR,QACtDpG,EAAK2N,QAAQ+4B,eAAezxC,GAC5B+K,EAAK2N,QAAQg5B,oBAPJR,EAAAA,EAAAA,GAAAA,IAAAA,EAAAA,EAAAA,UAAAA,OAUXn6B,EAAAA,WAAAA,SAAWC,EAAgBC,GACrBD,IAAc1B,EAAcU,QAC9Bnf,KAAK6hB,QAAQi5B,WAAaC,EAAkB/F,MACnC50B,IAAc3B,EAAcgB,mBACrCzf,KAAK6hB,QAAQi5B,WAAaC,EAAkBC,UAE5Ch7C,KAAK6hB,QAAQi5B,WAAaC,EAAkBE,QAEhD,EAGA56B,EAAAA,SAAAA,SAASC,EAAwBC,GAC/BvgB,KAAK6hB,QAAQq5B,UAAY56B,EACzBtgB,KAAK6hB,QAAQs5B,UAAY56B,CAC3B,EAEAC,EAAAA,QAAAA,aA1BW65B,EA6BV,CA7BkC17B,ICtG9B,IAAMoyB,GAAW,eAExBzP,QAAQma,IAAK,2BAA0B1K"}
1
+ {"version":3,"file":"module.js","sources":["../node_modules/_@swc_helpers@0.5.1@@swc/helpers/esm/_create_class.js","../node_modules/_@swc_helpers@0.5.1@@swc/helpers/esm/_extends.js","../node_modules/_@swc_helpers@0.5.1@@swc/helpers/esm/_set_prototype_of.js","../node_modules/_@swc_helpers@0.5.1@@swc/helpers/esm/_inherits.js","../node_modules/_tslib@2.6.0@tslib/tslib.es6.js","../node_modules/_@swc_helpers@0.5.1@@swc/helpers/esm/_instanceof.js","../src/spine-core/Utils.ts","../src/spine-core/BoneData.ts","../src/spine-core/Bone.ts","../src/spine-core/PathConstraintData.ts","../src/spine-core/Slot.ts","../src/spine-core/IkConstraint.ts","../src/spine-core/TransformConstraint.ts","../src/spine-core/ConstraintData.ts","../src/spine-core/attachments/Attachment.ts","../node_modules/_@swc_helpers@0.5.1@@swc/helpers/esm/_assert_this_initialized.js","../src/spine-core/attachments/PathAttachment.ts","../src/spine-core/PathConstraint.ts","../src/spine-core/attachments/RegionAttachment.ts","../src/spine-core/Texture.ts","../src/spine-core/Animation.ts","../src/spine-core/TextureAtlas.ts","../src/spine-core/attachments/MeshAttachment.ts","../src/spine-core/Skeleton.ts","../src/spine-core/AnimationState.ts","../src/spine-core/AnimationStateData.ts","../src/spine-core/attachments/ClippingAttachment.ts","../src/spine-core/Triangulator.ts","../src/spine-core/SkeletonClipping.ts","../src/core/SpineMesh.ts","../src/core/MeshGenerator.ts","../src/SpineMaterial.ts","../src/SpineAnimation.ts","../node_modules/_@swc_helpers@0.5.1@@swc/helpers/esm/_array_like_to_array.js","../node_modules/_@swc_helpers@0.5.1@@swc/helpers/esm/_create_for_of_iterator_helper_loose.js","../node_modules/_@swc_helpers@0.5.1@@swc/helpers/esm/_unsupported_iterable_to_array.js","../src/spine-core/AssetManager.ts","../src/spine-core/BlendMode.ts","../src/spine-core/attachments/BoundingBoxAttachment.ts","../src/spine-core/attachments/PointAttachment.ts","../src/spine-core/AtlasAttachmentLoader.ts","../src/spine-core/SkeletonData.ts","../src/spine-core/SlotData.ts","../src/spine-core/IkConstraintData.ts","../src/spine-core/TransformConstraintData.ts","../src/spine-core/Skin.ts","../src/spine-core/EventData.ts","../src/spine-core/Event.ts","../src/spine-core/attachments/AttachmentType.ts","../src/spine-core/SkeletonJson.ts","../src/spine-core/SkeletonBinary.ts","../src/SpineLoader.ts","../src/AntGSpineLoader.ts","../src/index.ts"],"sourcesContent":["function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n\n if (\"value\" in descriptor) descriptor.writable = true;\n\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\nexport function _create_class(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n\n return Constructor;\n}\nexport { _create_class as _ };\n","export function _extends() {\n _extends = Object.assign || function assign(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\nexport { _extends as _ };\n","export function _set_prototype_of(o, p) {\n _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {\n o.__proto__ = p;\n\n return o;\n };\n\n return _set_prototype_of(o, p);\n}\nexport { _set_prototype_of as _ };\n","import { _set_prototype_of } from \"./_set_prototype_of.js\";\n\nexport function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });\n\n if (superClass) _set_prototype_of(subClass, superClass);\n}\nexport { _inherits as _ };\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\") throw new TypeError(\"Object expected.\");\r\n var dispose;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n function next() {\r\n while (env.stack.length) {\r\n var rec = env.stack.pop();\r\n try {\r\n var result = rec.dispose && rec.dispose.call(rec.value);\r\n if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport default {\r\n __extends,\r\n __assign,\r\n __rest,\r\n __decorate,\r\n __param,\r\n __metadata,\r\n __awaiter,\r\n __generator,\r\n __createBinding,\r\n __exportStar,\r\n __values,\r\n __read,\r\n __spread,\r\n __spreadArrays,\r\n __spreadArray,\r\n __await,\r\n __asyncGenerator,\r\n __asyncDelegator,\r\n __asyncValues,\r\n __makeTemplateObject,\r\n __importStar,\r\n __importDefault,\r\n __classPrivateFieldGet,\r\n __classPrivateFieldSet,\r\n __classPrivateFieldIn,\r\n __addDisposableResource,\r\n __disposeResources,\r\n};\r\n","export function _instanceof(left, right) {\n if (right != null && typeof Symbol !== \"undefined\" && right[Symbol.hasInstance]) {\n return !!right[Symbol.hasInstance](left);\n } else return left instanceof right;\n}\nexport { _instanceof as _ };\n","\r\n\r\nimport { MixBlend } from \"./Animation\";\r\nimport { Skeleton } from \"./Skeleton\";\r\n\r\n\r\nexport interface Map<T> {\r\n\t[key: string]: T;\r\n}\r\n\r\nexport class IntSet {\r\n\tarray = new Array<number>();\r\n\r\n\tadd (value: number): boolean {\r\n\t\tlet contains = this.contains(value);\r\n\t\tthis.array[value | 0] = value | 0;\r\n\t\treturn !contains;\r\n\t}\r\n\r\n\tcontains (value: number) {\r\n\t\treturn this.array[value | 0] != undefined;\r\n\t}\r\n\r\n\tremove (value: number) {\r\n\t\tthis.array[value | 0] = undefined;\r\n\t}\r\n\r\n\tclear () {\r\n\t\tthis.array.length = 0;\r\n\t}\r\n}\r\n\r\nexport interface Disposable {\r\n\tdispose (): void;\r\n}\r\n\r\nexport interface Restorable {\r\n\trestore (): void;\r\n}\r\n\r\nexport class Color {\r\n\tpublic static WHITE = new Color(1, 1, 1, 1);\r\n\tpublic static RED = new Color(1, 0, 0, 1);\r\n\tpublic static GREEN = new Color(0, 1, 0, 1);\r\n\tpublic static BLUE = new Color(0, 0, 1, 1);\r\n\tpublic static MAGENTA = new Color(1, 0, 1, 1);\r\n\r\n\tconstructor (public r: number = 0, public g: number = 0, public b: number = 0, public a: number = 0) {\r\n\t}\r\n\r\n\tset (r: number, g: number, b: number, a: number) {\r\n\t\tthis.r = r;\r\n\t\tthis.g = g;\r\n\t\tthis.b = b;\r\n\t\tthis.a = a;\r\n\t\tthis.clamp();\r\n\t\treturn this;\r\n\t}\r\n\r\n\tsetFromColor (c: Color) {\r\n\t\tthis.r = c.r;\r\n\t\tthis.g = c.g;\r\n\t\tthis.b = c.b;\r\n\t\tthis.a = c.a;\r\n\t\treturn this;\r\n\t}\r\n\r\n\tsetFromString (hex: string) {\r\n\t\thex = hex.charAt(0) == '#' ? hex.substr(1) : hex;\r\n\t\tthis.r = parseInt(hex.substr(0, 2), 16) / 255.0;\r\n\t\tthis.g = parseInt(hex.substr(2, 2), 16) / 255.0;\r\n\t\tthis.b = parseInt(hex.substr(4, 2), 16) / 255.0;\r\n\t\tthis.a = (hex.length != 8 ? 255 : parseInt(hex.substr(6, 2), 16)) / 255.0;\r\n\t\treturn this;\r\n\t}\r\n\r\n\tadd (r: number, g: number, b: number, a: number) {\r\n\t\tthis.r += r;\r\n\t\tthis.g += g;\r\n\t\tthis.b += b;\r\n\t\tthis.a += a;\r\n\t\tthis.clamp();\r\n\t\treturn this;\r\n\t}\r\n\r\n\tclamp () {\r\n\t\tif (this.r < 0) this.r = 0;\r\n\t\telse if (this.r > 1) this.r = 1;\r\n\r\n\t\tif (this.g < 0) this.g = 0;\r\n\t\telse if (this.g > 1) this.g = 1;\r\n\r\n\t\tif (this.b < 0) this.b = 0;\r\n\t\telse if (this.b > 1) this.b = 1;\r\n\r\n\t\tif (this.a < 0) this.a = 0;\r\n\t\telse if (this.a > 1) this.a = 1;\r\n\t\treturn this;\r\n\t}\r\n\r\n\tstatic rgba8888ToColor(color: Color, value: number) {\r\n\t\tcolor.r = ((value & 0xff000000) >>> 24) / 255;\r\n\t\tcolor.g = ((value & 0x00ff0000) >>> 16) / 255;\r\n\t\tcolor.b = ((value & 0x0000ff00) >>> 8) / 255;\r\n\t\tcolor.a = ((value & 0x000000ff)) / 255;\r\n\t}\r\n\r\n\tstatic rgb888ToColor (color: Color, value: number) {\r\n\t\tcolor.r = ((value & 0x00ff0000) >>> 16) / 255;\r\n\t\tcolor.g = ((value & 0x0000ff00) >>> 8) / 255;\r\n\t\tcolor.b = ((value & 0x000000ff)) / 255;\r\n\t}\r\n}\r\n\r\nexport class MathUtils {\r\n\tstatic PI = 3.1415927;\r\n\tstatic PI2 = MathUtils.PI * 2;\r\n\tstatic radiansToDegrees = 180 / MathUtils.PI;\r\n\tstatic radDeg = MathUtils.radiansToDegrees;\r\n\tstatic degreesToRadians = MathUtils.PI / 180;\r\n\tstatic degRad = MathUtils.degreesToRadians;\r\n\r\n\tstatic clamp (value: number, min: number, max: number) {\r\n\t\tif (value < min) return min;\r\n\t\tif (value > max) return max;\r\n\t\treturn value;\r\n\t}\r\n\r\n\tstatic cosDeg (degrees: number) {\r\n\t\treturn Math.cos(degrees * MathUtils.degRad);\r\n\t}\r\n\r\n\tstatic sinDeg (degrees: number) {\r\n\t\treturn Math.sin(degrees * MathUtils.degRad);\r\n\t}\r\n\r\n\tstatic signum (value: number): number {\r\n\t\treturn value > 0 ? 1 : value < 0 ? -1 : 0;\r\n\t}\r\n\r\n\tstatic toInt (x: number) {\r\n\t\treturn x > 0 ? Math.floor(x) : Math.ceil(x);\r\n\t}\r\n\r\n\tstatic cbrt (x: number) {\r\n\t\tlet y = Math.pow(Math.abs(x), 1/3);\r\n\t\treturn x < 0 ? -y : y;\r\n\t}\r\n\r\n\tstatic randomTriangular (min: number, max: number): number {\r\n\t\treturn MathUtils.randomTriangularWith(min, max, (min + max) * 0.5);\r\n\t}\r\n\r\n\tstatic randomTriangularWith (min: number, max: number, mode: number): number {\r\n\t\tlet u = Math.random();\r\n\t\tlet d = max - min;\r\n\t\tif (u <= (mode - min) / d) return min + Math.sqrt(u * d * (mode - min));\r\n\t\treturn max - Math.sqrt((1 - u) * d * (max - mode));\r\n\t}\r\n}\r\n\r\nexport abstract class Interpolation {\r\n\tprotected abstract applyInternal (a: number): number;\r\n\tapply(start: number, end: number, a: number): number {\r\n\t\treturn start + (end - start) * this.applyInternal(a);\r\n\t}\r\n}\r\n\r\nexport class Pow extends Interpolation {\r\n\tprotected power = 2;\r\n\r\n\tconstructor (power: number) {\r\n\t\tsuper();\r\n\t\tthis.power = power;\r\n\t}\r\n\r\n\tapplyInternal (a: number): number {\r\n\t\tif (a <= 0.5) return Math.pow(a * 2, this.power) / 2;\r\n\t\treturn Math.pow((a - 1) * 2, this.power) / (this.power % 2 == 0 ? -2 : 2) + 1;\r\n\t}\r\n}\r\n\r\nexport class PowOut extends Pow {\r\n\tconstructor (power: number) {\r\n\t\tsuper(power);\r\n\t}\r\n\r\n\tapplyInternal (a: number) : number {\r\n\t\treturn Math.pow(a - 1, this.power) * (this.power % 2 == 0 ? -1 : 1) + 1;\r\n\t}\r\n}\r\n\r\nexport class Utils {\r\n\tstatic SUPPORTS_TYPED_ARRAYS = typeof(Float32Array) !== \"undefined\";\r\n\r\n\tstatic arrayCopy<T> (source: ArrayLike<T>, sourceStart: number, dest: ArrayLike<T>, destStart: number, numElements: number) {\r\n\t\tfor (let i = sourceStart, j = destStart; i < sourceStart + numElements; i++, j++) {\r\n\t\t\tdest[j] = source[i];\r\n\t\t}\r\n\t}\r\n\r\n\tstatic setArraySize<T> (array: Array<T>, size: number, value: any = 0): Array<T> {\r\n\t\tlet oldSize = array.length;\r\n\t\tif (oldSize == size) return array;\r\n\t\tarray.length = size;\r\n\t\tif (oldSize < size) {\r\n\t\t\tfor (let i = oldSize; i < size; i++) array[i] = value;\r\n\t\t}\r\n\t\treturn array;\r\n\t}\r\n\r\n\tstatic ensureArrayCapacity<T> (array: Array<T>, size: number, value: any = 0): Array<T> {\r\n\t\tif (array.length >= size) return array;\r\n\t\treturn Utils.setArraySize(array, size, value);\r\n\t}\r\n\r\n\tstatic newArray<T> (size: number, defaultValue: T): Array<T> {\r\n\t\tlet array = new Array<T>(size);\r\n\t\tfor (let i = 0; i < size; i++) array[i] = defaultValue;\r\n\t\treturn array;\r\n\t}\r\n\r\n\tstatic newFloatArray (size: number): ArrayLike<number> {\r\n\t\tif (Utils.SUPPORTS_TYPED_ARRAYS) {\r\n\t\t\treturn new Float32Array(size)\r\n\t\t} else {\r\n\t\t\t\tlet array = new Array<number>(size);\r\n\t\t\t\tfor (let i = 0; i < array.length; i++) array[i] = 0;\r\n\t\t\t\treturn array;\r\n\t\t}\r\n\t}\r\n\r\n\tstatic newShortArray (size: number): ArrayLike<number> {\r\n\t\tif (Utils.SUPPORTS_TYPED_ARRAYS) {\r\n\t\t\treturn new Int16Array(size)\r\n\t\t} else {\r\n\t\t\t\tlet array = new Array<number>(size);\r\n\t\t\t\tfor (let i = 0; i < array.length; i++) array[i] = 0;\r\n\t\t\t\treturn array;\r\n\t\t}\r\n\t}\r\n\r\n\tstatic toFloatArray (array: Array<number>) {\r\n\t\treturn Utils.SUPPORTS_TYPED_ARRAYS ? new Float32Array(array) : array;\r\n\t}\r\n\r\n\tstatic toSinglePrecision (value: number) {\r\n\t\treturn Utils.SUPPORTS_TYPED_ARRAYS ? Math.fround(value) : value;\r\n\t}\r\n\r\n\t// This function is used to fix WebKit 602 specific issue described at http://esotericsoftware.com/forum/iOS-10-disappearing-graphics-10109\r\n\tstatic webkit602BugfixHelper (alpha: number, blend: MixBlend) {\r\n\r\n\t}\r\n\r\n\tstatic contains<T> (array: Array<T>, element: T, identity = true) {\r\n\t\tfor (var i = 0; i < array.length; i++) {\r\n\t\t\tif (array[i] == element) return true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nexport class DebugUtils {\r\n\tstatic logBones(skeleton: Skeleton) {\r\n\t\tfor (let i = 0; i < skeleton.bones.length; i++) {\r\n\t\t\tlet bone = skeleton.bones[i];\r\n\t\t\tconsole.log(bone.data.name + \", \" + bone.a + \", \" + bone.b + \", \" + bone.c + \", \" + bone.d + \", \" + bone.worldX + \", \" + bone.worldY);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport class Pool<T> {\r\n\tprivate items = new Array<T>();\r\n\tprivate instantiator: () => T;\r\n\r\n\tconstructor (instantiator: () => T) {\r\n\t\tthis.instantiator = instantiator;\r\n\t}\r\n\r\n\tobtain () {\r\n\t\treturn this.items.length > 0 ? this.items.pop() : this.instantiator();\r\n\t}\r\n\r\n\tfree (item: T) {\r\n\t\tif ((item as any).reset) (item as any).reset();\r\n\t\tthis.items.push(item);\r\n\t}\r\n\r\n\tfreeAll (items: ArrayLike<T>) {\r\n\t\tfor (let i = 0; i < items.length; i++) {\r\n\t\t\tthis.free(items[i]);\r\n\t\t}\r\n\t}\r\n\r\n\tclear () {\r\n\t\tthis.items.length = 0;\r\n\t}\r\n}\r\n\r\nexport class Vector2 {\r\n\tconstructor (public x = 0, public y = 0) {\r\n\t}\r\n\r\n\tset (x: number, y: number): Vector2 {\r\n\t\tthis.x = x;\r\n\t\tthis.y = y;\r\n\t\treturn this;\r\n\t}\r\n\r\n\tlength () {\r\n\t\tlet x = this.x;\r\n\t\tlet y = this.y;\r\n\t\treturn Math.sqrt(x * x + y * y);\r\n\t}\r\n\r\n\tnormalize () {\r\n\t\tlet len = this.length();\r\n\t\tif (len != 0) {\r\n\t\t\tthis.x /= len;\r\n\t\t\tthis.y /= len;\r\n\t\t}\r\n\t\treturn this;\r\n\t}\r\n}\r\n\r\nexport class TimeKeeper {\r\n\tmaxDelta = 0.064;\r\n\tframesPerSecond = 0;\r\n\tdelta = 0;\r\n\ttotalTime = 0;\r\n\r\n\tprivate lastTime = Date.now() / 1000;\r\n\tprivate frameCount = 0;\r\n\tprivate frameTime = 0;\r\n\r\n\tupdate () {\r\n\t\tlet now = Date.now() / 1000;\r\n\t\tthis.delta = now - this.lastTime;\r\n\t\tthis.frameTime += this.delta;\r\n\t\tthis.totalTime += this.delta;\r\n\t\tif (this.delta > this.maxDelta) this.delta = this.maxDelta;\r\n\t\tthis.lastTime = now;\r\n\r\n\t\tthis.frameCount++;\r\n\t\tif (this.frameTime > 1) {\r\n\t\t\tthis.framesPerSecond = this.frameCount / this.frameTime;\r\n\t\t\tthis.frameTime = 0;\r\n\t\t\tthis.frameCount = 0;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport interface ArrayLike<T> {\r\n\tlength: number;\r\n\t[n: number]: T;\r\n}\r\n\r\nexport class WindowedMean {\r\n\tvalues: Array<number>;\r\n\taddedValues = 0;\r\n\tlastValue = 0;\r\n\tmean = 0;\r\n\tdirty = true;\r\n\r\n\tconstructor (windowSize: number = 32) {\r\n\t\tthis.values = new Array<number>(windowSize);\r\n\t}\r\n\r\n\thasEnoughData () {\r\n\t\treturn this.addedValues >= this.values.length;\r\n\t}\r\n\r\n\taddValue (value: number) {\r\n\t\tif (this.addedValues < this.values.length)\r\n\t\t\tthis.addedValues++;\r\n\t\tthis.values[this.lastValue++] = value;\r\n\t\tif (this.lastValue > this.values.length - 1) this.lastValue = 0;\r\n\t\tthis.dirty = true;\r\n\t}\r\n\r\n\tgetMean () {\r\n\t\tif (this.hasEnoughData()) {\r\n\t\t\tif (this.dirty) {\r\n\t\t\t\tlet mean = 0;\r\n\t\t\t\tfor (let i = 0; i < this.values.length; i++) {\r\n\t\t\t\t\tmean += this.values[i];\r\n\t\t\t\t}\r\n\t\t\t\tthis.mean = mean / this.values.length;\r\n\t\t\t\tthis.dirty = false;\r\n\t\t\t}\r\n\t\t\treturn this.mean;\r\n\t\t} else {\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t}\r\n}\r\n","\r\n\r\nimport { Color } from \"./Utils\";\r\n\r\n\r\n\r\n\t/** Stores the setup pose for a {@link Bone}. */\r\n\texport class BoneData {\r\n\t\t/** The index of the bone in {@link Skeleton#getBones()}. */\r\n\t\tindex: number;\r\n\r\n\t\t/** The name of the bone, which is unique across all bones in the skeleton. */\r\n\t\tname: string;\r\n\r\n\t\t/** @returns May be null. */\r\n\t\tparent: BoneData;\r\n\r\n\t\t/** The bone's length. */\r\n\t\tlength: number;\r\n\r\n\t\t/** The local x translation. */\r\n\t\tx = 0;\r\n\r\n\t\t/** The local y translation. */\r\n\t\ty = 0;\r\n\r\n\t\t/** The local rotation. */\r\n\t\trotation = 0;\r\n\r\n\t\t/** The local scaleX. */\r\n\t\tscaleX = 1;\r\n\r\n\t\t/** The local scaleY. */\r\n\t\tscaleY = 1;\r\n\r\n\t\t/** The local shearX. */\r\n\t\tshearX = 0;\r\n\r\n\t\t/** The local shearX. */\r\n\t\tshearY = 0;\r\n\r\n\t\t/** The transform mode for how parent world transforms affect this bone. */\r\n\t\ttransformMode = TransformMode.Normal;\r\n\r\n\t\t/** When true, {@link Skeleton#updateWorldTransform()} only updates this bone if the {@link Skeleton#skin} contains this\r\n\t \t* bone.\r\n\t \t* @see Skin#bones */\r\n\t\tskinRequired = false;\r\n\r\n\t\t/** The color of the bone as it was in Spine. Available only when nonessential data was exported. Bones are not usually\r\n\t\t * rendered at runtime. */\r\n\t\tcolor = new Color();\r\n\r\n\t\tconstructor (index: number, name: string, parent: BoneData) {\r\n\t\t\tif (index < 0) throw new Error(\"index must be >= 0.\");\r\n\t\t\tif (name == null) throw new Error(\"name cannot be null.\");\r\n\t\t\tthis.index = index;\r\n\t\t\tthis.name = name;\r\n\t\t\tthis.parent = parent;\r\n\t\t}\r\n\t}\r\n\r\n\t/** Determines how a bone inherits world transforms from parent bones. */\r\n\texport enum TransformMode {\r\n\t\tNormal, OnlyTranslation, NoRotationOrReflection, NoScale, NoScaleOrReflection\r\n\t}\r\n","\r\n\r\nimport { Updatable } from \"./Updatable\";\r\nimport { BoneData, TransformMode } from \"./BoneData\";\r\nimport { Skeleton } from \"./Skeleton\";\r\nimport { MathUtils, Vector2 } from \"./Utils\";\r\n\r\n\r\n/** Stores a bone's current pose.\r\n *\r\n * A bone has a local transform which is used to compute its world transform. A bone also has an applied transform, which is a\r\n * local transform that can be applied to compute the world transform. The local transform and applied transform may differ if a\r\n * constraint or application code modifies the world transform after it was computed from the local transform. */\r\nexport class Bone implements Updatable {\r\n\t/** The bone's setup pose data. */\r\n\tdata: BoneData;\r\n\r\n\t/** The skeleton this bone belongs to. */\r\n\tskeleton: Skeleton;\r\n\r\n\t/** The parent bone, or null if this is the root bone. */\r\n\tparent: Bone;\r\n\r\n\t/** The immediate children of this bone. */\r\n\tchildren = new Array<Bone>();\r\n\r\n\t/** The local x translation. */\r\n\tx = 0;\r\n\r\n\t/** The local y translation. */\r\n\ty = 0;\r\n\r\n\t/** The local rotation in degrees, counter clockwise. */\r\n\trotation = 0;\r\n\r\n\t/** The local scaleX. */\r\n\tscaleX = 0;\r\n\r\n\t/** The local scaleY. */\r\n\tscaleY = 0;\r\n\r\n\t/** The local shearX. */\r\n\tshearX = 0;\r\n\r\n\t/** The local shearY. */\r\n\tshearY = 0;\r\n\r\n\t/** The applied local x translation. */\r\n\tax = 0;\r\n\r\n\t/** The applied local y translation. */\r\n\tay = 0;\r\n\r\n\t/** The applied local rotation in degrees, counter clockwise. */\r\n\tarotation = 0;\r\n\r\n\t/** The applied local scaleX. */\r\n\tascaleX = 0;\r\n\r\n\t/** The applied local scaleY. */\r\n\tascaleY = 0;\r\n\r\n\t/** The applied local shearX. */\r\n\tashearX = 0;\r\n\r\n\t/** The applied local shearY. */\r\n\tashearY = 0;\r\n\r\n\t/** If true, the applied transform matches the world transform. If false, the world transform has been modified since it was\r\n\t* computed and {@link #updateAppliedTransform()} must be called before accessing the applied transform. */\r\n\tappliedValid = false;\r\n\r\n\t/** Part of the world transform matrix for the X axis. If changed, {@link #appliedValid} should be set to false. */\r\n\ta = 0;\r\n\r\n\t/** Part of the world transform matrix for the Y axis. If changed, {@link #appliedValid} should be set to false. */\r\n\tb = 0;\r\n\r\n\t/** Part of the world transform matrix for the X axis. If changed, {@link #appliedValid} should be set to false. */\r\n\tc = 0;\r\n\r\n\t/** Part of the world transform matrix for the Y axis. If changed, {@link #appliedValid} should be set to false. */\r\n\td = 0;\r\n\r\n\t/** The world X position. If changed, {@link #appliedValid} should be set to false. */\r\n\tworldY = 0;\r\n\r\n\t/** The world Y position. If changed, {@link #appliedValid} should be set to false. */\r\n\tworldX = 0;\r\n\r\n\tsorted = false;\r\n\tactive = false;\r\n\r\n\t/** @param parent May be null. */\r\n\tconstructor (data: BoneData, skeleton: Skeleton, parent: Bone) {\r\n\t\tif (data == null) throw new Error(\"data cannot be null.\");\r\n\t\tif (skeleton == null) throw new Error(\"skeleton cannot be null.\");\r\n\t\tthis.data = data;\r\n\t\tthis.skeleton = skeleton;\r\n\t\tthis.parent = parent;\r\n\t\tthis.setToSetupPose();\r\n\t}\r\n\r\n\t/** Returns false when the bone has not been computed because {@link BoneData#skinRequired} is true and the\r\n\t* {@link Skeleton#skin active skin} does not {@link Skin#bones contain} this bone. */\r\n\tisActive () {\r\n\t\treturn this.active;\r\n\t}\r\n\r\n\t/** Same as {@link #updateWorldTransform()}. This method exists for Bone to implement {@link Updatable}. */\r\n\tupdate () {\r\n\t\tthis.updateWorldTransformWith(this.x, this.y, this.rotation, this.scaleX, this.scaleY, this.shearX, this.shearY);\r\n\t}\r\n\r\n\t/** Computes the world transform using the parent bone and this bone's local transform.\r\n\t *\r\n\t * See {@link #updateWorldTransformWith()}. */\r\n\tupdateWorldTransform () {\r\n\t\tthis.updateWorldTransformWith(this.x, this.y, this.rotation, this.scaleX, this.scaleY, this.shearX, this.shearY);\r\n\t}\r\n\r\n\t/** Computes the world transform using the parent bone and the specified local transform. Child bones are not updated.\r\n\t *\r\n\t * See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine\r\n\t * Runtimes Guide. */\r\n\tupdateWorldTransformWith (x: number, y: number, rotation: number, scaleX: number, scaleY: number, shearX: number, shearY: number) {\r\n\t\tthis.ax = x;\r\n\t\tthis.ay = y;\r\n\t\tthis.arotation = rotation;\r\n\t\tthis.ascaleX = scaleX;\r\n\t\tthis.ascaleY = scaleY;\r\n\t\tthis.ashearX = shearX;\r\n\t\tthis.ashearY = shearY;\r\n\t\tthis.appliedValid = true;\r\n\r\n\t\tlet parent = this.parent;\r\n\t\tif (parent == null) { // Root bone.\r\n\t\t\tlet skeleton = this.skeleton;\r\n\t\t\tlet rotationY = rotation + 90 + shearY;\r\n\t\t\tlet sx = skeleton.scaleX;\r\n\t\t\tlet sy = skeleton.scaleY;\r\n\t\t\tthis.a = MathUtils.cosDeg(rotation + shearX) * scaleX * sx;\r\n\t\t\tthis.b = MathUtils.cosDeg(rotationY) * scaleY * sx;\r\n\t\t\tthis.c = MathUtils.sinDeg(rotation + shearX) * scaleX * sy;\r\n\t\t\tthis.d = MathUtils.sinDeg(rotationY) * scaleY * sy;\r\n\t\t\tthis.worldX = x * sx + skeleton.x;\r\n\t\t\tthis.worldY = y * sy + skeleton.y;\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;\r\n\t\tthis.worldX = pa * x + pb * y + parent.worldX;\r\n\t\tthis.worldY = pc * x + pd * y + parent.worldY;\r\n\r\n\t\tswitch (this.data.transformMode) {\r\n\t\tcase TransformMode.Normal: {\r\n\t\t\tlet rotationY = rotation + 90 + shearY;\r\n\t\t\tlet la = MathUtils.cosDeg(rotation + shearX) * scaleX;\r\n\t\t\tlet lb = MathUtils.cosDeg(rotationY) * scaleY;\r\n\t\t\tlet lc = MathUtils.sinDeg(rotation + shearX) * scaleX;\r\n\t\t\tlet ld = MathUtils.sinDeg(rotationY) * scaleY;\r\n\t\t\tthis.a = pa * la + pb * lc;\r\n\t\t\tthis.b = pa * lb + pb * ld;\r\n\t\t\tthis.c = pc * la + pd * lc;\r\n\t\t\tthis.d = pc * lb + pd * ld;\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tcase TransformMode.OnlyTranslation: {\r\n\t\t\tlet rotationY = rotation + 90 + shearY;\r\n\t\t\tthis.a = MathUtils.cosDeg(rotation + shearX) * scaleX;\r\n\t\t\tthis.b = MathUtils.cosDeg(rotationY) * scaleY;\r\n\t\t\tthis.c = MathUtils.sinDeg(rotation + shearX) * scaleX;\r\n\t\t\tthis.d = MathUtils.sinDeg(rotationY) * scaleY;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase TransformMode.NoRotationOrReflection: {\r\n\t\t\tlet s = pa * pa + pc * pc;\r\n\t\t\tlet prx = 0;\r\n\t\t\tif (s > 0.0001) {\r\n\t\t\t\ts = Math.abs(pa * pd - pb * pc) / s;\r\n\t\t\t\tpa /= this.skeleton.scaleX;\r\n\t\t\t\tpc /= this.skeleton.scaleY;\r\n\t\t\t\tpb = pc * s;\r\n\t\t\t\tpd = pa * s;\r\n\t\t\t\tprx = Math.atan2(pc, pa) * MathUtils.radDeg;\r\n\t\t\t} else {\r\n\t\t\t\tpa = 0;\r\n\t\t\t\tpc = 0;\r\n\t\t\t\tprx = 90 - Math.atan2(pd, pb) * MathUtils.radDeg;\r\n\t\t\t}\r\n\t\t\tlet rx = rotation + shearX - prx;\r\n\t\t\tlet ry = rotation + shearY - prx + 90;\r\n\t\t\tlet la = MathUtils.cosDeg(rx) * scaleX;\r\n\t\t\tlet lb = MathUtils.cosDeg(ry) * scaleY;\r\n\t\t\tlet lc = MathUtils.sinDeg(rx) * scaleX;\r\n\t\t\tlet ld = MathUtils.sinDeg(ry) * scaleY;\r\n\t\t\tthis.a = pa * la - pb * lc;\r\n\t\t\tthis.b = pa * lb - pb * ld;\r\n\t\t\tthis.c = pc * la + pd * lc;\r\n\t\t\tthis.d = pc * lb + pd * ld;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase TransformMode.NoScale:\r\n\t\tcase TransformMode.NoScaleOrReflection: {\r\n\t\t\tlet cos = MathUtils.cosDeg(rotation);\r\n\t\t\tlet sin = MathUtils.sinDeg(rotation);\r\n\t\t\tlet za = (pa * cos + pb * sin) / this.skeleton.scaleX;\r\n\t\t\tlet zc = (pc * cos + pd * sin) / this.skeleton.scaleY;\r\n\t\t\tlet s = Math.sqrt(za * za + zc * zc);\r\n\t\t\tif (s > 0.00001) s = 1 / s;\r\n\t\t\tza *= s;\r\n\t\t\tzc *= s;\r\n\t\t\ts = Math.sqrt(za * za + zc * zc);\r\n\t\t\tif (this.data.transformMode == TransformMode.NoScale\r\n\t\t\t\t&& (pa * pd - pb * pc < 0) != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0)) s = -s;\r\n\t\t\tlet r = Math.PI / 2 + Math.atan2(zc, za);\r\n\t\t\tlet zb = Math.cos(r) * s;\r\n\t\t\tlet zd = Math.sin(r) * s;\r\n\t\t\tlet la = MathUtils.cosDeg(shearX) * scaleX;\r\n\t\t\tlet lb = MathUtils.cosDeg(90 + shearY) * scaleY;\r\n\t\t\tlet lc = MathUtils.sinDeg(shearX) * scaleX;\r\n\t\t\tlet ld = MathUtils.sinDeg(90 + shearY) * scaleY;\r\n\t\t\tthis.a = za * la + zb * lc;\r\n\t\t\tthis.b = za * lb + zb * ld;\r\n\t\t\tthis.c = zc * la + zd * lc;\r\n\t\t\tthis.d = zc * lb + zd * ld;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\t}\r\n\t\tthis.a *= this.skeleton.scaleX;\r\n\t\tthis.b *= this.skeleton.scaleX;\r\n\t\tthis.c *= this.skeleton.scaleY;\r\n\t\tthis.d *= this.skeleton.scaleY;\r\n\t}\r\n\r\n\t/** Sets this bone's local transform to the setup pose. */\r\n\tsetToSetupPose () {\r\n\t\tlet data = this.data;\r\n\t\tthis.x = data.x;\r\n\t\tthis.y = data.y;\r\n\t\tthis.rotation = data.rotation;\r\n\t\tthis.scaleX = data.scaleX;\r\n\t\tthis.scaleY = data.scaleY;\r\n\t\tthis.shearX = data.shearX;\r\n\t\tthis.shearY = data.shearY;\r\n\t}\r\n\r\n\t/** The world rotation for the X axis, calculated using {@link #a} and {@link #c}. */\r\n\tgetWorldRotationX () {\r\n\t\treturn Math.atan2(this.c, this.a) * MathUtils.radDeg;\r\n\t}\r\n\r\n\t/** The world rotation for the Y axis, calculated using {@link #b} and {@link #d}. */\r\n\tgetWorldRotationY () {\r\n\t\treturn Math.atan2(this.d, this.b) * MathUtils.radDeg;\r\n\t}\r\n\r\n\t/** The magnitude (always positive) of the world scale X, calculated using {@link #a} and {@link #c}. */\r\n\tgetWorldScaleX () {\r\n\t\treturn Math.sqrt(this.a * this.a + this.c * this.c);\r\n\t}\r\n\r\n\t/** The magnitude (always positive) of the world scale Y, calculated using {@link #b} and {@link #d}. */\r\n\tgetWorldScaleY () {\r\n\t\treturn Math.sqrt(this.b * this.b + this.d * this.d);\r\n\t}\r\n\r\n\t/** Computes the applied transform values from the world transform. This allows the applied transform to be accessed after the\r\n\t * world transform has been modified (by a constraint, {@link #rotateWorld()}, etc).\r\n\t *\r\n\t * If {@link #updateWorldTransform()} has been called for a bone and {@link #appliedValid} is false, then\r\n\t * {@link #updateAppliedTransform()} must be called before accessing the applied transform.\r\n\t *\r\n\t * Some information is ambiguous in the world transform, such as -1,-1 scale versus 180 rotation. The applied transform after\r\n\t * calling this method is equivalent to the local tranform used to compute the world transform, but may not be identical. */\r\n\tupdateAppliedTransform () {\r\n\t\tthis.appliedValid = true;\r\n\t\tlet parent = this.parent;\r\n\t\tif (parent == null) {\r\n\t\t\tthis.ax = this.worldX;\r\n\t\t\tthis.ay = this.worldY;\r\n\t\t\tthis.arotation = Math.atan2(this.c, this.a) * MathUtils.radDeg;\r\n\t\t\tthis.ascaleX = Math.sqrt(this.a * this.a + this.c * this.c);\r\n\t\t\tthis.ascaleY = Math.sqrt(this.b * this.b + this.d * this.d);\r\n\t\t\tthis.ashearX = 0;\r\n\t\t\tthis.ashearY = Math.atan2(this.a * this.b + this.c * this.d, this.a * this.d - this.b * this.c) * MathUtils.radDeg;\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tlet pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;\r\n\t\tlet pid = 1 / (pa * pd - pb * pc);\r\n\t\tlet dx = this.worldX - parent.worldX, dy = this.worldY - parent.worldY;\r\n\t\tthis.ax = (dx * pd * pid - dy * pb * pid);\r\n\t\tthis.ay = (dy * pa * pid - dx * pc * pid);\r\n\t\tlet ia = pid * pd;\r\n\t\tlet id = pid * pa;\r\n\t\tlet ib = pid * pb;\r\n\t\tlet ic = pid * pc;\r\n\t\tlet ra = ia * this.a - ib * this.c;\r\n\t\tlet rb = ia * this.b - ib * this.d;\r\n\t\tlet rc = id * this.c - ic * this.a;\r\n\t\tlet rd = id * this.d - ic * this.b;\r\n\t\tthis.ashearX = 0;\r\n\t\tthis.ascaleX = Math.sqrt(ra * ra + rc * rc);\r\n\t\tif (this.ascaleX > 0.0001) {\r\n\t\t\tlet det = ra * rd - rb * rc;\r\n\t\t\tthis.ascaleY = det / this.ascaleX;\r\n\t\t\tthis.ashearY = Math.atan2(ra * rb + rc * rd, det) * MathUtils.radDeg;\r\n\t\t\tthis.arotation = Math.atan2(rc, ra) * MathUtils.radDeg;\r\n\t\t} else {\r\n\t\t\tthis.ascaleX = 0;\r\n\t\t\tthis.ascaleY = Math.sqrt(rb * rb + rd * rd);\r\n\t\t\tthis.ashearY = 0;\r\n\t\t\tthis.arotation = 90 - Math.atan2(rd, rb) * MathUtils.radDeg;\r\n\t\t}\r\n\t}\r\n\r\n\t/** Transforms a point from world coordinates to the bone's local coordinates. */\r\n\tworldToLocal (world: Vector2) {\r\n\t\tlet a = this.a, b = this.b, c = this.c, d = this.d;\r\n\t\tlet invDet = 1 / (a * d - b * c);\r\n\t\tlet x = world.x - this.worldX, y = world.y - this.worldY;\r\n\t\tworld.x = (x * d * invDet - y * b * invDet);\r\n\t\tworld.y = (y * a * invDet - x * c * invDet);\r\n\t\treturn world;\r\n\t}\r\n\r\n\t/** Transforms a point from the bone's local coordinates to world coordinates. */\r\n\tlocalToWorld (local: Vector2) {\r\n\t\tlet x = local.x, y = local.y;\r\n\t\tlocal.x = x * this.a + y * this.b + this.worldX;\r\n\t\tlocal.y = x * this.c + y * this.d + this.worldY;\r\n\t\treturn local;\r\n\t}\r\n\r\n\t/** Transforms a world rotation to a local rotation. */\r\n\tworldToLocalRotation (worldRotation: number) {\r\n\t\tlet sin = MathUtils.sinDeg(worldRotation), cos = MathUtils.cosDeg(worldRotation);\r\n\t\treturn Math.atan2(this.a * sin - this.c * cos, this.d * cos - this.b * sin) * MathUtils.radDeg + this.rotation - this.shearX;\r\n\t}\r\n\r\n\t/** Transforms a local rotation to a world rotation. */\r\n\tlocalToWorldRotation (localRotation: number) {\r\n\t\tlocalRotation -= this.rotation - this.shearX;\r\n\t\tlet sin = MathUtils.sinDeg(localRotation), cos = MathUtils.cosDeg(localRotation);\r\n\t\treturn Math.atan2(cos * this.c + sin * this.d, cos * this.a + sin * this.b) * MathUtils.radDeg;\r\n\t}\r\n\r\n\t/** Rotates the world transform the specified amount and sets {@link #appliedValid} to false.\r\n\t * {@link #updateWorldTransform()} will need to be called on any child bones, recursively, and any constraints reapplied. */\r\n\trotateWorld (degrees: number) {\r\n\t\tlet a = this.a, b = this.b, c = this.c, d = this.d;\r\n\t\tlet cos = MathUtils.cosDeg(degrees), sin = MathUtils.sinDeg(degrees);\r\n\t\tthis.a = cos * a - sin * c;\r\n\t\tthis.b = cos * b - sin * d;\r\n\t\tthis.c = sin * a + cos * c;\r\n\t\tthis.d = sin * b + cos * d;\r\n\t\tthis.appliedValid = false;\r\n\t}\r\n}\r\n","\r\n\r\nimport { ConstraintData } from \"./ConstraintData\";\r\nimport { BoneData } from \"./BoneData\";\r\nimport { SlotData } from \"./SlotData\";\r\n\r\n\r\n\r\n\t/** Stores the setup pose for a {@link PathConstraint}.\r\n\t *\r\n\t * See [Path constraints](http://esotericsoftware.com/spine-path-constraints) in the Spine User Guide. */\r\n\texport class PathConstraintData extends ConstraintData {\r\n\r\n\t\t/** The bones that will be modified by this path constraint. */\r\n\t\tbones = new Array<BoneData>();\r\n\r\n\t\t/** The slot whose path attachment will be used to constrained the bones. */\r\n\t\ttarget: SlotData;\r\n\r\n\t\t/** The mode for positioning the first bone on the path. */\r\n\t\tpositionMode: PositionMode;\r\n\r\n\t\t/** The mode for positioning the bones after the first bone on the path. */\r\n\t\tspacingMode: SpacingMode;\r\n\r\n\t\t/** The mode for adjusting the rotation of the bones. */\r\n\t\trotateMode: RotateMode;\r\n\r\n\t\t/** An offset added to the constrained bone rotation. */\r\n\t\toffsetRotation: number;\r\n\r\n\t\t/** The position along the path. */\r\n\t\tposition: number;\r\n\r\n\t\t/** The spacing between bones. */\r\n\t\tspacing: number;\r\n\r\n\t\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */\r\n\t\trotateMix: number;\r\n\r\n\t\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained translations. */\r\n\t\ttranslateMix: number;\r\n\r\n\t\tconstructor (name: string) {\r\n\t\t\tsuper(name, 0, false);\r\n\t\t}\r\n\t}\r\n\r\n\t/** Controls how the first bone is positioned along the path.\r\n\t *\r\n\t * See [Position mode](http://esotericsoftware.com/spine-path-constraints#Position-mode) in the Spine User Guide. */\r\n\texport enum PositionMode {\r\n\t\tFixed, Percent\r\n\t}\r\n\r\n\t/** Controls how bones after the first bone are positioned along the path.\r\n\t *\r\n\t * [Spacing mode](http://esotericsoftware.com/spine-path-constraints#Spacing-mode) in the Spine User Guide. */\r\n\texport enum SpacingMode {\r\n\t\tLength, Fixed, Percent\r\n\t}\r\n\r\n\t/** Controls how bones are rotated, translated, and scaled to match the path.\r\n\t *\r\n\t * [Rotate mode](http://esotericsoftware.com/spine-path-constraints#Rotate-mod) in the Spine User Guide. */\r\n\texport enum RotateMode {\r\n\t\tTangent, Chain, ChainScale\r\n\t}\r\n","\r\n\r\nimport { SlotData } from \"./SlotData\";\r\nimport { Bone } from \"./Bone\";\r\nimport { Color } from \"./Utils\";\r\nimport { Attachment } from \"./attachments/Attachment\";\r\nimport { Skeleton } from \"./Skeleton\";\r\n\r\n\r\n\r\n/** Stores a slot's current pose. Slots organize attachments for {@link Skeleton#drawOrder} purposes and provide a place to store\r\n * state for an attachment. State cannot be stored in an attachment itself because attachments are stateless and may be shared\r\n * across multiple skeletons. */\r\nexport class Slot {\r\n\t/** The slot's setup pose data. */\r\n\tdata: SlotData;\r\n\r\n\t/** The bone this slot belongs to. */\r\n\tbone: Bone;\r\n\r\n\t/** The color used to tint the slot's attachment. If {@link #getDarkColor()} is set, this is used as the light color for two\r\n\t * color tinting. */\r\n\tcolor: Color;\r\n\r\n\t/** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark\r\n\t * color's alpha is not used. */\r\n\tdarkColor: Color;\r\n\r\n\tattachment: Attachment;\r\n\r\n\tprivate attachmentTime: number;\r\n\r\n\tattachmentState: number;\r\n\r\n\t/** Values to deform the slot's attachment. For an unweighted mesh, the entries are local positions for each vertex. For a\r\n\t * weighted mesh, the entries are an offset for each vertex which will be added to the mesh's local vertex positions.\r\n\t *\r\n\t * See {@link VertexAttachment#computeWorldVertices()} and {@link DeformTimeline}. */\r\n\tdeform = new Array<number>();\r\n\r\n\tconstructor (data: SlotData, bone: Bone) {\r\n\t\tif (data == null) throw new Error(\"data cannot be null.\");\r\n\t\tif (bone == null) throw new Error(\"bone cannot be null.\");\r\n\t\tthis.data = data;\r\n\t\tthis.bone = bone;\r\n\t\tthis.color = new Color();\r\n\t\tthis.darkColor = data.darkColor == null ? null : new Color();\r\n\t\tthis.setToSetupPose();\r\n\t}\r\n\r\n\t/** The skeleton this slot belongs to. */\r\n\tgetSkeleton (): Skeleton {\r\n\t\treturn this.bone.skeleton;\r\n\t}\r\n\r\n\t/** The current attachment for the slot, or null if the slot has no attachment. */\r\n\tgetAttachment (): Attachment {\r\n\t\treturn this.attachment;\r\n\t}\r\n\r\n\t/** Sets the slot's attachment and, if the attachment changed, resets {@link #attachmentTime} and clears {@link #deform}.\r\n\t * @param attachment May be null. */\r\n\tsetAttachment (attachment: Attachment) {\r\n\t\tif (this.attachment == attachment) return;\r\n\t\tthis.attachment = attachment;\r\n\t\tthis.attachmentTime = this.bone.skeleton.time;\r\n\t\tthis.deform.length = 0;\r\n\t}\r\n\r\n\tsetAttachmentTime (time: number) {\r\n\t\tthis.attachmentTime = this.bone.skeleton.time - time;\r\n\t}\r\n\r\n\t/** The time that has elapsed since the last time the attachment was set or cleared. Relies on Skeleton\r\n\t * {@link Skeleton#time}. */\r\n\tgetAttachmentTime (): number {\r\n\t\treturn this.bone.skeleton.time - this.attachmentTime;\r\n\t}\r\n\r\n\t/** Sets this slot to the setup pose. */\r\n\tsetToSetupPose () {\r\n\t\tthis.color.setFromColor(this.data.color);\r\n\t\tif (this.darkColor != null) this.darkColor.setFromColor(this.data.darkColor);\r\n\t\tif (this.data.attachmentName == null)\r\n\t\t\tthis.attachment = null;\r\n\t\telse {\r\n\t\t\tthis.attachment = null;\r\n\t\t\tthis.setAttachment(this.bone.skeleton.getAttachment(this.data.index, this.data.attachmentName));\r\n\t\t}\r\n\t}\r\n}\r\n","\r\n\r\nimport { Updatable } from \"./Updatable\";\r\nimport { IkConstraintData } from \"./IkConstraintData\";\r\nimport { Bone } from \"./Bone\";\r\nimport { Skeleton } from \"./Skeleton\";\r\nimport { TransformMode } from \"./BoneData\";\r\nimport { MathUtils } from \"./Utils\";\r\n\r\n\r\n\r\n\t/** Stores the current pose for an IK constraint. An IK constraint adjusts the rotation of 1 or 2 constrained bones so the tip of\r\n\t * the last bone is as close to the target bone as possible.\r\n\t *\r\n\t * See [IK constraints](http://esotericsoftware.com/spine-ik-constraints) in the Spine User Guide. */\r\n\texport class IkConstraint implements Updatable {\r\n\t\t/** The IK constraint's setup pose data. */\r\n\t\tdata: IkConstraintData;\r\n\r\n\t\t/** The bones that will be modified by this IK constraint. */\r\n\t\tbones: Array<Bone>;\r\n\r\n\t\t/** The bone that is the IK target. */\r\n\t\ttarget: Bone;\r\n\r\n\t\t/** Controls the bend direction of the IK bones, either 1 or -1. */\r\n\t\tbendDirection = 0;\r\n\r\n\t\t/** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */\r\n\t\tcompress = false;\r\n\r\n\t\t/** When true, if the target is out of range, the parent bone is scaled to reach it. If more than one bone is being constrained\r\n\t\t * and the parent bone has local nonuniform scale, stretch is not applied. */\r\n\t\tstretch = false;\r\n\r\n\t\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */\r\n\t\tmix = 1;\r\n\r\n\t\t/** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */\r\n\t\tsoftness = 0;\r\n\t\tactive = false;\r\n\r\n\t\tconstructor (data: IkConstraintData, skeleton: Skeleton) {\r\n\t\t\tif (data == null) throw new Error(\"data cannot be null.\");\r\n\t\t\tif (skeleton == null) throw new Error(\"skeleton cannot be null.\");\r\n\t\t\tthis.data = data;\r\n\t\t\tthis.mix = data.mix;\r\n\t\t\tthis.softness = data.softness;\r\n\t\t\tthis.bendDirection = data.bendDirection;\r\n\t\t\tthis.compress = data.compress;\r\n\t\t\tthis.stretch = data.stretch;\r\n\r\n\t\t\tthis.bones = new Array<Bone>();\r\n\t\t\tfor (let i = 0; i < data.bones.length; i++)\r\n\t\t\t\tthis.bones.push(skeleton.findBone(data.bones[i].name));\r\n\t\t\tthis.target = skeleton.findBone(data.target.name);\r\n\t\t}\r\n\r\n\t\tisActive () {\r\n\t\t\treturn this.active;\r\n\t\t}\r\n\r\n\t\t/** Applies the constraint to the constrained bones. */\r\n\t\tapply () {\r\n\t\t\tthis.update();\r\n\t\t}\r\n\r\n\t\tupdate () {\r\n\t\t\tlet target = this.target;\r\n\t\t\tlet bones = this.bones;\r\n\t\t\tswitch (bones.length) {\r\n\t\t\tcase 1:\r\n\t\t\t\tthis.apply1(bones[0], target.worldX, target.worldY, this.compress, this.stretch, this.data.uniform, this.mix);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 2:\r\n\t\t\t\tthis.apply2(bones[0], bones[1], target.worldX, target.worldY, this.bendDirection, this.stretch, this.softness, this.mix);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t/** Applies 1 bone IK. The target is specified in the world coordinate system. */\r\n\t\tapply1 (bone: Bone, targetX: number, targetY: number, compress: boolean, stretch: boolean, uniform: boolean, alpha: number) {\r\n\t\t\tif (!bone.appliedValid) bone.updateAppliedTransform();\r\n\t\t\tlet p = bone.parent;\r\n\r\n\t\t\tlet pa = p.a, pb = p.b, pc = p.c, pd = p.d;\r\n\t\t\tlet rotationIK = -bone.ashearX - bone.arotation, tx = 0, ty = 0;\r\n\r\n\t\t\tswitch(bone.data.transformMode) {\r\n\t\t\t\tcase TransformMode.OnlyTranslation:\r\n\t\t\t\t\ttx = targetX - bone.worldX;\r\n\t\t\t\t\tty = targetY - bone.worldY;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase TransformMode.NoRotationOrReflection:\r\n\t\t\t\t\tlet s = Math.abs(pa * pd - pb * pc) / (pa * pa + pc * pc);\r\n\t\t\t\t\tlet sa = pa / bone.skeleton.scaleX;\r\n\t\t\t\t\tlet sc = pc / bone.skeleton.scaleY;\r\n\t\t\t\t\tpb = -sc * s * bone.skeleton.scaleX;\r\n\t\t\t\t\tpd = sa * s * bone.skeleton.scaleY;\r\n\t\t\t\t\trotationIK += Math.atan2(sc, sa) * MathUtils.radDeg;\r\n\t\t\t\t\t// Fall through\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tlet x = targetX - p.worldX, y = targetY - p.worldY;\r\n\t\t\t\t\tlet d = pa * pd - pb * pc;\r\n\t\t\t\t\ttx = (x * pd - y * pb) / d - bone.ax;\r\n\t\t\t\t\tty = (y * pa - x * pc) / d - bone.ay;\r\n\t\t\t}\r\n\t\t\trotationIK += Math.atan2(ty, tx) * MathUtils.radDeg;\r\n\t\t\tif (bone.ascaleX < 0) rotationIK += 180;\r\n\t\t\tif (rotationIK > 180)\r\n\t\t\t\trotationIK -= 360;\r\n\t\t\telse if (rotationIK < -180) rotationIK += 360;\r\n\t\t\tlet sx = bone.ascaleX, sy = bone.ascaleY;\r\n\t\t\tif (compress || stretch) {\r\n\t\t\t\tswitch (bone.data.transformMode) {\r\n\t\t\t\t\tcase TransformMode.NoScale:\r\n\t\t\t\t\tcase TransformMode.NoScaleOrReflection:\r\n\t\t\t\t\t\ttx = targetX - bone.worldX;\r\n\t\t\t\t\t\tty = targetY - bone.worldY;\r\n\t\t\t\t}\r\n\t\t\t\tlet b = bone.data.length * sx, dd = Math.sqrt(tx * tx + ty * ty);\r\n\t\t\t\tif ((compress && dd < b) || (stretch && dd > b) && b > 0.0001) {\r\n\t\t\t\t\tlet s = (dd / b - 1) * alpha + 1;\r\n\t\t\t\t\tsx *= s;\r\n\t\t\t\t\tif (uniform) sy *= s;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbone.updateWorldTransformWith(bone.ax, bone.ay, bone.arotation + rotationIK * alpha, sx, sy, bone.ashearX,\r\n\t\t\t\tbone.ashearY);\r\n\t\t}\r\n\r\n\t\t/** Applies 2 bone IK. The target is specified in the world coordinate system.\r\n\t\t * @param child A direct descendant of the parent bone. */\r\n\t\tapply2 (parent: Bone, child: Bone, targetX: number, targetY: number, bendDir: number, stretch: boolean, softness: number, alpha: number) {\r\n\t\t\tif (alpha == 0) {\r\n\t\t\t\tchild.updateWorldTransform();\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tif (!parent.appliedValid) parent.updateAppliedTransform();\r\n\t\t\tif (!child.appliedValid) child.updateAppliedTransform();\r\n\t\t\tlet px = parent.ax, py = parent.ay, psx = parent.ascaleX, sx = psx, psy = parent.ascaleY, csx = child.ascaleX;\r\n\t\t\tlet os1 = 0, os2 = 0, s2 = 0;\r\n\t\t\tif (psx < 0) {\r\n\t\t\t\tpsx = -psx;\r\n\t\t\t\tos1 = 180;\r\n\t\t\t\ts2 = -1;\r\n\t\t\t} else {\r\n\t\t\t\tos1 = 0;\r\n\t\t\t\ts2 = 1;\r\n\t\t\t}\r\n\t\t\tif (psy < 0) {\r\n\t\t\t\tpsy = -psy;\r\n\t\t\t\ts2 = -s2;\r\n\t\t\t}\r\n\t\t\tif (csx < 0) {\r\n\t\t\t\tcsx = -csx;\r\n\t\t\t\tos2 = 180;\r\n\t\t\t} else\r\n\t\t\t\tos2 = 0;\r\n\t\t\tlet cx = child.ax, cy = 0, cwx = 0, cwy = 0, a = parent.a, b = parent.b, c = parent.c, d = parent.d;\r\n\t\t\tlet u = Math.abs(psx - psy) <= 0.0001;\r\n\t\t\tif (!u) {\r\n\t\t\t\tcy = 0;\r\n\t\t\t\tcwx = a * cx + parent.worldX;\r\n\t\t\t\tcwy = c * cx + parent.worldY;\r\n\t\t\t} else {\r\n\t\t\t\tcy = child.ay;\r\n\t\t\t\tcwx = a * cx + b * cy + parent.worldX;\r\n\t\t\t\tcwy = c * cx + d * cy + parent.worldY;\r\n\t\t\t}\r\n\t\t\tlet pp = parent.parent;\r\n\t\t\ta = pp.a;\r\n\t\t\tb = pp.b;\r\n\t\t\tc = pp.c;\r\n\t\t\td = pp.d;\r\n\t\t\tlet id = 1 / (a * d - b * c), x = cwx - pp.worldX, y = cwy - pp.worldY;\r\n\t\t\tlet dx = (x * d - y * b) * id - px, dy = (y * a - x * c) * id - py;\r\n\t\t\tlet l1 = Math.sqrt(dx * dx + dy * dy), l2 = child.data.length * csx, a1, a2;\r\n\t\t\tif (l1 < 0.0001) {\r\n\t\t\t\tthis.apply1(parent, targetX, targetY, false, stretch, false, alpha);\r\n\t\t\t\tchild.updateWorldTransformWith(cx, cy, 0, child.ascaleX, child.ascaleY, child.ashearX, child.ashearY);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tx = targetX - pp.worldX;\r\n\t\t\ty = targetY - pp.worldY;\r\n\t\t\tlet tx = (x * d - y * b) * id - px, ty = (y * a - x * c) * id - py;\r\n\t\t\tlet dd = tx * tx + ty * ty;\r\n\t\t\tif (softness != 0) {\r\n\t\t\t\tsoftness *= psx * (csx + 1) / 2;\r\n\t\t\t\tlet td = Math.sqrt(dd), sd = td - l1 - l2 * psx + softness;\r\n\t\t\t\tif (sd > 0) {\r\n\t\t\t\t\tlet p = Math.min(1, sd / (softness * 2)) - 1;\r\n\t\t\t\t\tp = (sd - softness * (1 - p * p)) / td;\r\n\t\t\t\t\ttx -= p * tx;\r\n\t\t\t\t\tty -= p * ty;\r\n\t\t\t\t\tdd = tx * tx + ty * ty;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\touter:\r\n\t\t\tif (u) {\r\n\t\t\t\tl2 *= psx;\r\n\t\t\t\tlet cos = (dd - l1 * l1 - l2 * l2) / (2 * l1 * l2);\r\n\t\t\t\tif (cos < -1)\r\n\t\t\t\t\tcos = -1;\r\n\t\t\t\telse if (cos > 1) {\r\n\t\t\t\t\tcos = 1;\r\n\t\t\t\t\tif (stretch) sx *= (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;\r\n\t\t\t\t}\r\n\t\t\t\ta2 = Math.acos(cos) * bendDir;\r\n\t\t\t\ta = l1 + l2 * cos;\r\n\t\t\t\tb = l2 * Math.sin(a2);\r\n\t\t\t\ta1 = Math.atan2(ty * a - tx * b, tx * a + ty * b);\r\n\t\t\t} else {\r\n\t\t\t\ta = psx * l2;\r\n\t\t\t\tb = psy * l2;\r\n\t\t\t\tlet aa = a * a, bb = b * b, ta = Math.atan2(ty, tx);\r\n\t\t\t\tc = bb * l1 * l1 + aa * dd - aa * bb;\r\n\t\t\t\tlet c1 = -2 * bb * l1, c2 = bb - aa;\r\n\t\t\t\td = c1 * c1 - 4 * c2 * c;\r\n\t\t\t\tif (d >= 0) {\r\n\t\t\t\t\tlet q = Math.sqrt(d);\r\n\t\t\t\t\tif (c1 < 0) q = -q;\r\n\t\t\t\t\tq = -(c1 + q) / 2;\r\n\t\t\t\t\tlet r0 = q / c2, r1 = c / q;\r\n\t\t\t\t\tlet r = Math.abs(r0) < Math.abs(r1) ? r0 : r1;\r\n\t\t\t\t\tif (r * r <= dd) {\r\n\t\t\t\t\t\ty = Math.sqrt(dd - r * r) * bendDir;\r\n\t\t\t\t\t\ta1 = ta - Math.atan2(y, r);\r\n\t\t\t\t\t\ta2 = Math.atan2(y / psy, (r - l1) / psx);\r\n\t\t\t\t\t\tbreak outer;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tlet minAngle = MathUtils.PI, minX = l1 - a, minDist = minX * minX, minY = 0;\r\n\t\t\t\tlet maxAngle = 0, maxX = l1 + a, maxDist = maxX * maxX, maxY = 0;\r\n\t\t\t\tc = -a * l1 / (aa - bb);\r\n\t\t\t\tif (c >= -1 && c <= 1) {\r\n\t\t\t\t\tc = Math.acos(c);\r\n\t\t\t\t\tx = a * Math.cos(c) + l1;\r\n\t\t\t\t\ty = b * Math.sin(c);\r\n\t\t\t\t\td = x * x + y * y;\r\n\t\t\t\t\tif (d < minDist) {\r\n\t\t\t\t\t\tminAngle = c;\r\n\t\t\t\t\t\tminDist = d;\r\n\t\t\t\t\t\tminX = x;\r\n\t\t\t\t\t\tminY = y;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (d > maxDist) {\r\n\t\t\t\t\t\tmaxAngle = c;\r\n\t\t\t\t\t\tmaxDist = d;\r\n\t\t\t\t\t\tmaxX = x;\r\n\t\t\t\t\t\tmaxY = y;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif (dd <= (minDist + maxDist) / 2) {\r\n\t\t\t\t\ta1 = ta - Math.atan2(minY * bendDir, minX);\r\n\t\t\t\t\ta2 = minAngle * bendDir;\r\n\t\t\t\t} else {\r\n\t\t\t\t\ta1 = ta - Math.atan2(maxY * bendDir, maxX);\r\n\t\t\t\t\ta2 = maxAngle * bendDir;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tlet os = Math.atan2(cy, cx) * s2;\r\n\t\t\tlet rotation = parent.arotation;\r\n\t\t\ta1 = (a1 - os) * MathUtils.radDeg + os1 - rotation;\r\n\t\t\tif (a1 > 180)\r\n\t\t\t\ta1 -= 360;\r\n\t\t\telse if (a1 < -180) a1 += 360;\r\n\t\t\tparent.updateWorldTransformWith(px, py, rotation + a1 * alpha, sx, parent.ascaleY, 0, 0);\r\n\t\t\trotation = child.arotation;\r\n\t\t\ta2 = ((a2 + os) * MathUtils.radDeg - child.ashearX) * s2 + os2 - rotation;\r\n\t\t\tif (a2 > 180)\r\n\t\t\t\ta2 -= 360;\r\n\t\t\telse if (a2 < -180) a2 += 360;\r\n\t\t\tchild.updateWorldTransformWith(cx, cy, rotation + a2 * alpha, child.ascaleX, child.ascaleY, child.ashearX, child.ashearY);\r\n\t\t}\r\n\t}\r\n","\r\n\r\nimport { Updatable } from \"./Updatable\";\r\nimport { TransformConstraintData } from \"./TransformConstraintData\";\r\nimport { Bone } from \"./Bone\";\r\nimport { Skeleton } from \"./Skeleton\";\r\nimport { MathUtils, Vector2 } from \"./Utils\";\r\n\r\n\r\n\r\n/** Stores the current pose for a transform constraint. A transform constraint adjusts the world transform of the constrained\r\n * bones to match that of the target bone.\r\n *\r\n * See [Transform constraints](http://esotericsoftware.com/spine-transform-constraints) in the Spine User Guide. */\r\nexport class TransformConstraint implements Updatable {\r\n\r\n\t/** The transform constraint's setup pose data. */\r\n\tdata: TransformConstraintData;\r\n\r\n\t/** The bones that will be modified by this transform constraint. */\r\n\tbones: Array<Bone>;\r\n\r\n\t/** The target bone whose world transform will be copied to the constrained bones. */\r\n\ttarget: Bone;\r\n\r\n\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */\r\n\trotateMix = 0;\r\n\r\n\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained translations. */\r\n\ttranslateMix = 0;\r\n\r\n\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained scales. */\r\n\tscaleMix = 0;\r\n\r\n\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained scales. */\r\n\tshearMix = 0;\r\n\r\n\ttemp = new Vector2();\r\n\tactive = false;\r\n\r\n\tconstructor (data: TransformConstraintData, skeleton: Skeleton) {\r\n\t\tif (data == null) throw new Error(\"data cannot be null.\");\r\n\t\tif (skeleton == null) throw new Error(\"skeleton cannot be null.\");\r\n\t\tthis.data = data;\r\n\t\tthis.rotateMix = data.rotateMix;\r\n\t\tthis.translateMix = data.translateMix;\r\n\t\tthis.scaleMix = data.scaleMix;\r\n\t\tthis.shearMix = data.shearMix;\r\n\t\tthis.bones = new Array<Bone>();\r\n\t\tfor (let i = 0; i < data.bones.length; i++)\r\n\t\t\tthis.bones.push(skeleton.findBone(data.bones[i].name));\r\n\t\tthis.target = skeleton.findBone(data.target.name);\r\n\t}\r\n\r\n\tisActive () {\r\n\t\treturn this.active;\r\n\t}\r\n\r\n\t/** Applies the constraint to the constrained bones. */\r\n\tapply () {\r\n\t\tthis.update();\r\n\t}\r\n\r\n\tupdate () {\r\n\t\tif (this.data.local) {\r\n\t\t\tif (this.data.relative)\r\n\t\t\t\tthis.applyRelativeLocal();\r\n\t\t\telse\r\n\t\t\t\tthis.applyAbsoluteLocal();\r\n\r\n\t\t} else {\r\n\t\t\tif (this.data.relative)\r\n\t\t\t\tthis.applyRelativeWorld();\r\n\t\t\telse\r\n\t\t\t\tthis.applyAbsoluteWorld();\r\n\t\t}\r\n\t}\r\n\r\n\tapplyAbsoluteWorld () {\r\n\t\tlet rotateMix = this.rotateMix, translateMix = this.translateMix, scaleMix = this.scaleMix, shearMix = this.shearMix;\r\n\t\tlet target = this.target;\r\n\t\tlet ta = target.a, tb = target.b, tc = target.c, td = target.d;\r\n\t\tlet degRadReflect = ta * td - tb * tc > 0 ? MathUtils.degRad : -MathUtils.degRad;\r\n\t\tlet offsetRotation = this.data.offsetRotation * degRadReflect;\r\n\t\tlet offsetShearY = this.data.offsetShearY * degRadReflect;\r\n\t\tlet bones = this.bones;\r\n\t\tfor (let i = 0, n = bones.length; i < n; i++) {\r\n\t\t\tlet bone = bones[i];\r\n\t\t\tlet modified = false;\r\n\r\n\t\t\tif (rotateMix != 0) {\r\n\t\t\t\tlet a = bone.a, b = bone.b, c = bone.c, d = bone.d;\r\n\t\t\t\tlet r = Math.atan2(tc, ta) - Math.atan2(c, a) + offsetRotation;\r\n\t\t\t\tif (r > MathUtils.PI)\r\n\t\t\t\t\tr -= MathUtils.PI2;\r\n\t\t\t\telse if (r < -MathUtils.PI)\r\n\t\t\t\t\tr += MathUtils.PI2;\r\n\t\t\t\tr *= rotateMix;\r\n\t\t\t\tlet cos = Math.cos(r), sin = Math.sin(r);\r\n\t\t\t\tbone.a = cos * a - sin * c;\r\n\t\t\t\tbone.b = cos * b - sin * d;\r\n\t\t\t\tbone.c = sin * a + cos * c;\r\n\t\t\t\tbone.d = sin * b + cos * d;\r\n\t\t\t\tmodified = true;\r\n\t\t\t}\r\n\r\n\t\t\tif (translateMix != 0) {\r\n\t\t\t\tlet temp = this.temp;\r\n\t\t\t\ttarget.localToWorld(temp.set(this.data.offsetX, this.data.offsetY));\r\n\t\t\t\tbone.worldX += (temp.x - bone.worldX) * translateMix;\r\n\t\t\t\tbone.worldY += (temp.y - bone.worldY) * translateMix;\r\n\t\t\t\tmodified = true;\r\n\t\t\t}\r\n\r\n\t\t\tif (scaleMix > 0) {\r\n\t\t\t\tlet s = Math.sqrt(bone.a * bone.a + bone.c * bone.c);\r\n\t\t\t\tlet ts = Math.sqrt(ta * ta + tc * tc);\r\n\t\t\t\tif (s > 0.00001) s = (s + (ts - s + this.data.offsetScaleX) * scaleMix) / s;\r\n\t\t\t\tbone.a *= s;\r\n\t\t\t\tbone.c *= s;\r\n\t\t\t\ts = Math.sqrt(bone.b * bone.b + bone.d * bone.d);\r\n\t\t\t\tts = Math.sqrt(tb * tb + td * td);\r\n\t\t\t\tif (s > 0.00001) s = (s + (ts - s + this.data.offsetScaleY) * scaleMix) / s;\r\n\t\t\t\tbone.b *= s;\r\n\t\t\t\tbone.d *= s;\r\n\t\t\t\tmodified = true;\r\n\t\t\t}\r\n\r\n\t\t\tif (shearMix > 0) {\r\n\t\t\t\tlet b = bone.b, d = bone.d;\r\n\t\t\t\tlet by = Math.atan2(d, b);\r\n\t\t\t\tlet r = Math.atan2(td, tb) - Math.atan2(tc, ta) - (by - Math.atan2(bone.c, bone.a));\r\n\t\t\t\tif (r > MathUtils.PI)\r\n\t\t\t\t\tr -= MathUtils.PI2;\r\n\t\t\t\telse if (r < -MathUtils.PI)\r\n\t\t\t\t\tr += MathUtils.PI2;\r\n\t\t\t\tr = by + (r + offsetShearY) * shearMix;\r\n\t\t\t\tlet s = Math.sqrt(b * b + d * d);\r\n\t\t\t\tbone.b = Math.cos(r) * s;\r\n\t\t\t\tbone.d = Math.sin(r) * s;\r\n\t\t\t\tmodified = true;\r\n\t\t\t}\r\n\r\n\t\t\tif (modified) bone.appliedValid = false;\r\n\t\t}\r\n\t}\r\n\r\n\tapplyRelativeWorld () {\r\n\t\tlet rotateMix = this.rotateMix, translateMix = this.translateMix, scaleMix = this.scaleMix, shearMix = this.shearMix;\r\n\t\tlet target = this.target;\r\n\t\tlet ta = target.a, tb = target.b, tc = target.c, td = target.d;\r\n\t\tlet degRadReflect = ta * td - tb * tc > 0 ? MathUtils.degRad : -MathUtils.degRad;\r\n\t\tlet offsetRotation = this.data.offsetRotation * degRadReflect, offsetShearY = this.data.offsetShearY * degRadReflect;\r\n\t\tlet bones = this.bones;\r\n\t\tfor (let i = 0, n = bones.length; i < n; i++) {\r\n\t\t\tlet bone = bones[i];\r\n\t\t\tlet modified = false;\r\n\r\n\t\t\tif (rotateMix != 0) {\r\n\t\t\t\tlet a = bone.a, b = bone.b, c = bone.c, d = bone.d;\r\n\t\t\t\tlet r = Math.atan2(tc, ta) + offsetRotation;\r\n\t\t\t\tif (r > MathUtils.PI)\r\n\t\t\t\t\tr -= MathUtils.PI2;\r\n\t\t\t\telse if (r < -MathUtils.PI) r += MathUtils.PI2;\r\n\t\t\t\tr *= rotateMix;\r\n\t\t\t\tlet cos = Math.cos(r), sin = Math.sin(r);\r\n\t\t\t\tbone.a = cos * a - sin * c;\r\n\t\t\t\tbone.b = cos * b - sin * d;\r\n\t\t\t\tbone.c = sin * a + cos * c;\r\n\t\t\t\tbone.d = sin * b + cos * d;\r\n\t\t\t\tmodified = true;\r\n\t\t\t}\r\n\r\n\t\t\tif (translateMix != 0) {\r\n\t\t\t\tlet temp = this.temp;\r\n\t\t\t\ttarget.localToWorld(temp.set(this.data.offsetX, this.data.offsetY));\r\n\t\t\t\tbone.worldX += temp.x * translateMix;\r\n\t\t\t\tbone.worldY += temp.y * translateMix;\r\n\t\t\t\tmodified = true;\r\n\t\t\t}\r\n\r\n\t\t\tif (scaleMix > 0) {\r\n\t\t\t\tlet s = (Math.sqrt(ta * ta + tc * tc) - 1 + this.data.offsetScaleX) * scaleMix + 1;\r\n\t\t\t\tbone.a *= s;\r\n\t\t\t\tbone.c *= s;\r\n\t\t\t\ts = (Math.sqrt(tb * tb + td * td) - 1 + this.data.offsetScaleY) * scaleMix + 1;\r\n\t\t\t\tbone.b *= s;\r\n\t\t\t\tbone.d *= s;\r\n\t\t\t\tmodified = true;\r\n\t\t\t}\r\n\r\n\t\t\tif (shearMix > 0) {\r\n\t\t\t\tlet r = Math.atan2(td, tb) - Math.atan2(tc, ta);\r\n\t\t\t\tif (r > MathUtils.PI)\r\n\t\t\t\t\tr -= MathUtils.PI2;\r\n\t\t\t\telse if (r < -MathUtils.PI) r += MathUtils.PI2;\r\n\t\t\t\tlet b = bone.b, d = bone.d;\r\n\t\t\t\tr = Math.atan2(d, b) + (r - MathUtils.PI / 2 + offsetShearY) * shearMix;\r\n\t\t\t\tlet s = Math.sqrt(b * b + d * d);\r\n\t\t\t\tbone.b = Math.cos(r) * s;\r\n\t\t\t\tbone.d = Math.sin(r) * s;\r\n\t\t\t\tmodified = true;\r\n\t\t\t}\r\n\r\n\t\t\tif (modified) bone.appliedValid = false;\r\n\t\t}\r\n\t}\r\n\r\n\tapplyAbsoluteLocal () {\r\n\t\tlet rotateMix = this.rotateMix, translateMix = this.translateMix, scaleMix = this.scaleMix, shearMix = this.shearMix;\r\n\t\tlet target = this.target;\r\n\t\tif (!target.appliedValid) target.updateAppliedTransform();\r\n\t\tlet bones = this.bones;\r\n\t\tfor (let i = 0, n = bones.length; i < n; i++) {\r\n\t\t\tlet bone = bones[i];\r\n\t\t\tif (!bone.appliedValid) bone.updateAppliedTransform();\r\n\r\n\t\t\tlet rotation = bone.arotation;\r\n\t\t\tif (rotateMix != 0) {\r\n\t\t\t\tlet r = target.arotation - rotation + this.data.offsetRotation;\r\n\t\t\t\tr -= (16384 - ((16384.499999999996 - r / 360) | 0)) * 360;\r\n\t\t\t\trotation += r * rotateMix;\r\n\t\t\t}\r\n\r\n\t\t\tlet x = bone.ax, y = bone.ay;\r\n\t\t\tif (translateMix != 0) {\r\n\t\t\t\tx += (target.ax - x + this.data.offsetX) * translateMix;\r\n\t\t\t\ty += (target.ay - y + this.data.offsetY) * translateMix;\r\n\t\t\t}\r\n\r\n\t\t\tlet scaleX = bone.ascaleX, scaleY = bone.ascaleY;\r\n\t\t\tif (scaleMix != 0) {\r\n\t\t\t\tif (scaleX > 0.00001) scaleX = (scaleX + (target.ascaleX - scaleX + this.data.offsetScaleX) * scaleMix) / scaleX;\r\n\t\t\t\tif (scaleY > 0.00001) scaleY = (scaleY + (target.ascaleY - scaleY + this.data.offsetScaleY) * scaleMix) / scaleY;\r\n\t\t\t}\r\n\r\n\t\t\tlet shearY = bone.ashearY;\r\n\t\t\tif (shearMix != 0) {\r\n\t\t\t\tlet r = target.ashearY - shearY + this.data.offsetShearY;\r\n\t\t\t\tr -= (16384 - ((16384.499999999996 - r / 360) | 0)) * 360;\r\n\t\t\t\tbone.shearY += r * shearMix;\r\n\t\t\t}\r\n\r\n\t\t\tbone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);\r\n\t\t}\r\n\t}\r\n\r\n\tapplyRelativeLocal () {\r\n\t\tlet rotateMix = this.rotateMix, translateMix = this.translateMix, scaleMix = this.scaleMix, shearMix = this.shearMix;\r\n\t\tlet target = this.target;\r\n\t\tif (!target.appliedValid) target.updateAppliedTransform();\r\n\t\tlet bones = this.bones;\r\n\t\tfor (let i = 0, n = bones.length; i < n; i++) {\r\n\t\t\tlet bone = bones[i];\r\n\t\t\tif (!bone.appliedValid) bone.updateAppliedTransform();\r\n\r\n\t\t\tlet rotation = bone.arotation;\r\n\t\t\tif (rotateMix != 0) rotation += (target.arotation + this.data.offsetRotation) * rotateMix;\r\n\r\n\t\t\tlet x = bone.ax, y = bone.ay;\r\n\t\t\tif (translateMix != 0) {\r\n\t\t\t\tx += (target.ax + this.data.offsetX) * translateMix;\r\n\t\t\t\ty += (target.ay + this.data.offsetY) * translateMix;\r\n\t\t\t}\r\n\r\n\t\t\tlet scaleX = bone.ascaleX, scaleY = bone.ascaleY;\r\n\t\t\tif (scaleMix != 0) {\r\n\t\t\t\tif (scaleX > 0.00001) scaleX *= ((target.ascaleX - 1 + this.data.offsetScaleX) * scaleMix) + 1;\r\n\t\t\t\tif (scaleY > 0.00001) scaleY *= ((target.ascaleY - 1 + this.data.offsetScaleY) * scaleMix) + 1;\r\n\t\t\t}\r\n\r\n\t\t\tlet shearY = bone.ashearY;\r\n\t\t\tif (shearMix != 0) shearY += (target.ashearY + this.data.offsetShearY) * shearMix;\r\n\r\n\t\t\tbone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);\r\n\t\t}\r\n\t}\r\n}\r\n","\n\n\n\t/** The base class for all constraint datas. */\n\texport abstract class ConstraintData {\n\t\tconstructor(public name: string, public order: number, public skinRequired: boolean) { }\n\t}\n","\r\n\r\nimport { Slot } from \"../Slot\";\r\nimport { Utils, ArrayLike } from \"../Utils\";\r\n\r\n/** The base class for all attachments. */\r\nexport abstract class Attachment {\r\n\tname: string;\r\n\r\n\tconstructor (name: string) {\r\n\t\tif (name == null) throw new Error(\"name cannot be null.\");\r\n\t\tthis.name = name;\r\n\t}\r\n\r\n\tabstract copy (): Attachment;\r\n}\r\n\r\n/** Base class for an attachment with vertices that are transformed by one or more bones and can be deformed by a slot's\r\n * {@link Slot#deform}. */\r\nexport abstract class VertexAttachment extends Attachment {\r\n\tprivate static nextID = 0;\r\n\r\n\t/** The unique ID for this attachment. */\r\n\tid = (VertexAttachment.nextID++ & 65535) << 11;\r\n\r\n\t/** The bones which affect the {@link #getVertices()}. The array entries are, for each vertex, the number of bones affecting\r\n\t * the vertex followed by that many bone indices, which is the index of the bone in {@link Skeleton#bones}. Will be null\r\n\t * if this attachment has no weights. */\r\n\tbones: Array<number>;\r\n\r\n\t/** The vertex positions in the bone's coordinate system. For a non-weighted attachment, the values are `x,y`\r\n\t * entries for each vertex. For a weighted attachment, the values are `x,y,weight` entries for each bone affecting\r\n\t * each vertex. */\r\n\tvertices: ArrayLike<number>;\r\n\r\n\t/** The maximum number of world vertex values that can be output by\r\n\t * {@link #computeWorldVertices()} using the `count` parameter. */\r\n\tworldVerticesLength = 0;\r\n\r\n\t/** Deform keys for the deform attachment are also applied to this attachment. May be null if no deform keys should be applied. */\r\n\tdeformAttachment: VertexAttachment = this;\r\n\r\n\tconstructor (name: string) {\r\n\t\tsuper(name);\r\n\t}\r\n\r\n\t/** Transforms the attachment's local {@link vertices} to world coordinates. If the slot's {@link Slot#deform} is\r\n\t * not empty, it is used to deform the vertices.\r\n\t *\r\n\t * See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine\r\n\t * Runtimes Guide.\r\n\t * @param start The index of the first {@link #vertices} value to transform. Each vertex has 2 values, x and y.\r\n\t * @param count The number of world vertex values to output. Must be <= {@link #worldVerticesLength} - `start`.\r\n\t * @param worldVertices The output world vertices. Must have a length >= `offset` + `count` *\r\n\t * `stride` / 2.\r\n\t * @param offset The `worldVertices` index to begin writing values.\r\n\t * @param stride The number of `worldVertices` entries between the value pairs written. */\r\n\tcomputeWorldVertices (slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number, stride: number) {\r\n\t\tcount = offset + (count >> 1) * stride;\r\n\t\tlet skeleton = slot.bone.skeleton;\r\n\t\tlet deformArray = slot.deform;\r\n\t\tlet vertices = this.vertices;\r\n\t\tlet bones = this.bones;\r\n\t\tif (bones == null) {\r\n\t\t\tif (deformArray.length > 0) vertices = deformArray;\r\n\t\t\tlet bone = slot.bone;\r\n\t\t\tlet x = bone.worldX;\r\n\t\t\tlet y = bone.worldY;\r\n\t\t\tlet a = bone.a, b = bone.b, c = bone.c, d = bone.d;\r\n\t\t\tfor (let v = start, w = offset; w < count; v += 2, w += stride) {\r\n\t\t\t\tlet vx = vertices[v], vy = vertices[v + 1];\r\n\t\t\t\tworldVertices[w] = vx * a + vy * b + x;\r\n\t\t\t\tworldVertices[w + 1] = vx * c + vy * d + y;\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tlet v = 0, skip = 0;\r\n\t\tfor (let i = 0; i < start; i += 2) {\r\n\t\t\tlet n = bones[v];\r\n\t\t\tv += n + 1;\r\n\t\t\tskip += n;\r\n\t\t}\r\n\t\tlet skeletonBones = skeleton.bones;\r\n\t\tif (deformArray.length == 0) {\r\n\t\t\tfor (let w = offset, b = skip * 3; w < count; w += stride) {\r\n\t\t\t\tlet wx = 0, wy = 0;\r\n\t\t\t\tlet n = bones[v++];\r\n\t\t\t\tn += v;\r\n\t\t\t\tfor (; v < n; v++, b += 3) {\r\n\t\t\t\t\tlet bone = skeletonBones[bones[v]];\r\n\t\t\t\t\tlet vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];\r\n\t\t\t\t\twx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;\r\n\t\t\t\t\twy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;\r\n\t\t\t\t}\r\n\t\t\t\tworldVertices[w] = wx;\r\n\t\t\t\tworldVertices[w + 1] = wy;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tlet deform = deformArray;\r\n\t\t\tfor (let w = offset, b = skip * 3, f = skip << 1; w < count; w += stride) {\r\n\t\t\t\tlet wx = 0, wy = 0;\r\n\t\t\t\tlet n = bones[v++];\r\n\t\t\t\tn += v;\r\n\t\t\t\tfor (; v < n; v++, b += 3, f += 2) {\r\n\t\t\t\t\tlet bone = skeletonBones[bones[v]];\r\n\t\t\t\t\tlet vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];\r\n\t\t\t\t\twx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;\r\n\t\t\t\t\twy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;\r\n\t\t\t\t}\r\n\t\t\t\tworldVertices[w] = wx;\r\n\t\t\t\tworldVertices[w + 1] = wy;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/** Does not copy id (generated) or name (set on construction). **/\r\n\tcopyTo (attachment: VertexAttachment) {\r\n\t\tif (this.bones != null) {\r\n\t\t\tattachment.bones = new Array<number>(this.bones.length);\r\n\t\t\tUtils.arrayCopy(this.bones, 0, attachment.bones, 0, this.bones.length);\r\n\t\t} else\r\n\t\t\tattachment.bones = null;\r\n\r\n\t\tif (this.vertices != null) {\r\n\t\t\tattachment.vertices = Utils.newFloatArray(this.vertices.length);\r\n\t\t\tUtils.arrayCopy(this.vertices, 0, attachment.vertices, 0, this.vertices.length);\r\n\t\t} else\r\n\t\t\tattachment.vertices = null;\r\n\r\n\t\tattachment.worldVerticesLength = this.worldVerticesLength;\r\n\t\tattachment.deformAttachment = this.deformAttachment;\r\n\t}\r\n}\r\n","export function _assert_this_initialized(self) {\n if (self === void 0) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n\n return self;\n}\nexport { _assert_this_initialized as _ };\n","\r\n\r\nimport { VertexAttachment, Attachment } from \"./Attachment\";\r\nimport { Color, Utils } from \"../Utils\";\r\n\r\n\r\n\r\n/** An attachment whose vertices make up a composite Bezier curve.\r\n *\r\n * See {@link PathConstraint} and [Paths](http://esotericsoftware.com/spine-paths) in the Spine User Guide. */\r\nexport class PathAttachment extends VertexAttachment {\r\n\r\n\t/** The lengths along the path in the setup pose from the start of the path to the end of each Bezier curve. */\r\n\tlengths: Array<number>;\r\n\r\n\t/** If true, the start and end knots are connected. */\r\n\tclosed = false;\r\n\r\n\t/** If true, additional calculations are performed to make calculating positions along the path more accurate. If false, fewer\r\n\t * calculations are performed but calculating positions along the path is less accurate. */\r\n\tconstantSpeed = false;\r\n\r\n\t/** The color of the path as it was in Spine. Available only when nonessential data was exported. Paths are not usually\r\n\t * rendered at runtime. */\r\n\tcolor = new Color(1, 1, 1, 1);\r\n\r\n\tconstructor (name: string) {\r\n\t\tsuper(name);\r\n\t}\r\n\r\n\tcopy (): Attachment {\r\n\t\tlet copy = new PathAttachment(this.name);\r\n\t\tthis.copyTo(copy);\r\n\t\tcopy.lengths = new Array<number>(this.lengths.length);\r\n\t\tUtils.arrayCopy(this.lengths, 0, copy.lengths, 0, this.lengths.length);\r\n\t\tcopy.closed = closed;\r\n\t\tcopy.constantSpeed = this.constantSpeed;\r\n\t\tcopy.color.setFromColor(this.color);\r\n\t\treturn copy;\r\n\t}\r\n}\r\n","\r\n\r\nimport { Updatable } from \"./Updatable\";\r\nimport { PathConstraintData, SpacingMode, RotateMode, PositionMode } from \"./PathConstraintData\";\r\nimport { Bone } from \"./Bone\";\r\nimport { Slot } from \"./Slot\";\r\nimport { Skeleton } from \"./Skeleton\";\r\nimport { PathAttachment } from \"./attachments/PathAttachment\";\r\nimport { Utils, MathUtils } from \"./Utils\";\r\n\r\n\r\n\r\n/** Stores the current pose for a path constraint. A path constraint adjusts the rotation, translation, and scale of the\r\n * constrained bones so they follow a {@link PathAttachment}.\r\n *\r\n * See [Path constraints](http://esotericsoftware.com/spine-path-constraints) in the Spine User Guide. */\r\nexport class PathConstraint implements Updatable {\r\n\tstatic NONE = -1; static BEFORE = -2; static AFTER = -3;\r\n\tstatic epsilon = 0.00001;\r\n\r\n\t/** The path constraint's setup pose data. */\r\n\tdata: PathConstraintData;\r\n\r\n\t/** The bones that will be modified by this path constraint. */\r\n\tbones: Array<Bone>;\r\n\r\n\t/** The slot whose path attachment will be used to constrained the bones. */\r\n\ttarget: Slot;\r\n\r\n\t/** The position along the path. */\r\n\tposition = 0;\r\n\r\n\t/** The spacing between bones. */\r\n\tspacing = 0;\r\n\r\n\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */\r\n\trotateMix = 0;\r\n\r\n\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained translations. */\r\n\ttranslateMix = 0;\r\n\r\n\tspaces = new Array<number>(); positions = new Array<number>();\r\n\tworld = new Array<number>(); curves = new Array<number>(); lengths = new Array<number>();\r\n\tsegments = new Array<number>();\r\n\r\n\tactive = false;\r\n\r\n\tconstructor (data: PathConstraintData, skeleton: Skeleton) {\r\n\t\tif (data == null) throw new Error(\"data cannot be null.\");\r\n\t\tif (skeleton == null) throw new Error(\"skeleton cannot be null.\");\r\n\t\tthis.data = data;\r\n\t\tthis.bones = new Array<Bone>();\r\n\t\tfor (let i = 0, n = data.bones.length; i < n; i++)\r\n\t\t\tthis.bones.push(skeleton.findBone(data.bones[i].name));\r\n\t\tthis.target = skeleton.findSlot(data.target.name);\r\n\t\tthis.position = data.position;\r\n\t\tthis.spacing = data.spacing;\r\n\t\tthis.rotateMix = data.rotateMix;\r\n\t\tthis.translateMix = data.translateMix;\r\n\t}\r\n\r\n\tisActive () {\r\n\t\treturn this.active;\r\n\t}\r\n\r\n\t/** Applies the constraint to the constrained bones. */\r\n\tapply () {\r\n\t\tthis.update();\r\n\t}\r\n\r\n\tupdate () {\r\n\t\tlet attachment = this.target.getAttachment();\r\n\t\tif (!(attachment instanceof PathAttachment)) return;\r\n\r\n\t\tlet rotateMix = this.rotateMix, translateMix = this.translateMix;\r\n\t\tlet translate = translateMix > 0, rotate = rotateMix > 0;\r\n\t\tif (!translate && !rotate) return;\r\n\r\n\t\tlet data = this.data;\r\n\t\tlet percentSpacing = data.spacingMode == SpacingMode.Percent;\r\n\t\tlet rotateMode = data.rotateMode;\r\n\t\tlet tangents = rotateMode == RotateMode.Tangent, scale = rotateMode == RotateMode.ChainScale;\r\n\t\tlet boneCount = this.bones.length, spacesCount = tangents ? boneCount : boneCount + 1;\r\n\t\tlet bones = this.bones;\r\n\t\tlet spaces = Utils.setArraySize(this.spaces, spacesCount), lengths: Array<number> = null;\r\n\t\tlet spacing = this.spacing;\r\n\t\tif (scale || !percentSpacing) {\r\n\t\t\tif (scale) lengths = Utils.setArraySize(this.lengths, boneCount);\r\n\t\t\tlet lengthSpacing = data.spacingMode == SpacingMode.Length;\r\n\t\t\tfor (let i = 0, n = spacesCount - 1; i < n;) {\r\n\t\t\t\tlet bone = bones[i];\r\n\t\t\t\tlet setupLength = bone.data.length;\r\n\t\t\t\tif (setupLength < PathConstraint.epsilon) {\r\n\t\t\t\t\tif (scale) lengths[i] = 0;\r\n\t\t\t\t\tspaces[++i] = 0;\r\n\t\t\t\t} else if (percentSpacing) {\r\n\t\t\t\t\tif (scale) {\r\n\t\t\t\t\t\tlet x = setupLength * bone.a, y = setupLength * bone.c;\r\n\t\t\t\t\t\tlet length = Math.sqrt(x * x + y * y);\r\n\t\t\t\t\t\tlengths[i] = length;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tspaces[++i] = spacing;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tlet x = setupLength * bone.a, y = setupLength * bone.c;\r\n\t\t\t\t\tlet length = Math.sqrt(x * x + y * y);\r\n\t\t\t\t\tif (scale) lengths[i] = length;\r\n\t\t\t\t\tspaces[++i] = (lengthSpacing ? setupLength + spacing : spacing) * length / setupLength;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tfor (let i = 1; i < spacesCount; i++)\r\n\t\t\t\tspaces[i] = spacing;\r\n\t\t}\r\n\r\n\t\tlet positions = this.computeWorldPositions(<PathAttachment>attachment, spacesCount, tangents,\r\n\t\t\tdata.positionMode == PositionMode.Percent, percentSpacing);\r\n\t\tlet boneX = positions[0], boneY = positions[1], offsetRotation = data.offsetRotation;\r\n\t\tlet tip = false;\r\n\t\tif (offsetRotation == 0)\r\n\t\t\ttip = rotateMode == RotateMode.Chain;\r\n\t\telse {\r\n\t\t\ttip = false;\r\n\t\t\tlet p = this.target.bone;\r\n\t\t\toffsetRotation *= p.a * p.d - p.b * p.c > 0 ? MathUtils.degRad : -MathUtils.degRad;\r\n\t\t}\r\n\t\tfor (let i = 0, p = 3; i < boneCount; i++, p += 3) {\r\n\t\t\tlet bone = bones[i];\r\n\t\t\tbone.worldX += (boneX - bone.worldX) * translateMix;\r\n\t\t\tbone.worldY += (boneY - bone.worldY) * translateMix;\r\n\t\t\tlet x = positions[p], y = positions[p + 1], dx = x - boneX, dy = y - boneY;\r\n\t\t\tif (scale) {\r\n\t\t\t\tlet length = lengths[i];\r\n\t\t\t\tif (length != 0) {\r\n\t\t\t\t\tlet s = (Math.sqrt(dx * dx + dy * dy) / length - 1) * rotateMix + 1;\r\n\t\t\t\t\tbone.a *= s;\r\n\t\t\t\t\tbone.c *= s;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tboneX = x;\r\n\t\t\tboneY = y;\r\n\t\t\tif (rotate) {\r\n\t\t\t\tlet a = bone.a, b = bone.b, c = bone.c, d = bone.d, r = 0, cos = 0, sin = 0;\r\n\t\t\t\tif (tangents)\r\n\t\t\t\t\tr = positions[p - 1];\r\n\t\t\t\telse if (spaces[i + 1] == 0)\r\n\t\t\t\t\tr = positions[p + 2];\r\n\t\t\t\telse\r\n\t\t\t\t\tr = Math.atan2(dy, dx);\r\n\t\t\t\tr -= Math.atan2(c, a);\r\n\t\t\t\tif (tip) {\r\n\t\t\t\t\tcos = Math.cos(r);\r\n\t\t\t\t\tsin = Math.sin(r);\r\n\t\t\t\t\tlet length = bone.data.length;\r\n\t\t\t\t\tboneX += (length * (cos * a - sin * c) - dx) * rotateMix;\r\n\t\t\t\t\tboneY += (length * (sin * a + cos * c) - dy) * rotateMix;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tr += offsetRotation;\r\n\t\t\t\t}\r\n\t\t\t\tif (r > MathUtils.PI)\r\n\t\t\t\t\tr -= MathUtils.PI2;\r\n\t\t\t\telse if (r < -MathUtils.PI) //\r\n\t\t\t\t\tr += MathUtils.PI2;\r\n\t\t\t\tr *= rotateMix;\r\n\t\t\t\tcos = Math.cos(r);\r\n\t\t\t\tsin = Math.sin(r);\r\n\t\t\t\tbone.a = cos * a - sin * c;\r\n\t\t\t\tbone.b = cos * b - sin * d;\r\n\t\t\t\tbone.c = sin * a + cos * c;\r\n\t\t\t\tbone.d = sin * b + cos * d;\r\n\t\t\t}\r\n\t\t\tbone.appliedValid = false;\r\n\t\t}\r\n\t}\r\n\r\n\tcomputeWorldPositions (path: PathAttachment, spacesCount: number, tangents: boolean, percentPosition: boolean,\r\n\t\tpercentSpacing: boolean) {\r\n\t\tlet target = this.target;\r\n\t\tlet position = this.position;\r\n\t\tlet spaces = this.spaces, out = Utils.setArraySize(this.positions, spacesCount * 3 + 2), world: Array<number> = null;\r\n\t\tlet closed = path.closed;\r\n\t\tlet verticesLength = path.worldVerticesLength, curveCount = verticesLength / 6, prevCurve = PathConstraint.NONE;\r\n\r\n\t\tif (!path.constantSpeed) {\r\n\t\t\tlet lengths = path.lengths;\r\n\t\t\tcurveCount -= closed ? 1 : 2;\r\n\t\t\tlet pathLength = lengths[curveCount];\r\n\t\t\tif (percentPosition) position *= pathLength;\r\n\t\t\tif (percentSpacing) {\r\n\t\t\t\tfor (let i = 1; i < spacesCount; i++)\r\n\t\t\t\t\tspaces[i] *= pathLength;\r\n\t\t\t}\r\n\t\t\tworld = Utils.setArraySize(this.world, 8);\r\n\t\t\tfor (let i = 0, o = 0, curve = 0; i < spacesCount; i++, o += 3) {\r\n\t\t\t\tlet space = spaces[i];\r\n\t\t\t\tposition += space;\r\n\t\t\t\tlet p = position;\r\n\r\n\t\t\t\tif (closed) {\r\n\t\t\t\t\tp %= pathLength;\r\n\t\t\t\t\tif (p < 0) p += pathLength;\r\n\t\t\t\t\tcurve = 0;\r\n\t\t\t\t} else if (p < 0) {\r\n\t\t\t\t\tif (prevCurve != PathConstraint.BEFORE) {\r\n\t\t\t\t\t\tprevCurve = PathConstraint.BEFORE;\r\n\t\t\t\t\t\tpath.computeWorldVertices(target, 2, 4, world, 0, 2);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.addBeforePosition(p, world, 0, out, o);\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t} else if (p > pathLength) {\r\n\t\t\t\t\tif (prevCurve != PathConstraint.AFTER) {\r\n\t\t\t\t\t\tprevCurve = PathConstraint.AFTER;\r\n\t\t\t\t\t\tpath.computeWorldVertices(target, verticesLength - 6, 4, world, 0, 2);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.addAfterPosition(p - pathLength, world, 0, out, o);\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Determine curve containing position.\r\n\t\t\t\tfor (;; curve++) {\r\n\t\t\t\t\tlet length = lengths[curve];\r\n\t\t\t\t\tif (p > length) continue;\r\n\t\t\t\t\tif (curve == 0)\r\n\t\t\t\t\t\tp /= length;\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tlet prev = lengths[curve - 1];\r\n\t\t\t\t\t\tp = (p - prev) / (length - prev);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tif (curve != prevCurve) {\r\n\t\t\t\t\tprevCurve = curve;\r\n\t\t\t\t\tif (closed && curve == curveCount) {\r\n\t\t\t\t\t\tpath.computeWorldVertices(target, verticesLength - 4, 4, world, 0, 2);\r\n\t\t\t\t\t\tpath.computeWorldVertices(target, 0, 4, world, 4, 2);\r\n\t\t\t\t\t} else\r\n\t\t\t\t\t\tpath.computeWorldVertices(target, curve * 6 + 2, 8, world, 0, 2);\r\n\t\t\t\t}\r\n\t\t\t\tthis.addCurvePosition(p, world[0], world[1], world[2], world[3], world[4], world[5], world[6], world[7], out, o,\r\n\t\t\t\t\ttangents || (i > 0 && space == 0));\r\n\t\t\t}\r\n\t\t\treturn out;\r\n\t\t}\r\n\r\n\t\t// World vertices.\r\n\t\tif (closed) {\r\n\t\t\tverticesLength += 2;\r\n\t\t\tworld = Utils.setArraySize(this.world, verticesLength);\r\n\t\t\tpath.computeWorldVertices(target, 2, verticesLength - 4, world, 0, 2);\r\n\t\t\tpath.computeWorldVertices(target, 0, 2, world, verticesLength - 4, 2);\r\n\t\t\tworld[verticesLength - 2] = world[0];\r\n\t\t\tworld[verticesLength - 1] = world[1];\r\n\t\t} else {\r\n\t\t\tcurveCount--;\r\n\t\t\tverticesLength -= 4;\r\n\t\t\tworld = Utils.setArraySize(this.world, verticesLength);\r\n\t\t\tpath.computeWorldVertices(target, 2, verticesLength, world, 0, 2);\r\n\t\t}\r\n\r\n\t\t// Curve lengths.\r\n\t\tlet curves = Utils.setArraySize(this.curves, curveCount);\r\n\t\tlet pathLength = 0;\r\n\t\tlet x1 = world[0], y1 = world[1], cx1 = 0, cy1 = 0, cx2 = 0, cy2 = 0, x2 = 0, y2 = 0;\r\n\t\tlet tmpx = 0, tmpy = 0, dddfx = 0, dddfy = 0, ddfx = 0, ddfy = 0, dfx = 0, dfy = 0;\r\n\t\tfor (let i = 0, w = 2; i < curveCount; i++, w += 6) {\r\n\t\t\tcx1 = world[w];\r\n\t\t\tcy1 = world[w + 1];\r\n\t\t\tcx2 = world[w + 2];\r\n\t\t\tcy2 = world[w + 3];\r\n\t\t\tx2 = world[w + 4];\r\n\t\t\ty2 = world[w + 5];\r\n\t\t\ttmpx = (x1 - cx1 * 2 + cx2) * 0.1875;\r\n\t\t\ttmpy = (y1 - cy1 * 2 + cy2) * 0.1875;\r\n\t\t\tdddfx = ((cx1 - cx2) * 3 - x1 + x2) * 0.09375;\r\n\t\t\tdddfy = ((cy1 - cy2) * 3 - y1 + y2) * 0.09375;\r\n\t\t\tddfx = tmpx * 2 + dddfx;\r\n\t\t\tddfy = tmpy * 2 + dddfy;\r\n\t\t\tdfx = (cx1 - x1) * 0.75 + tmpx + dddfx * 0.16666667;\r\n\t\t\tdfy = (cy1 - y1) * 0.75 + tmpy + dddfy * 0.16666667;\r\n\t\t\tpathLength += Math.sqrt(dfx * dfx + dfy * dfy);\r\n\t\t\tdfx += ddfx;\r\n\t\t\tdfy += ddfy;\r\n\t\t\tddfx += dddfx;\r\n\t\t\tddfy += dddfy;\r\n\t\t\tpathLength += Math.sqrt(dfx * dfx + dfy * dfy);\r\n\t\t\tdfx += ddfx;\r\n\t\t\tdfy += ddfy;\r\n\t\t\tpathLength += Math.sqrt(dfx * dfx + dfy * dfy);\r\n\t\t\tdfx += ddfx + dddfx;\r\n\t\t\tdfy += ddfy + dddfy;\r\n\t\t\tpathLength += Math.sqrt(dfx * dfx + dfy * dfy);\r\n\t\t\tcurves[i] = pathLength;\r\n\t\t\tx1 = x2;\r\n\t\t\ty1 = y2;\r\n\t\t}\r\n\t\tif (percentPosition)\r\n\t\t\tposition *= pathLength;\r\n\t\telse\r\n\t\t\tposition *= pathLength / path.lengths[curveCount - 1];\r\n\t\tif (percentSpacing) {\r\n\t\t\tfor (let i = 1; i < spacesCount; i++)\r\n\t\t\t\tspaces[i] *= pathLength;\r\n\t\t}\r\n\r\n\t\tlet segments = this.segments;\r\n\t\tlet curveLength = 0;\r\n\t\tfor (let i = 0, o = 0, curve = 0, segment = 0; i < spacesCount; i++, o += 3) {\r\n\t\t\tlet space = spaces[i];\r\n\t\t\tposition += space;\r\n\t\t\tlet p = position;\r\n\r\n\t\t\tif (closed) {\r\n\t\t\t\tp %= pathLength;\r\n\t\t\t\tif (p < 0) p += pathLength;\r\n\t\t\t\tcurve = 0;\r\n\t\t\t} else if (p < 0) {\r\n\t\t\t\tthis.addBeforePosition(p, world, 0, out, o);\r\n\t\t\t\tcontinue;\r\n\t\t\t} else if (p > pathLength) {\r\n\t\t\t\tthis.addAfterPosition(p - pathLength, world, verticesLength - 4, out, o);\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\t// Determine curve containing position.\r\n\t\t\tfor (;; curve++) {\r\n\t\t\t\tlet length = curves[curve];\r\n\t\t\t\tif (p > length) continue;\r\n\t\t\t\tif (curve == 0)\r\n\t\t\t\t\tp /= length;\r\n\t\t\t\telse {\r\n\t\t\t\t\tlet prev = curves[curve - 1];\r\n\t\t\t\t\tp = (p - prev) / (length - prev);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\t// Curve segment lengths.\r\n\t\t\tif (curve != prevCurve) {\r\n\t\t\t\tprevCurve = curve;\r\n\t\t\t\tlet ii = curve * 6;\r\n\t\t\t\tx1 = world[ii];\r\n\t\t\t\ty1 = world[ii + 1];\r\n\t\t\t\tcx1 = world[ii + 2];\r\n\t\t\t\tcy1 = world[ii + 3];\r\n\t\t\t\tcx2 = world[ii + 4];\r\n\t\t\t\tcy2 = world[ii + 5];\r\n\t\t\t\tx2 = world[ii + 6];\r\n\t\t\t\ty2 = world[ii + 7];\r\n\t\t\t\ttmpx = (x1 - cx1 * 2 + cx2) * 0.03;\r\n\t\t\t\ttmpy = (y1 - cy1 * 2 + cy2) * 0.03;\r\n\t\t\t\tdddfx = ((cx1 - cx2) * 3 - x1 + x2) * 0.006;\r\n\t\t\t\tdddfy = ((cy1 - cy2) * 3 - y1 + y2) * 0.006;\r\n\t\t\t\tddfx = tmpx * 2 + dddfx;\r\n\t\t\t\tddfy = tmpy * 2 + dddfy;\r\n\t\t\t\tdfx = (cx1 - x1) * 0.3 + tmpx + dddfx * 0.16666667;\r\n\t\t\t\tdfy = (cy1 - y1) * 0.3 + tmpy + dddfy * 0.16666667;\r\n\t\t\t\tcurveLength = Math.sqrt(dfx * dfx + dfy * dfy);\r\n\t\t\t\tsegments[0] = curveLength;\r\n\t\t\t\tfor (ii = 1; ii < 8; ii++) {\r\n\t\t\t\t\tdfx += ddfx;\r\n\t\t\t\t\tdfy += ddfy;\r\n\t\t\t\t\tddfx += dddfx;\r\n\t\t\t\t\tddfy += dddfy;\r\n\t\t\t\t\tcurveLength += Math.sqrt(dfx * dfx + dfy * dfy);\r\n\t\t\t\t\tsegments[ii] = curveLength;\r\n\t\t\t\t}\r\n\t\t\t\tdfx += ddfx;\r\n\t\t\t\tdfy += ddfy;\r\n\t\t\t\tcurveLength += Math.sqrt(dfx * dfx + dfy * dfy);\r\n\t\t\t\tsegments[8] = curveLength;\r\n\t\t\t\tdfx += ddfx + dddfx;\r\n\t\t\t\tdfy += ddfy + dddfy;\r\n\t\t\t\tcurveLength += Math.sqrt(dfx * dfx + dfy * dfy);\r\n\t\t\t\tsegments[9] = curveLength;\r\n\t\t\t\tsegment = 0;\r\n\t\t\t}\r\n\r\n\t\t\t// Weight by segment length.\r\n\t\t\tp *= curveLength;\r\n\t\t\tfor (;; segment++) {\r\n\t\t\t\tlet length = segments[segment];\r\n\t\t\t\tif (p > length) continue;\r\n\t\t\t\tif (segment == 0)\r\n\t\t\t\t\tp /= length;\r\n\t\t\t\telse {\r\n\t\t\t\t\tlet prev = segments[segment - 1];\r\n\t\t\t\t\tp = segment + (p - prev) / (length - prev);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tthis.addCurvePosition(p * 0.1, x1, y1, cx1, cy1, cx2, cy2, x2, y2, out, o, tangents || (i > 0 && space == 0));\r\n\t\t}\r\n\t\treturn out;\r\n\t}\r\n\r\n\taddBeforePosition (p: number, temp: Array<number>, i: number, out: Array<number>, o: number) {\r\n\t\tlet x1 = temp[i], y1 = temp[i + 1], dx = temp[i + 2] - x1, dy = temp[i + 3] - y1, r = Math.atan2(dy, dx);\r\n\t\tout[o] = x1 + p * Math.cos(r);\r\n\t\tout[o + 1] = y1 + p * Math.sin(r);\r\n\t\tout[o + 2] = r;\r\n\t}\r\n\r\n\taddAfterPosition (p: number, temp: Array<number>, i: number, out: Array<number>, o: number) {\r\n\t\tlet x1 = temp[i + 2], y1 = temp[i + 3], dx = x1 - temp[i], dy = y1 - temp[i + 1], r = Math.atan2(dy, dx);\r\n\t\tout[o] = x1 + p * Math.cos(r);\r\n\t\tout[o + 1] = y1 + p * Math.sin(r);\r\n\t\tout[o + 2] = r;\r\n\t}\r\n\r\n\taddCurvePosition (p: number, x1: number, y1: number, cx1: number, cy1: number, cx2: number, cy2: number, x2: number, y2: number,\r\n\t\tout: Array<number>, o: number, tangents: boolean) {\r\n\t\tif (p == 0 || isNaN(p)) {\r\n\t\t\tout[o] = x1;\r\n\t\t\tout[o + 1] = y1;\r\n\t\t\tout[o + 2] = Math.atan2(cy1 - y1, cx1 - x1);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tlet tt = p * p, ttt = tt * p, u = 1 - p, uu = u * u, uuu = uu * u;\r\n\t\tlet ut = u * p, ut3 = ut * 3, uut3 = u * ut3, utt3 = ut3 * p;\r\n\t\tlet x = x1 * uuu + cx1 * uut3 + cx2 * utt3 + x2 * ttt, y = y1 * uuu + cy1 * uut3 + cy2 * utt3 + y2 * ttt;\r\n\t\tout[o] = x;\r\n\t\tout[o + 1] = y;\r\n\t\tif (tangents) {\r\n\t\t\tif (p < 0.001)\r\n\t\t\t\tout[o + 2] = Math.atan2(cy1 - y1, cx1 - x1);\r\n\t\t\telse\r\n\t\t\t\tout[o + 2] = Math.atan2(y - (y1 * uu + cy1 * ut * 2 + cy2 * tt), x - (x1 * uu + cx1 * ut * 2 + cx2 * tt));\r\n\t\t}\r\n\t}\r\n}\r\n","\r\n\r\nimport { Attachment } from \"./Attachment\";\r\nimport { Color, Utils, ArrayLike } from \"../Utils\";\r\nimport { TextureRegion } from \"../Texture\";\r\nimport { Bone } from \"../Bone\";\r\n\r\n\r\n\r\n/** An attachment that displays a textured quadrilateral.\r\n *\r\n * See [Region attachments](http://esotericsoftware.com/spine-regions) in the Spine User Guide. */\r\nexport class RegionAttachment extends Attachment {\r\n\tstatic OX1 = 0;\r\n\tstatic OY1 = 1;\r\n\tstatic OX2 = 2;\r\n\tstatic OY2 = 3;\r\n\tstatic OX3 = 4;\r\n\tstatic OY3 = 5;\r\n\tstatic OX4 = 6;\r\n\tstatic OY4 = 7;\r\n\r\n\tstatic X1 = 0;\r\n\tstatic Y1 = 1;\r\n\tstatic C1R = 2;\r\n\tstatic C1G = 3;\r\n\tstatic C1B = 4;\r\n\tstatic C1A = 5;\r\n\tstatic U1 = 6;\r\n\tstatic V1 = 7;\r\n\r\n\tstatic X2 = 8;\r\n\tstatic Y2 = 9;\r\n\tstatic C2R = 10;\r\n\tstatic C2G = 11;\r\n\tstatic C2B = 12;\r\n\tstatic C2A = 13;\r\n\tstatic U2 = 14;\r\n\tstatic V2 = 15;\r\n\r\n\tstatic X3 = 16;\r\n\tstatic Y3 = 17;\r\n\tstatic C3R = 18;\r\n\tstatic C3G = 19;\r\n\tstatic C3B = 20;\r\n\tstatic C3A = 21;\r\n\tstatic U3 = 22;\r\n\tstatic V3 = 23;\r\n\r\n\tstatic X4 = 24;\r\n\tstatic Y4 = 25;\r\n\tstatic C4R = 26;\r\n\tstatic C4G = 27;\r\n\tstatic C4B = 28;\r\n\tstatic C4A = 29;\r\n\tstatic U4 = 30;\r\n\tstatic V4 = 31;\r\n\r\n\t/** The local x translation. */\r\n\tx = 0;\r\n\r\n\t/** The local y translation. */\r\n\ty = 0;\r\n\r\n\t/** The local scaleX. */\r\n\tscaleX = 1;\r\n\r\n\t/** The local scaleY. */\r\n\tscaleY = 1;\r\n\r\n\t/** The local rotation. */\r\n\trotation = 0;\r\n\r\n\t/** The width of the region attachment in Spine. */\r\n\twidth = 0;\r\n\r\n\t/** The height of the region attachment in Spine. */\r\n\theight = 0;\r\n\r\n\t/** The color to tint the region attachment. */\r\n\tcolor = new Color(1, 1, 1, 1);\r\n\r\n\t/** The name of the texture region for this attachment. */\r\n\tpath: string;\r\n\r\n\trendererObject: any;\r\n\tregion: TextureRegion;\r\n\r\n\t/** For each of the 4 vertices, a pair of <code>x,y</code> values that is the local position of the vertex.\r\n\t *\r\n\t * See {@link #updateOffset()}. */\r\n\toffset = Utils.newFloatArray(8);\r\n\r\n\r\n\tuvs = Utils.newFloatArray(8);\r\n\r\n\ttempColor = new Color(1, 1, 1, 1);\r\n\r\n\tconstructor (name:string) {\r\n\t\tsuper(name);\r\n\t}\r\n\r\n\t/** Calculates the {@link #offset} using the region settings. Must be called after changing region settings. */\r\n\tupdateOffset () : void {\r\n\t\tlet regionScaleX = this.width / this.region.originalWidth * this.scaleX;\r\n\t\tlet regionScaleY = this.height / this.region.originalHeight * this.scaleY;\r\n\t\tlet localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;\r\n\t\tlet localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;\r\n\t\tlet localX2 = localX + this.region.width * regionScaleX;\r\n\t\tlet localY2 = localY + this.region.height * regionScaleY;\r\n\t\tlet radians = this.rotation * Math.PI / 180;\r\n\t\tlet cos = Math.cos(radians);\r\n\t\tlet sin = Math.sin(radians);\r\n\t\tlet localXCos = localX * cos + this.x;\r\n\t\tlet localXSin = localX * sin;\r\n\t\tlet localYCos = localY * cos + this.y;\r\n\t\tlet localYSin = localY * sin;\r\n\t\tlet localX2Cos = localX2 * cos + this.x;\r\n\t\tlet localX2Sin = localX2 * sin;\r\n\t\tlet localY2Cos = localY2 * cos + this.y;\r\n\t\tlet localY2Sin = localY2 * sin;\r\n\t\tlet offset = this.offset;\r\n\t\toffset[RegionAttachment.OX1] = localXCos - localYSin;\r\n\t\toffset[RegionAttachment.OY1] = localYCos + localXSin;\r\n\t\toffset[RegionAttachment.OX2] = localXCos - localY2Sin;\r\n\t\toffset[RegionAttachment.OY2] = localY2Cos + localXSin;\r\n\t\toffset[RegionAttachment.OX3] = localX2Cos - localY2Sin;\r\n\t\toffset[RegionAttachment.OY3] = localY2Cos + localX2Sin;\r\n\t\toffset[RegionAttachment.OX4] = localX2Cos - localYSin;\r\n\t\toffset[RegionAttachment.OY4] = localYCos + localX2Sin;\r\n\t}\r\n\r\n\tsetRegion (region: TextureRegion) : void {\r\n\t\tthis.region = region;\r\n\t\tlet uvs = this.uvs;\r\n\t\tif (region.rotate) {\r\n\t\t\tuvs[2] = region.u;\r\n\t\t\tuvs[3] = region.v2;\r\n\t\t\tuvs[4] = region.u;\r\n\t\t\tuvs[5] = region.v;\r\n\t\t\tuvs[6] = region.u2;\r\n\t\t\tuvs[7] = region.v;\r\n\t\t\tuvs[0] = region.u2;\r\n\t\t\tuvs[1] = region.v2;\r\n\t\t} else {\r\n\t\t\tuvs[0] = region.u;\r\n\t\t\tuvs[1] = region.v2;\r\n\t\t\tuvs[2] = region.u;\r\n\t\t\tuvs[3] = region.v;\r\n\t\t\tuvs[4] = region.u2;\r\n\t\t\tuvs[5] = region.v;\r\n\t\t\tuvs[6] = region.u2;\r\n\t\t\tuvs[7] = region.v2;\r\n\t\t}\r\n\t}\r\n\r\n\t/** Transforms the attachment's four vertices to world coordinates.\r\n\t *\r\n\t * See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine\r\n\t * Runtimes Guide.\r\n\t * @param worldVertices The output world vertices. Must have a length >= `offset` + 8.\r\n\t * @param offset The `worldVertices` index to begin writing values.\r\n\t * @param stride The number of `worldVertices` entries between the value pairs written. */\r\n\tcomputeWorldVertices (bone: Bone, worldVertices: ArrayLike<number>, offset: number, stride: number) {\r\n\t\tlet vertexOffset = this.offset;\r\n\t\tlet x = bone.worldX, y = bone.worldY;\r\n\t\tlet a = bone.a, b = bone.b, c = bone.c, d = bone.d;\r\n\t\tlet offsetX = 0, offsetY = 0;\r\n\r\n\t\toffsetX = vertexOffset[RegionAttachment.OX1];\r\n\t\toffsetY = vertexOffset[RegionAttachment.OY1];\r\n\t\tworldVertices[offset] = offsetX * a + offsetY * b + x; // br\r\n\t\tworldVertices[offset + 1] = offsetX * c + offsetY * d + y;\r\n\t\toffset += stride;\r\n\r\n\t\toffsetX = vertexOffset[RegionAttachment.OX2];\r\n\t\toffsetY = vertexOffset[RegionAttachment.OY2];\r\n\t\tworldVertices[offset] = offsetX * a + offsetY * b + x; // bl\r\n\t\tworldVertices[offset + 1] = offsetX * c + offsetY * d + y;\r\n\t\toffset += stride;\r\n\r\n\t\toffsetX = vertexOffset[RegionAttachment.OX3];\r\n\t\toffsetY = vertexOffset[RegionAttachment.OY3];\r\n\t\tworldVertices[offset] = offsetX * a + offsetY * b + x; // ul\r\n\t\tworldVertices[offset + 1] = offsetX * c + offsetY * d + y;\r\n\t\toffset += stride;\r\n\r\n\t\toffsetX = vertexOffset[RegionAttachment.OX4];\r\n\t\toffsetY = vertexOffset[RegionAttachment.OY4];\r\n\t\tworldVertices[offset] = offsetX * a + offsetY * b + x; // ur\r\n\t\tworldVertices[offset + 1] = offsetX * c + offsetY * d + y;\r\n\t}\r\n\r\n\tcopy (): Attachment {\r\n\t\tlet copy = new RegionAttachment(this.name);\r\n\t\tcopy.region = this.region;\r\n\t\tcopy.rendererObject = this.rendererObject;\r\n\t\tcopy.path = this.path;\r\n\t\tcopy.x = this.x;\r\n\t\tcopy.y = this.y;\r\n\t\tcopy.scaleX = this.scaleX;\r\n\t\tcopy.scaleY = this.scaleY;\r\n\t\tcopy.rotation = this.rotation;\r\n\t\tcopy.width = this.width;\r\n\t\tcopy.height = this.height;\r\n\t\tUtils.arrayCopy(this.uvs, 0, copy.uvs, 0, 8);\r\n\t\tUtils.arrayCopy(this.offset, 0, copy.offset, 0, 8);\r\n\t\tcopy.color.setFromColor(this.color);\r\n\t\treturn copy;\r\n\t}\r\n}\r\n","export abstract class Texture {\r\n\tprotected _image: HTMLImageElement | ImageBitmap;\r\n\r\n\tconstructor (image: HTMLImageElement | ImageBitmap) {\r\n\t\tthis._image = image;\r\n\t}\r\n\r\n\tgetImage (): HTMLImageElement | ImageBitmap {\r\n\t\treturn this._image;\r\n\t}\r\n\r\n\tabstract setFilters (minFilter: TextureFilter, magFilter: TextureFilter): void;\r\n\tabstract setWraps (uWrap: TextureWrap, vWrap: TextureWrap): void;\r\n\tabstract dispose (): void;\r\n\r\n\tpublic static filterFromString (text: string): TextureFilter {\r\n\t\tswitch (text.toLowerCase()) {\r\n\t\t\tcase \"nearest\": return TextureFilter.Nearest;\r\n\t\t\tcase \"linear\": return TextureFilter.Linear;\r\n\t\t\tcase \"mipmap\": return TextureFilter.MipMap;\r\n\t\t\tcase \"mipmapnearestnearest\": return TextureFilter.MipMapNearestNearest;\r\n\t\t\tcase \"mipmaplinearnearest\": return TextureFilter.MipMapLinearNearest;\r\n\t\t\tcase \"mipmapnearestlinear\": return TextureFilter.MipMapNearestLinear;\r\n\t\t\tcase \"mipmaplinearlinear\": return TextureFilter.MipMapLinearLinear;\r\n\t\t\tdefault: throw new Error(`Unknown texture filter ${text}`);\r\n\t\t}\r\n\t}\r\n\r\n\tpublic static wrapFromString (text: string): TextureWrap {\r\n\t\tswitch (text.toLowerCase()) {\r\n\t\t\tcase \"mirroredtepeat\": return TextureWrap.MirroredRepeat;\r\n\t\t\tcase \"clamptoedge\": return TextureWrap.ClampToEdge;\r\n\t\t\tcase \"repeat\": return TextureWrap.Repeat;\r\n\t\t\tdefault: throw new Error(`Unknown texture wrap ${text}`);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport enum TextureFilter {\r\n\tNearest = 9728, // WebGLRenderingContext.NEAREST\r\n\tLinear = 9729, // WebGLRenderingContext.LINEAR\r\n\tMipMap = 9987, // WebGLRenderingContext.LINEAR_MIPMAP_LINEAR\r\n\tMipMapNearestNearest = 9984, // WebGLRenderingContext.NEAREST_MIPMAP_NEAREST\r\n\tMipMapLinearNearest = 9985, // WebGLRenderingContext.LINEAR_MIPMAP_NEAREST\r\n\tMipMapNearestLinear = 9986, // WebGLRenderingContext.NEAREST_MIPMAP_LINEAR\r\n\tMipMapLinearLinear = 9987 // WebGLRenderingContext.LINEAR_MIPMAP_LINEAR\r\n}\r\n\r\nexport enum TextureWrap {\r\n\tMirroredRepeat = 33648, // WebGLRenderingContext.MIRRORED_REPEAT\r\n\tClampToEdge = 33071, // WebGLRenderingContext.CLAMP_TO_EDGE\r\n\tRepeat = 10497 // WebGLRenderingContext.REPEAT\r\n}\r\n\r\nexport class TextureRegion {\r\n\trenderObject: any;\r\n\tu = 0; v = 0;\r\n\tu2 = 0; v2 = 0;\r\n\twidth = 0; height = 0;\r\n\trotate = false;\r\n\toffsetX = 0; offsetY = 0;\r\n\toriginalWidth = 0; originalHeight = 0;\r\n}\r\n\r\nexport class FakeTexture extends Texture {\r\n\tsetFilters(minFilter: TextureFilter, magFilter: TextureFilter) { }\r\n\tsetWraps(uWrap: TextureWrap, vWrap: TextureWrap) { }\r\n\tdispose() { }\r\n}\r\n","\r\n\r\nimport { Skeleton } from \"./Skeleton\";\r\nimport { Utils, MathUtils, ArrayLike } from \"./Utils\";\r\nimport { Slot } from \"./Slot\";\r\nimport { VertexAttachment, Attachment } from \"./attachments/Attachment\";\r\nimport { IkConstraint } from \"./IkConstraint\";\r\nimport { TransformConstraint } from \"./TransformConstraint\";\r\nimport { PathConstraint } from \"./PathConstraint\";\r\nimport { Event } from \"./Event\";\r\n\r\n\r\n\r\n/** A simple container for a list of timelines and a name. */\r\nexport class Animation {\r\n\t/** The animation's name, which is unique across all animations in the skeleton. */\r\n\tname: string;\r\n\ttimelines: Array<Timeline>;\r\n\ttimelineIds: Array<boolean>;\r\n\r\n\t/** The duration of the animation in seconds, which is the highest time of all keys in the timeline. */\r\n\tduration: number;\r\n\r\n\tconstructor (name: string, timelines: Array<Timeline>, duration: number) {\r\n\t\tif (name == null) throw new Error(\"name cannot be null.\");\r\n\t\tif (timelines == null) throw new Error(\"timelines cannot be null.\");\r\n\t\tthis.name = name;\r\n\t\tthis.timelines = timelines;\r\n\t\tthis.timelineIds = [];\r\n\t\tfor (var i = 0; i < timelines.length; i++)\r\n\t\t\tthis.timelineIds[timelines[i].getPropertyId()] = true;\r\n\t\tthis.duration = duration;\r\n\t}\r\n\r\n\thasTimeline (id: number) {\r\n\t\treturn this.timelineIds[id] == true;\r\n\t}\r\n\r\n\t/** Applies all the animation's timelines to the specified skeleton.\r\n\t *\r\n\t * See Timeline {@link Timeline#apply(Skeleton, float, float, Array, float, MixBlend, MixDirection)}.\r\n\t * @param loop If true, the animation repeats after {@link #getDuration()}.\r\n\t * @param events May be null to ignore fired events. */\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, loop: boolean, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tif (skeleton == null) throw new Error(\"skeleton cannot be null.\");\r\n\r\n\t\tif (loop && this.duration != 0) {\r\n\t\t\ttime %= this.duration;\r\n\t\t\tif (lastTime > 0) lastTime %= this.duration;\r\n\t\t}\r\n\r\n\t\tlet timelines = this.timelines;\r\n\t\tfor (let i = 0, n = timelines.length; i < n; i++)\r\n\t\t\ttimelines[i].apply(skeleton, lastTime, time, events, alpha, blend, direction);\r\n\t}\r\n\r\n\t/** @param target After the first and before the last value.\r\n\t * @returns index of first value greater than the target. */\r\n\tstatic binarySearch (values: ArrayLike<number>, target: number, step: number = 1) {\r\n\t\tlet low = 0;\r\n\t\tlet high = values.length / step - 2;\r\n\t\tif (high == 0) return step;\r\n\t\tlet current = high >>> 1;\r\n\t\twhile (true) {\r\n\t\t\tif (values[(current + 1) * step] <= target)\r\n\t\t\t\tlow = current + 1;\r\n\t\t\telse\r\n\t\t\t\thigh = current;\r\n\t\t\tif (low == high) return (low + 1) * step;\r\n\t\t\tcurrent = (low + high) >>> 1;\r\n\t\t}\r\n\t}\r\n\r\n\tstatic linearSearch (values: ArrayLike<number>, target: number, step: number) {\r\n\t\tfor (let i = 0, last = values.length - step; i <= last; i += step)\r\n\t\t\tif (values[i] > target) return i;\r\n\t\treturn -1;\r\n\t}\r\n}\r\n\r\n/** The interface for all timelines. */\r\nexport interface Timeline {\r\n\t/** Applies this timeline to the skeleton.\r\n\t * @param skeleton The skeleton the timeline is being applied to. This provides access to the bones, slots, and other\r\n\t * skeleton components the timeline may change.\r\n\t * @param lastTime The time this timeline was last applied. Timelines such as {@link EventTimeline}} trigger only at specific\r\n\t * times rather than every frame. In that case, the timeline triggers everything between `lastTime`\r\n\t * (exclusive) and `time` (inclusive).\r\n\t * @param time The time within the animation. Most timelines find the key before and the key after this time so they can\r\n\t * interpolate between the keys.\r\n\t * @param events If any events are fired, they are added to this list. Can be null to ignore fired events or if the timeline\r\n\t * does not fire events.\r\n\t * @param alpha 0 applies the current or setup value (depending on `blend`). 1 applies the timeline value.\r\n\t * Between 0 and 1 applies a value between the current or setup value and the timeline value. By adjusting\r\n\t * `alpha` over time, an animation can be mixed in or out. `alpha` can also be useful to\r\n\t * apply animations on top of each other (layering).\r\n\t * @param blend Controls how mixing is applied when `alpha` < 1.\r\n\t * @param direction Indicates whether the timeline is mixing in or out. Used by timelines which perform instant transitions,\r\n\t * such as {@link DrawOrderTimeline} or {@link AttachmentTimeline}. */\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;\r\n\r\n\t/** Uniquely encodes both the type of this timeline and the skeleton property that it affects. */\r\n\tgetPropertyId (): number;\r\n}\r\n\r\n/** Controls how a timeline value is mixed with the setup pose value or current pose value when a timeline's `alpha`\r\n * < 1.\r\n *\r\n * See Timeline {@link Timeline#apply(Skeleton, float, float, Array, float, MixBlend, MixDirection)}. */\r\nexport enum MixBlend {\r\n\t/** Transitions from the setup value to the timeline value (the current value is not used). Before the first key, the setup\r\n\t * value is set. */\r\n\tsetup,\r\n\t/** Transitions from the current value to the timeline value. Before the first key, transitions from the current value to\r\n\t * the setup value. Timelines which perform instant transitions, such as {@link DrawOrderTimeline} or\r\n\t * {@link AttachmentTimeline}, use the setup value before the first key.\r\n\t *\r\n\t * `first` is intended for the first animations applied, not for animations layered on top of those. */\r\n\tfirst,\r\n\t/** Transitions from the current value to the timeline value. No change is made before the first key (the current value is\r\n\t * kept until the first key).\r\n\t *\r\n\t * `replace` is intended for animations layered on top of others, not for the first animations applied. */\r\n\treplace,\r\n\t/** Transitions from the current value to the current value plus the timeline value. No change is made before the first key\r\n\t * (the current value is kept until the first key).\r\n\t *\r\n\t * `add` is intended for animations layered on top of others, not for the first animations applied. Properties\r\n\t * keyed by additive animations must be set manually or by another animation before applying the additive animations, else\r\n\t * the property values will increase continually. */\r\n\tadd\r\n}\r\n\r\n/** Indicates whether a timeline's `alpha` is mixing out over time toward 0 (the setup or current pose value) or\r\n * mixing in toward 1 (the timeline's value).\r\n *\r\n * See Timeline {@link Timeline#apply(Skeleton, float, float, Array, float, MixBlend, MixDirection)}. */\r\nexport enum MixDirection {\r\n\tmixIn, mixOut\r\n}\r\n\r\nexport enum TimelineType {\r\n\trotate, translate, scale, shear,\r\n\tattachment, color, deform,\r\n\tevent, drawOrder,\r\n\tikConstraint, transformConstraint,\r\n\tpathConstraintPosition, pathConstraintSpacing, pathConstraintMix,\r\n\ttwoColor\r\n}\r\n\r\n/** The base class for timelines that use interpolation between key frame values. */\r\nexport abstract class CurveTimeline implements Timeline {\r\n\tstatic LINEAR = 0; static STEPPED = 1; static BEZIER = 2;\r\n\tstatic BEZIER_SIZE = 10 * 2 - 1;\r\n\r\n\tprivate curves: ArrayLike<number>; // type, x, y, ...\r\n\r\n\tabstract getPropertyId(): number;\r\n\r\n\tconstructor (frameCount: number) {\r\n\t\tif (frameCount <= 0) throw new Error(\"frameCount must be > 0: \" + frameCount);\r\n\t\tthis.curves = Utils.newFloatArray((frameCount - 1) * CurveTimeline.BEZIER_SIZE);\r\n\t}\r\n\r\n\t/** The number of key frames for this timeline. */\r\n\tgetFrameCount () {\r\n\t\treturn this.curves.length / CurveTimeline.BEZIER_SIZE + 1;\r\n\t}\r\n\r\n\t/** Sets the specified key frame to linear interpolation. */\r\n\tsetLinear (frameIndex: number) {\r\n\t\tthis.curves[frameIndex * CurveTimeline.BEZIER_SIZE] = CurveTimeline.LINEAR;\r\n\t}\r\n\r\n\t/** Sets the specified key frame to stepped interpolation. */\r\n\tsetStepped (frameIndex: number) {\r\n\t\tthis.curves[frameIndex * CurveTimeline.BEZIER_SIZE] = CurveTimeline.STEPPED;\r\n\t}\r\n\r\n\t/** Returns the interpolation type for the specified key frame.\r\n\t * @returns Linear is 0, stepped is 1, Bezier is 2. */\r\n\tgetCurveType (frameIndex: number): number {\r\n\t\tlet index = frameIndex * CurveTimeline.BEZIER_SIZE;\r\n\t\tif (index == this.curves.length) return CurveTimeline.LINEAR;\r\n\t\tlet type = this.curves[index];\r\n\t\tif (type == CurveTimeline.LINEAR) return CurveTimeline.LINEAR;\r\n\t\tif (type == CurveTimeline.STEPPED) return CurveTimeline.STEPPED;\r\n\t\treturn CurveTimeline.BEZIER;\r\n\t}\r\n\r\n\t/** Sets the specified key frame to Bezier interpolation. `cx1` and `cx2` are from 0 to 1,\r\n\t * representing the percent of time between the two key frames. `cy1` and `cy2` are the percent of the\r\n\t * difference between the key frame's values. */\r\n\tsetCurve (frameIndex: number, cx1: number, cy1: number, cx2: number, cy2: number) {\r\n\t\tlet tmpx = (-cx1 * 2 + cx2) * 0.03, tmpy = (-cy1 * 2 + cy2) * 0.03;\r\n\t\tlet dddfx = ((cx1 - cx2) * 3 + 1) * 0.006, dddfy = ((cy1 - cy2) * 3 + 1) * 0.006;\r\n\t\tlet ddfx = tmpx * 2 + dddfx, ddfy = tmpy * 2 + dddfy;\r\n\t\tlet dfx = cx1 * 0.3 + tmpx + dddfx * 0.16666667, dfy = cy1 * 0.3 + tmpy + dddfy * 0.16666667;\r\n\r\n\t\tlet i = frameIndex * CurveTimeline.BEZIER_SIZE;\r\n\t\tlet curves = this.curves;\r\n\t\tcurves[i++] = CurveTimeline.BEZIER;\r\n\r\n\t\tlet x = dfx, y = dfy;\r\n\t\tfor (let n = i + CurveTimeline.BEZIER_SIZE - 1; i < n; i += 2) {\r\n\t\t\tcurves[i] = x;\r\n\t\t\tcurves[i + 1] = y;\r\n\t\t\tdfx += ddfx;\r\n\t\t\tdfy += ddfy;\r\n\t\t\tddfx += dddfx;\r\n\t\t\tddfy += dddfy;\r\n\t\t\tx += dfx;\r\n\t\t\ty += dfy;\r\n\t\t}\r\n\t}\r\n\r\n\t/** Returns the interpolated percentage for the specified key frame and linear percentage. */\r\n\tgetCurvePercent (frameIndex: number, percent: number) {\r\n\t\tpercent = MathUtils.clamp(percent, 0, 1);\r\n\t\tlet curves = this.curves;\r\n\t\tlet i = frameIndex * CurveTimeline.BEZIER_SIZE;\r\n\t\tlet type = curves[i];\r\n\t\tif (type == CurveTimeline.LINEAR) return percent;\r\n\t\tif (type == CurveTimeline.STEPPED) return 0;\r\n\t\ti++;\r\n\t\tlet x = 0;\r\n\t\tfor (let start = i, n = i + CurveTimeline.BEZIER_SIZE - 1; i < n; i += 2) {\r\n\t\t\tx = curves[i];\r\n\t\t\tif (x >= percent) {\r\n\t\t\t\tlet prevX: number, prevY: number;\r\n\t\t\t\tif (i == start) {\r\n\t\t\t\t\tprevX = 0;\r\n\t\t\t\t\tprevY = 0;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tprevX = curves[i - 2];\r\n\t\t\t\t\tprevY = curves[i - 1];\r\n\t\t\t\t}\r\n\t\t\t\treturn prevY + (curves[i + 1] - prevY) * (percent - prevX) / (x - prevX);\r\n\t\t\t}\r\n\t\t}\r\n\t\tlet y = curves[i - 1];\r\n\t\treturn y + (1 - y) * (percent - x) / (1 - x); // Last point is 1,1.\r\n\t}\r\n\r\n\tabstract apply (skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;\r\n}\r\n\r\n/** Changes a bone's local {@link Bone#rotation}. */\r\nexport class RotateTimeline extends CurveTimeline {\r\n\tstatic ENTRIES = 2;\r\n\tstatic PREV_TIME = -2; static PREV_ROTATION = -1;\r\n\tstatic ROTATION = 1;\r\n\r\n\t/** The index of the bone in {@link Skeleton#bones} that will be changed. */\r\n\tboneIndex: number;\r\n\r\n\t/** The time in seconds and rotation in degrees for each key frame. */\r\n\tframes: ArrayLike<number>; // time, degrees, ...\r\n\r\n\tconstructor (frameCount: number) {\r\n\t\tsuper(frameCount);\r\n\t\tthis.frames = Utils.newFloatArray(frameCount << 1);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn (TimelineType.rotate << 24) + this.boneIndex;\r\n\t}\r\n\r\n\t/** Sets the time and angle of the specified keyframe. */\r\n\tsetFrame (frameIndex: number, time: number, degrees: number) {\r\n\t\tframeIndex <<= 1;\r\n\t\tthis.frames[frameIndex] = time;\r\n\t\tthis.frames[frameIndex + RotateTimeline.ROTATION] = degrees;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet frames = this.frames;\r\n\r\n\t\tlet bone = skeleton.bones[this.boneIndex];\r\n\t\tif (!bone.active) return;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup:\r\n\t\t\t\tbone.rotation = bone.data.rotation;\r\n\t\t\t\treturn;\r\n\t\t\tcase MixBlend.first:\r\n\t\t\t\tlet r = bone.data.rotation - bone.rotation;\r\n\t\t\t\tbone.rotation += (r - (16384 - ((16384.499999999996 - r / 360) | 0)) * 360) * alpha;\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (time >= frames[frames.length - RotateTimeline.ENTRIES]) { // Time is after last frame.\r\n\t\t\tlet r = frames[frames.length + RotateTimeline.PREV_ROTATION];\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup:\r\n\t\t\t\tbone.rotation = bone.data.rotation + r * alpha;\r\n\t\t\t\tbreak;\r\n\t\t\tcase MixBlend.first:\r\n\t\t\tcase MixBlend.replace:\r\n\t\t\t\tr += bone.data.rotation - bone.rotation;\r\n\t\t\t\tr -= (16384 - ((16384.499999999996 - r / 360) | 0)) * 360; // Wrap within -180 and 180.\r\n\t\t\tcase MixBlend.add:\r\n\t\t\t\tbone.rotation += r * alpha;\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Interpolate between the previous frame and the current frame.\r\n\t\tlet frame = Animation.binarySearch(frames, time, RotateTimeline.ENTRIES);\r\n\t\tlet prevRotation = frames[frame + RotateTimeline.PREV_ROTATION];\r\n\t\tlet frameTime = frames[frame];\r\n\t\tlet percent = this.getCurvePercent((frame >> 1) - 1,\r\n\t\t\t1 - (time - frameTime) / (frames[frame + RotateTimeline.PREV_TIME] - frameTime));\r\n\r\n\t\tlet r = frames[frame + RotateTimeline.ROTATION] - prevRotation;\r\n\t\tr = prevRotation + (r - (16384 - ((16384.499999999996 - r / 360) | 0)) * 360) * percent;\r\n\t\tswitch (blend) {\r\n\t\tcase MixBlend.setup:\r\n\t\t\tbone.rotation = bone.data.rotation + (r - (16384 - ((16384.499999999996 - r / 360) | 0)) * 360) * alpha;\r\n\t\t\tbreak;\r\n\t\tcase MixBlend.first:\r\n\t\tcase MixBlend.replace:\r\n\t\t\tr += bone.data.rotation - bone.rotation;\r\n\t\tcase MixBlend.add:\r\n\t\t\tbone.rotation += (r - (16384 - ((16384.499999999996 - r / 360) | 0)) * 360) * alpha;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/** Changes a bone's local {@link Bone#x} and {@link Bone#y}. */\r\nexport class TranslateTimeline extends CurveTimeline {\r\n\tstatic ENTRIES = 3;\r\n\tstatic PREV_TIME = -3; static PREV_X = -2; static PREV_Y = -1;\r\n\tstatic X = 1; static Y = 2;\r\n\r\n\t/** The index of the bone in {@link Skeleton#bones} that will be changed. */\r\n\tboneIndex: number;\r\n\r\n\t/** The time in seconds, x, and y values for each key frame. */\r\n\tframes: ArrayLike<number>; // time, x, y, ...\r\n\r\n\tconstructor (frameCount: number) {\r\n\t\tsuper(frameCount);\r\n\t\tthis.frames = Utils.newFloatArray(frameCount * TranslateTimeline.ENTRIES);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn (TimelineType.translate << 24) + this.boneIndex;\r\n\t}\r\n\r\n\t/** Sets the time in seconds, x, and y values for the specified key frame. */\r\n\tsetFrame (frameIndex: number, time: number, x: number, y: number) {\r\n\t\tframeIndex *= TranslateTimeline.ENTRIES;\r\n\t\tthis.frames[frameIndex] = time;\r\n\t\tthis.frames[frameIndex + TranslateTimeline.X] = x;\r\n\t\tthis.frames[frameIndex + TranslateTimeline.Y] = y;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet frames = this.frames;\r\n\r\n\t\tlet bone = skeleton.bones[this.boneIndex];\r\n\t\tif (!bone.active) return;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup:\r\n\t\t\t\tbone.x = bone.data.x;\r\n\t\t\t\tbone.y = bone.data.y;\r\n\t\t\t\treturn;\r\n\t\t\tcase MixBlend.first:\r\n\t\t\t\tbone.x += (bone.data.x - bone.x) * alpha;\r\n\t\t\t\tbone.y += (bone.data.y - bone.y) * alpha;\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet x = 0, y = 0;\r\n\t\tif (time >= frames[frames.length - TranslateTimeline.ENTRIES]) { // Time is after last frame.\r\n\t\t\tx = frames[frames.length + TranslateTimeline.PREV_X];\r\n\t\t\ty = frames[frames.length + TranslateTimeline.PREV_Y];\r\n\t\t} else {\r\n\t\t\t// Interpolate between the previous frame and the current frame.\r\n\t\t\tlet frame = Animation.binarySearch(frames, time, TranslateTimeline.ENTRIES);\r\n\t\t\tx = frames[frame + TranslateTimeline.PREV_X];\r\n\t\t\ty = frames[frame + TranslateTimeline.PREV_Y];\r\n\t\t\tlet frameTime = frames[frame];\r\n\t\t\tlet percent = this.getCurvePercent(frame / TranslateTimeline.ENTRIES - 1,\r\n\t\t\t\t1 - (time - frameTime) / (frames[frame + TranslateTimeline.PREV_TIME] - frameTime));\r\n\r\n\t\t\tx += (frames[frame + TranslateTimeline.X] - x) * percent;\r\n\t\t\ty += (frames[frame + TranslateTimeline.Y] - y) * percent;\r\n\t\t}\r\n\t\tswitch (blend) {\r\n\t\tcase MixBlend.setup:\r\n\t\t\tbone.x = bone.data.x + x * alpha;\r\n\t\t\tbone.y = bone.data.y + y * alpha;\r\n\t\t\tbreak;\r\n\t\tcase MixBlend.first:\r\n\t\tcase MixBlend.replace:\r\n\t\t\tbone.x += (bone.data.x + x - bone.x) * alpha;\r\n\t\t\tbone.y += (bone.data.y + y - bone.y) * alpha;\r\n\t\t\tbreak;\r\n\t\tcase MixBlend.add:\r\n\t\t\tbone.x += x * alpha;\r\n\t\t\tbone.y += y * alpha;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/** Changes a bone's local {@link Bone#scaleX)} and {@link Bone#scaleY}. */\r\nexport class ScaleTimeline extends TranslateTimeline {\r\n\tconstructor (frameCount: number) {\r\n\t\tsuper(frameCount);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn (TimelineType.scale << 24) + this.boneIndex;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet frames = this.frames;\r\n\r\n\t\tlet bone = skeleton.bones[this.boneIndex];\r\n\t\tif (!bone.active) return;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup:\r\n\t\t\t\tbone.scaleX = bone.data.scaleX;\r\n\t\t\t\tbone.scaleY = bone.data.scaleY;\r\n\t\t\t\treturn;\r\n\t\t\tcase MixBlend.first:\r\n\t\t\t\tbone.scaleX += (bone.data.scaleX - bone.scaleX) * alpha;\r\n\t\t\t\tbone.scaleY += (bone.data.scaleY - bone.scaleY) * alpha;\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet x = 0, y = 0;\r\n\t\tif (time >= frames[frames.length - ScaleTimeline.ENTRIES]) { // Time is after last frame.\r\n\t\t\tx = frames[frames.length + ScaleTimeline.PREV_X] * bone.data.scaleX;\r\n\t\t\ty = frames[frames.length + ScaleTimeline.PREV_Y] * bone.data.scaleY;\r\n\t\t} else {\r\n\t\t\t// Interpolate between the previous frame and the current frame.\r\n\t\t\tlet frame = Animation.binarySearch(frames, time, ScaleTimeline.ENTRIES);\r\n\t\t\tx = frames[frame + ScaleTimeline.PREV_X];\r\n\t\t\ty = frames[frame + ScaleTimeline.PREV_Y];\r\n\t\t\tlet frameTime = frames[frame];\r\n\t\t\tlet percent = this.getCurvePercent(frame / ScaleTimeline.ENTRIES - 1,\r\n\t\t\t\t1 - (time - frameTime) / (frames[frame + ScaleTimeline.PREV_TIME] - frameTime));\r\n\r\n\t\t\tx = (x + (frames[frame + ScaleTimeline.X] - x) * percent) * bone.data.scaleX;\r\n\t\t\ty = (y + (frames[frame + ScaleTimeline.Y] - y) * percent) * bone.data.scaleY;\r\n\t\t}\r\n\t\tif (alpha == 1) {\r\n\t\t\tif (blend == MixBlend.add) {\r\n\t\t\t\tbone.scaleX += x - bone.data.scaleX;\r\n\t\t\t\tbone.scaleY += y - bone.data.scaleY;\r\n\t\t\t} else {\r\n\t\t\t\tbone.scaleX = x;\r\n\t\t\t\tbone.scaleY = y;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tlet bx = 0, by = 0;\r\n\t\t\tif (direction == MixDirection.mixOut) {\r\n\t\t\t\tswitch (blend) {\r\n\t\t\t\tcase MixBlend.setup:\r\n\t\t\t\t\tbx = bone.data.scaleX;\r\n\t\t\t\t\tby = bone.data.scaleY;\r\n\t\t\t\t\tbone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha;\r\n\t\t\t\t\tbone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase MixBlend.first:\r\n\t\t\t\tcase MixBlend.replace:\r\n\t\t\t\t\tbx = bone.scaleX;\r\n\t\t\t\t\tby = bone.scaleY;\r\n\t\t\t\t\tbone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha;\r\n\t\t\t\t\tbone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase MixBlend.add:\r\n\t\t\t\t\tbx = bone.scaleX;\r\n\t\t\t\t\tby = bone.scaleY;\r\n\t\t\t\t\tbone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bone.data.scaleX) * alpha;\r\n\t\t\t\t\tbone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - bone.data.scaleY) * alpha;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tswitch (blend) {\r\n\t\t\t\tcase MixBlend.setup:\r\n\t\t\t\t\tbx = Math.abs(bone.data.scaleX) * MathUtils.signum(x);\r\n\t\t\t\t\tby = Math.abs(bone.data.scaleY) * MathUtils.signum(y);\r\n\t\t\t\t\tbone.scaleX = bx + (x - bx) * alpha;\r\n\t\t\t\t\tbone.scaleY = by + (y - by) * alpha;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase MixBlend.first:\r\n\t\t\t\tcase MixBlend.replace:\r\n\t\t\t\t\tbx = Math.abs(bone.scaleX) * MathUtils.signum(x);\r\n\t\t\t\t\tby = Math.abs(bone.scaleY) * MathUtils.signum(y);\r\n\t\t\t\t\tbone.scaleX = bx + (x - bx) * alpha;\r\n\t\t\t\t\tbone.scaleY = by + (y - by) * alpha;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase MixBlend.add:\r\n\t\t\t\t\tbx = MathUtils.signum(x);\r\n\t\t\t\t\tby = MathUtils.signum(y);\r\n\t\t\t\t\tbone.scaleX = Math.abs(bone.scaleX) * bx + (x - Math.abs(bone.data.scaleX) * bx) * alpha;\r\n\t\t\t\t\tbone.scaleY = Math.abs(bone.scaleY) * by + (y - Math.abs(bone.data.scaleY) * by) * alpha;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/** Changes a bone's local {@link Bone#shearX} and {@link Bone#shearY}. */\r\nexport class ShearTimeline extends TranslateTimeline {\r\n\tconstructor (frameCount: number) {\r\n\t\tsuper(frameCount);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn (TimelineType.shear << 24) + this.boneIndex;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet frames = this.frames;\r\n\r\n\t\tlet bone = skeleton.bones[this.boneIndex];\r\n\t\tif (!bone.active) return;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup:\r\n\t\t\t\tbone.shearX = bone.data.shearX;\r\n\t\t\t\tbone.shearY = bone.data.shearY;\r\n\t\t\t\treturn;\r\n\t\t\tcase MixBlend.first:\r\n\t\t\t\tbone.shearX += (bone.data.shearX - bone.shearX) * alpha;\r\n\t\t\t\tbone.shearY += (bone.data.shearY - bone.shearY) * alpha;\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet x = 0, y = 0;\r\n\t\tif (time >= frames[frames.length - ShearTimeline.ENTRIES]) { // Time is after last frame.\r\n\t\t\tx = frames[frames.length + ShearTimeline.PREV_X];\r\n\t\t\ty = frames[frames.length + ShearTimeline.PREV_Y];\r\n\t\t} else {\r\n\t\t\t// Interpolate between the previous frame and the current frame.\r\n\t\t\tlet frame = Animation.binarySearch(frames, time, ShearTimeline.ENTRIES);\r\n\t\t\tx = frames[frame + ShearTimeline.PREV_X];\r\n\t\t\ty = frames[frame + ShearTimeline.PREV_Y];\r\n\t\t\tlet frameTime = frames[frame];\r\n\t\t\tlet percent = this.getCurvePercent(frame / ShearTimeline.ENTRIES - 1,\r\n\t\t\t\t1 - (time - frameTime) / (frames[frame + ShearTimeline.PREV_TIME] - frameTime));\r\n\r\n\t\t\tx = x + (frames[frame + ShearTimeline.X] - x) * percent;\r\n\t\t\ty = y + (frames[frame + ShearTimeline.Y] - y) * percent;\r\n\t\t}\r\n\t\tswitch (blend) {\r\n\t\tcase MixBlend.setup:\r\n\t\t\tbone.shearX = bone.data.shearX + x * alpha;\r\n\t\t\tbone.shearY = bone.data.shearY + y * alpha;\r\n\t\t\tbreak;\r\n\t\tcase MixBlend.first:\r\n\t\tcase MixBlend.replace:\r\n\t\t\tbone.shearX += (bone.data.shearX + x - bone.shearX) * alpha;\r\n\t\t\tbone.shearY += (bone.data.shearY + y - bone.shearY) * alpha;\r\n\t\t\tbreak;\r\n\t\tcase MixBlend.add:\r\n\t\t\tbone.shearX += x * alpha;\r\n\t\t\tbone.shearY += y * alpha;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/** Changes a slot's {@link Slot#color}. */\r\nexport class ColorTimeline extends CurveTimeline {\r\n\tstatic ENTRIES = 5;\r\n\tstatic PREV_TIME = -5; static PREV_R = -4; static PREV_G = -3; static PREV_B = -2; static PREV_A = -1;\r\n\tstatic R = 1; static G = 2; static B = 3; static A = 4;\r\n\r\n\t/** The index of the slot in {@link Skeleton#slots} that will be changed. */\r\n\tslotIndex: number;\r\n\r\n\t/** The time in seconds, red, green, blue, and alpha values for each key frame. */\r\n\tframes: ArrayLike<number>; // time, r, g, b, a, ...\r\n\r\n\tconstructor (frameCount: number) {\r\n\t\tsuper(frameCount);\r\n\t\tthis.frames = Utils.newFloatArray(frameCount * ColorTimeline.ENTRIES);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn (TimelineType.color << 24) + this.slotIndex;\r\n\t}\r\n\r\n\t/** Sets the time in seconds, red, green, blue, and alpha for the specified key frame. */\r\n\tsetFrame (frameIndex: number, time: number, r: number, g: number, b: number, a: number) {\r\n\t\tframeIndex *= ColorTimeline.ENTRIES;\r\n\t\tthis.frames[frameIndex] = time;\r\n\t\tthis.frames[frameIndex + ColorTimeline.R] = r;\r\n\t\tthis.frames[frameIndex + ColorTimeline.G] = g;\r\n\t\tthis.frames[frameIndex + ColorTimeline.B] = b;\r\n\t\tthis.frames[frameIndex + ColorTimeline.A] = a;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet slot = skeleton.slots[this.slotIndex];\r\n\t\tif (!slot.bone.active) return;\r\n\t\tlet frames = this.frames;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup:\r\n\t\t\t\tslot.color.setFromColor(slot.data.color);\r\n\t\t\t\treturn;\r\n\t\t\tcase MixBlend.first:\r\n\t\t\t\tlet color = slot.color, setup = slot.data.color;\r\n\t\t\t\tcolor.add((setup.r - color.r) * alpha, (setup.g - color.g) * alpha, (setup.b - color.b) * alpha,\r\n\t\t\t\t\t(setup.a - color.a) * alpha);\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet r = 0, g = 0, b = 0, a = 0;\r\n\t\tif (time >= frames[frames.length - ColorTimeline.ENTRIES]) { // Time is after last frame.\r\n\t\t\tlet i = frames.length;\r\n\t\t\tr = frames[i + ColorTimeline.PREV_R];\r\n\t\t\tg = frames[i + ColorTimeline.PREV_G];\r\n\t\t\tb = frames[i + ColorTimeline.PREV_B];\r\n\t\t\ta = frames[i + ColorTimeline.PREV_A];\r\n\t\t} else {\r\n\t\t\t// Interpolate between the previous frame and the current frame.\r\n\t\t\tlet frame = Animation.binarySearch(frames, time, ColorTimeline.ENTRIES);\r\n\t\t\tr = frames[frame + ColorTimeline.PREV_R];\r\n\t\t\tg = frames[frame + ColorTimeline.PREV_G];\r\n\t\t\tb = frames[frame + ColorTimeline.PREV_B];\r\n\t\t\ta = frames[frame + ColorTimeline.PREV_A];\r\n\t\t\tlet frameTime = frames[frame];\r\n\t\t\tlet percent = this.getCurvePercent(frame / ColorTimeline.ENTRIES - 1,\r\n\t\t\t\t1 - (time - frameTime) / (frames[frame + ColorTimeline.PREV_TIME] - frameTime));\r\n\r\n\t\t\tr += (frames[frame + ColorTimeline.R] - r) * percent;\r\n\t\t\tg += (frames[frame + ColorTimeline.G] - g) * percent;\r\n\t\t\tb += (frames[frame + ColorTimeline.B] - b) * percent;\r\n\t\t\ta += (frames[frame + ColorTimeline.A] - a) * percent;\r\n\t\t}\r\n\t\tif (alpha == 1)\r\n\t\t\tslot.color.set(r, g, b, a);\r\n\t\telse {\r\n\t\t\tlet color = slot.color;\r\n\t\t\tif (blend == MixBlend.setup) color.setFromColor(slot.data.color);\r\n\t\t\tcolor.add((r - color.r) * alpha, (g - color.g) * alpha, (b - color.b) * alpha, (a - color.a) * alpha);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/** Changes a slot's {@link Slot#color} and {@link Slot#darkColor} for two color tinting. */\r\nexport class TwoColorTimeline extends CurveTimeline {\r\n\tstatic ENTRIES = 8;\r\n\tstatic PREV_TIME = -8; static PREV_R = -7; static PREV_G = -6; static PREV_B = -5; static PREV_A = -4;\r\n\tstatic PREV_R2 = -3; static PREV_G2 = -2; static PREV_B2 = -1;\r\n\tstatic R = 1; static G = 2; static B = 3; static A = 4; static R2 = 5; static G2 = 6; static B2 = 7;\r\n\r\n\t/** The index of the slot in {@link Skeleton#slots()} that will be changed. The {@link Slot#darkColor()} must not be\r\n\t * null. */\r\n\tslotIndex: number;\r\n\r\n\t/** The time in seconds, red, green, blue, and alpha values of the color, red, green, blue of the dark color, for each key frame. */\r\n\tframes: ArrayLike<number>; // time, r, g, b, a, r2, g2, b2, ...\r\n\r\n\tconstructor (frameCount: number) {\r\n\t\tsuper(frameCount);\r\n\t\tthis.frames = Utils.newFloatArray(frameCount * TwoColorTimeline.ENTRIES);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn (TimelineType.twoColor << 24) + this.slotIndex;\r\n\t}\r\n\r\n\t/** Sets the time in seconds, light, and dark colors for the specified key frame. */\r\n\tsetFrame (frameIndex: number, time: number, r: number, g: number, b: number, a: number, r2: number, g2: number, b2: number) {\r\n\t\tframeIndex *= TwoColorTimeline.ENTRIES;\r\n\t\tthis.frames[frameIndex] = time;\r\n\t\tthis.frames[frameIndex + TwoColorTimeline.R] = r;\r\n\t\tthis.frames[frameIndex + TwoColorTimeline.G] = g;\r\n\t\tthis.frames[frameIndex + TwoColorTimeline.B] = b;\r\n\t\tthis.frames[frameIndex + TwoColorTimeline.A] = a;\r\n\t\tthis.frames[frameIndex + TwoColorTimeline.R2] = r2;\r\n\t\tthis.frames[frameIndex + TwoColorTimeline.G2] = g2;\r\n\t\tthis.frames[frameIndex + TwoColorTimeline.B2] = b2;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet slot = skeleton.slots[this.slotIndex];\r\n\t\tif (!slot.bone.active) return;\r\n\t\tlet frames = this.frames;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup:\r\n\t\t\t\tslot.color.setFromColor(slot.data.color);\r\n\t\t\t\tslot.darkColor.setFromColor(slot.data.darkColor);\r\n\t\t\t\treturn;\r\n\t\t\tcase MixBlend.first:\r\n\t\t\t\tlet light = slot.color, dark = slot.darkColor, setupLight = slot.data.color, setupDark = slot.data.darkColor;\r\n\t\t\t\tlight.add((setupLight.r - light.r) * alpha, (setupLight.g - light.g) * alpha, (setupLight.b - light.b) * alpha,\r\n\t\t\t\t\t(setupLight.a - light.a) * alpha);\r\n\t\t\t\tdark.add((setupDark.r - dark.r) * alpha, (setupDark.g - dark.g) * alpha, (setupDark.b - dark.b) * alpha, 0);\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet r = 0, g = 0, b = 0, a = 0, r2 = 0, g2 = 0, b2 = 0;\r\n\t\tif (time >= frames[frames.length - TwoColorTimeline.ENTRIES]) { // Time is after last frame.\r\n\t\t\tlet i = frames.length;\r\n\t\t\tr = frames[i + TwoColorTimeline.PREV_R];\r\n\t\t\tg = frames[i + TwoColorTimeline.PREV_G];\r\n\t\t\tb = frames[i + TwoColorTimeline.PREV_B];\r\n\t\t\ta = frames[i + TwoColorTimeline.PREV_A];\r\n\t\t\tr2 = frames[i + TwoColorTimeline.PREV_R2];\r\n\t\t\tg2 = frames[i + TwoColorTimeline.PREV_G2];\r\n\t\t\tb2 = frames[i + TwoColorTimeline.PREV_B2];\r\n\t\t} else {\r\n\t\t\t// Interpolate between the previous frame and the current frame.\r\n\t\t\tlet frame = Animation.binarySearch(frames, time, TwoColorTimeline.ENTRIES);\r\n\t\t\tr = frames[frame + TwoColorTimeline.PREV_R];\r\n\t\t\tg = frames[frame + TwoColorTimeline.PREV_G];\r\n\t\t\tb = frames[frame + TwoColorTimeline.PREV_B];\r\n\t\t\ta = frames[frame + TwoColorTimeline.PREV_A];\r\n\t\t\tr2 = frames[frame + TwoColorTimeline.PREV_R2];\r\n\t\t\tg2 = frames[frame + TwoColorTimeline.PREV_G2];\r\n\t\t\tb2 = frames[frame + TwoColorTimeline.PREV_B2];\r\n\t\t\tlet frameTime = frames[frame];\r\n\t\t\tlet percent = this.getCurvePercent(frame / TwoColorTimeline.ENTRIES - 1,\r\n\t\t\t\t1 - (time - frameTime) / (frames[frame + TwoColorTimeline.PREV_TIME] - frameTime));\r\n\r\n\t\t\tr += (frames[frame + TwoColorTimeline.R] - r) * percent;\r\n\t\t\tg += (frames[frame + TwoColorTimeline.G] - g) * percent;\r\n\t\t\tb += (frames[frame + TwoColorTimeline.B] - b) * percent;\r\n\t\t\ta += (frames[frame + TwoColorTimeline.A] - a) * percent;\r\n\t\t\tr2 += (frames[frame + TwoColorTimeline.R2] - r2) * percent;\r\n\t\t\tg2 += (frames[frame + TwoColorTimeline.G2] - g2) * percent;\r\n\t\t\tb2 += (frames[frame + TwoColorTimeline.B2] - b2) * percent;\r\n\t\t}\r\n\t\tif (alpha == 1) {\r\n\t\t\tslot.color.set(r, g, b, a);\r\n\t\t\tslot.darkColor.set(r2, g2, b2, 1);\r\n\t\t} else {\r\n\t\t\tlet light = slot.color, dark = slot.darkColor;\r\n\t\t\tif (blend == MixBlend.setup) {\r\n\t\t\t\tlight.setFromColor(slot.data.color);\r\n\t\t\t\tdark.setFromColor(slot.data.darkColor);\r\n\t\t\t}\r\n\t\t\tlight.add((r - light.r) * alpha, (g - light.g) * alpha, (b - light.b) * alpha, (a - light.a) * alpha);\r\n\t\t\tdark.add((r2 - dark.r) * alpha, (g2 - dark.g) * alpha, (b2 - dark.b) * alpha, 0);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/** Changes a slot's {@link Slot#attachment}. */\r\nexport class AttachmentTimeline implements Timeline {\r\n\t/** The index of the slot in {@link Skeleton#slots} that will be changed. */\r\n\tslotIndex: number;\r\n\r\n\t/** The time in seconds for each key frame. */\r\n\tframes: ArrayLike<number> // time, ...\r\n\r\n\t/** The attachment name for each key frame. May contain null values to clear the attachment. */\r\n\tattachmentNames: Array<string>;\r\n\r\n\tconstructor (frameCount: number) {\r\n\t\tthis.frames = Utils.newFloatArray(frameCount);\r\n\t\tthis.attachmentNames = new Array<string>(frameCount);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn (TimelineType.attachment << 24) + this.slotIndex;\r\n\t}\r\n\r\n\t/** The number of key frames for this timeline. */\r\n\tgetFrameCount () {\r\n\t\treturn this.frames.length;\r\n\t}\r\n\r\n\t/** Sets the time in seconds and the attachment name for the specified key frame. */\r\n\tsetFrame (frameIndex: number, time: number, attachmentName: string) {\r\n\t\tthis.frames[frameIndex] = time;\r\n\t\tthis.attachmentNames[frameIndex] = attachmentName;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet slot = skeleton.slots[this.slotIndex];\r\n\t\tif (!slot.bone.active) return;\r\n\t\tif (direction == MixDirection.mixOut) {\r\n\t\t\tif (blend == MixBlend.setup)\r\n\t\t\t\tthis.setAttachment(skeleton, slot, slot.data.attachmentName);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet frames = this.frames;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tif (blend == MixBlend.setup || blend == MixBlend.first) this.setAttachment(skeleton, slot, slot.data.attachmentName);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet frameIndex = 0;\r\n\t\tif (time >= frames[frames.length - 1]) // Time is after last frame.\r\n\t\t\tframeIndex = frames.length - 1;\r\n\t\telse\r\n\t\t\tframeIndex = Animation.binarySearch(frames, time, 1) - 1;\r\n\r\n\t\tlet attachmentName = this.attachmentNames[frameIndex];\r\n\t\tskeleton.slots[this.slotIndex]\r\n\t\t\t.setAttachment(attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName));\r\n\t}\r\n\r\n\tsetAttachment(skeleton: Skeleton, slot: Slot, attachmentName: string) {\r\n\t\tslot.attachment = attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName);\r\n\t}\r\n}\r\n\r\nlet zeros : ArrayLike<number> = null;\r\n\r\n/** Changes a slot's {@link Slot#deform} to deform a {@link VertexAttachment}. */\r\nexport class DeformTimeline extends CurveTimeline {\r\n\t/** The index of the slot in {@link Skeleton#getSlots()} that will be changed. */\r\n\tslotIndex: number;\r\n\r\n\t/** The attachment that will be deformed. */\r\n\tattachment: VertexAttachment;\r\n\r\n\t/** The time in seconds for each key frame. */\r\n\tframes: ArrayLike<number>; // time, ...\r\n\r\n\t/** The vertices for each key frame. */\r\n\tframeVertices: Array<ArrayLike<number>>;\r\n\r\n\tconstructor (frameCount: number) {\r\n\t\tsuper(frameCount);\r\n\t\tthis.frames = Utils.newFloatArray(frameCount);\r\n\t\tthis.frameVertices = new Array<ArrayLike<number>>(frameCount);\r\n\t\tif (zeros == null) zeros = Utils.newFloatArray(64);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn (TimelineType.deform << 27) + + this.attachment.id + this.slotIndex;\r\n\t}\r\n\r\n\t/** Sets the time in seconds and the vertices for the specified key frame.\r\n\t * @param vertices Vertex positions for an unweighted VertexAttachment, or deform offsets if it has weights. */\r\n\tsetFrame (frameIndex: number, time: number, vertices: ArrayLike<number>) {\r\n\t\tthis.frames[frameIndex] = time;\r\n\t\tthis.frameVertices[frameIndex] = vertices;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet slot: Slot = skeleton.slots[this.slotIndex];\r\n\t\tif (!slot.bone.active) return;\r\n\t\tlet slotAttachment: Attachment = slot.getAttachment();\r\n\t\tif (!(slotAttachment instanceof VertexAttachment) || !((<VertexAttachment>slotAttachment).deformAttachment == this.attachment)) return;\r\n\r\n\t\tlet deformArray: Array<number> = slot.deform;\r\n\t\tif (deformArray.length == 0) blend = MixBlend.setup;\r\n\r\n\t\tlet frameVertices = this.frameVertices;\r\n\t\tlet vertexCount = frameVertices[0].length;\r\n\r\n\t\tlet frames = this.frames;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tlet vertexAttachment = <VertexAttachment>slotAttachment;\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup:\r\n\t\t\t\tdeformArray.length = 0;\r\n\t\t\t\treturn;\r\n\t\t\tcase MixBlend.first:\r\n\t\t\t\tif (alpha == 1) {\r\n\t\t\t\t\tdeformArray.length = 0;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tlet deform: Array<number> = Utils.setArraySize(deformArray, vertexCount);\r\n\t\t\t\tif (vertexAttachment.bones == null) {\r\n\t\t\t\t\t// Unweighted vertex positions.\r\n\t\t\t\t\tlet setupVertices = vertexAttachment.vertices;\r\n\t\t\t\t\tfor (var i = 0; i < vertexCount; i++)\r\n\t\t\t\t\t\tdeform[i] += (setupVertices[i] - deform[i]) * alpha;\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// Weighted deform offsets.\r\n\t\t\t\t\talpha = 1 - alpha;\r\n\t\t\t\t\tfor (var i = 0; i < vertexCount; i++)\r\n\t\t\t\t\t\tdeform[i] *= alpha;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet deform: Array<number> = Utils.setArraySize(deformArray, vertexCount);\r\n\t\tif (time >= frames[frames.length - 1]) { // Time is after last frame.\r\n\t\t\tlet lastVertices = frameVertices[frames.length - 1];\r\n\t\t\tif (alpha == 1) {\r\n\t\t\t\tif (blend == MixBlend.add) {\r\n\t\t\t\t\tlet vertexAttachment = slotAttachment as VertexAttachment;\r\n\t\t\t\t\tif (vertexAttachment.bones == null) {\r\n\t\t\t\t\t\t// Unweighted vertex positions, with alpha.\r\n\t\t\t\t\t\tlet setupVertices = vertexAttachment.vertices;\r\n\t\t\t\t\t\tfor (let i = 0; i < vertexCount; i++) {\r\n\t\t\t\t\t\t\tdeform[i] += lastVertices[i] - setupVertices[i];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// Weighted deform offsets, with alpha.\r\n\t\t\t\t\t\tfor (let i = 0; i < vertexCount; i++)\r\n\t\t\t\t\t\t\tdeform[i] += lastVertices[i];\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tUtils.arrayCopy(lastVertices, 0, deform, 0, vertexCount);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tswitch (blend) {\r\n\t\t\t\tcase MixBlend.setup: {\r\n\t\t\t\t\tlet vertexAttachment = slotAttachment as VertexAttachment;\r\n\t\t\t\t\tif (vertexAttachment.bones == null) {\r\n\t\t\t\t\t\t// Unweighted vertex positions, with alpha.\r\n\t\t\t\t\t\tlet setupVertices = vertexAttachment.vertices;\r\n\t\t\t\t\t\tfor (let i = 0; i < vertexCount; i++) {\r\n\t\t\t\t\t\t\tlet setup = setupVertices[i];\r\n\t\t\t\t\t\t\tdeform[i] = setup + (lastVertices[i] - setup) * alpha;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// Weighted deform offsets, with alpha.\r\n\t\t\t\t\t\tfor (let i = 0; i < vertexCount; i++)\r\n\t\t\t\t\t\t\tdeform[i] = lastVertices[i] * alpha;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tcase MixBlend.first:\r\n\t\t\t\tcase MixBlend.replace:\r\n\t\t\t\t\tfor (let i = 0; i < vertexCount; i++)\r\n\t\t\t\t\t\tdeform[i] += (lastVertices[i] - deform[i]) * alpha;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase MixBlend.add:\r\n\t\t\t\t\tlet vertexAttachment = slotAttachment as VertexAttachment;\r\n\t\t\t\t\tif (vertexAttachment.bones == null) {\r\n\t\t\t\t\t\t// Unweighted vertex positions, with alpha.\r\n\t\t\t\t\t\tlet setupVertices = vertexAttachment.vertices;\r\n\t\t\t\t\t\tfor (let i = 0; i < vertexCount; i++) {\r\n\t\t\t\t\t\t\tdeform[i] += (lastVertices[i] - setupVertices[i]) * alpha;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// Weighted deform offsets, with alpha.\r\n\t\t\t\t\t\tfor (let i = 0; i < vertexCount; i++)\r\n\t\t\t\t\t\t\tdeform[i] += lastVertices[i] * alpha;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Interpolate between the previous frame and the current frame.\r\n\t\tlet frame = Animation.binarySearch(frames, time);\r\n\t\tlet prevVertices = frameVertices[frame - 1];\r\n\t\tlet nextVertices = frameVertices[frame];\r\n\t\tlet frameTime = frames[frame];\r\n\t\tlet percent = this.getCurvePercent(frame - 1, 1 - (time - frameTime) / (frames[frame - 1] - frameTime));\r\n\r\n\t\tif (alpha == 1) {\r\n\t\t\tif (blend == MixBlend.add) {\r\n\t\t\t\tlet vertexAttachment = slotAttachment as VertexAttachment;\r\n\t\t\t\tif (vertexAttachment.bones == null) {\r\n\t\t\t\t\t// Unweighted vertex positions, with alpha.\r\n\t\t\t\t\tlet setupVertices = vertexAttachment.vertices;\r\n\t\t\t\t\tfor (let i = 0; i < vertexCount; i++) {\r\n\t\t\t\t\t\tlet prev = prevVertices[i];\r\n\t\t\t\t\t\tdeform[i] += prev + (nextVertices[i] - prev) * percent - setupVertices[i];\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// Weighted deform offsets, with alpha.\r\n\t\t\t\t\tfor (let i = 0; i < vertexCount; i++) {\r\n\t\t\t\t\t\tlet prev = prevVertices[i];\r\n\t\t\t\t\t\tdeform[i] += prev + (nextVertices[i] - prev) * percent;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tfor (let i = 0; i < vertexCount; i++) {\r\n\t\t\t\t\tlet prev = prevVertices[i];\r\n\t\t\t\t\tdeform[i] = prev + (nextVertices[i] - prev) * percent;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup: {\r\n\t\t\t\tlet vertexAttachment = slotAttachment as VertexAttachment;\r\n\t\t\t\tif (vertexAttachment.bones == null) {\r\n\t\t\t\t\t// Unweighted vertex positions, with alpha.\r\n\t\t\t\t\tlet setupVertices = vertexAttachment.vertices;\r\n\t\t\t\t\tfor (let i = 0; i < vertexCount; i++) {\r\n\t\t\t\t\t\tlet prev = prevVertices[i], setup = setupVertices[i];\r\n\t\t\t\t\t\tdeform[i] = setup + (prev + (nextVertices[i] - prev) * percent - setup) * alpha;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// Weighted deform offsets, with alpha.\r\n\t\t\t\t\tfor (let i = 0; i < vertexCount; i++) {\r\n\t\t\t\t\t\tlet prev = prevVertices[i];\r\n\t\t\t\t\t\tdeform[i] = (prev + (nextVertices[i] - prev) * percent) * alpha;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tcase MixBlend.first:\r\n\t\t\tcase MixBlend.replace:\r\n\t\t\t\tfor (let i = 0; i < vertexCount; i++) {\r\n\t\t\t\t\tlet prev = prevVertices[i];\r\n\t\t\t\t\tdeform[i] += (prev + (nextVertices[i] - prev) * percent - deform[i]) * alpha;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase MixBlend.add:\r\n\t\t\t\tlet vertexAttachment = slotAttachment as VertexAttachment;\r\n\t\t\t\tif (vertexAttachment.bones == null) {\r\n\t\t\t\t\t// Unweighted vertex positions, with alpha.\r\n\t\t\t\t\tlet setupVertices = vertexAttachment.vertices;\r\n\t\t\t\t\tfor (let i = 0; i < vertexCount; i++) {\r\n\t\t\t\t\t\tlet prev = prevVertices[i];\r\n\t\t\t\t\t\tdeform[i] += (prev + (nextVertices[i] - prev) * percent - setupVertices[i]) * alpha;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// Weighted deform offsets, with alpha.\r\n\t\t\t\t\tfor (let i = 0; i < vertexCount; i++) {\r\n\t\t\t\t\t\tlet prev = prevVertices[i];\r\n\t\t\t\t\t\tdeform[i] += (prev + (nextVertices[i] - prev) * percent) * alpha;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/** Fires an {@link Event} when specific animation times are reached. */\r\nexport class EventTimeline implements Timeline {\r\n\t/** The time in seconds for each key frame. */\r\n\tframes: ArrayLike<number>; // time, ...\r\n\r\n\t/** The event for each key frame. */\r\n\tevents: Array<Event>;\r\n\r\n\tconstructor (frameCount: number) {\r\n\t\tthis.frames = Utils.newFloatArray(frameCount);\r\n\t\tthis.events = new Array<Event>(frameCount);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn TimelineType.event << 24;\r\n\t}\r\n\r\n\t/** The number of key frames for this timeline. */\r\n\tgetFrameCount () {\r\n\t\treturn this.frames.length;\r\n\t}\r\n\r\n\t/** Sets the time in seconds and the event for the specified key frame. */\r\n\tsetFrame (frameIndex: number, event: Event) {\r\n\t\tthis.frames[frameIndex] = event.time;\r\n\t\tthis.events[frameIndex] = event;\r\n\t}\r\n\r\n\t/** Fires events for frames > `lastTime` and <= `time`. */\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tif (firedEvents == null) return;\r\n\t\tlet frames = this.frames;\r\n\t\tlet frameCount = this.frames.length;\r\n\r\n\t\tif (lastTime > time) { // Fire events after last time for looped animations.\r\n\t\t\tthis.apply(skeleton, lastTime, Number.MAX_VALUE, firedEvents, alpha, blend, direction);\r\n\t\t\tlastTime = -1;\r\n\t\t} else if (lastTime >= frames[frameCount - 1]) // Last time is after last frame.\r\n\t\t\treturn;\r\n\t\tif (time < frames[0]) return; // Time is before first frame.\r\n\r\n\t\tlet frame = 0;\r\n\t\tif (lastTime < frames[0])\r\n\t\t\tframe = 0;\r\n\t\telse {\r\n\t\t\tframe = Animation.binarySearch(frames, lastTime);\r\n\t\t\tlet frameTime = frames[frame];\r\n\t\t\twhile (frame > 0) { // Fire multiple events with the same frame.\r\n\t\t\t\tif (frames[frame - 1] != frameTime) break;\r\n\t\t\t\tframe--;\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor (; frame < frameCount && time >= frames[frame]; frame++)\r\n\t\t\tfiredEvents.push(this.events[frame]);\r\n\t}\r\n}\r\n\r\n/** Changes a skeleton's {@link Skeleton#drawOrder}. */\r\nexport class DrawOrderTimeline implements Timeline {\r\n\t/** The time in seconds for each key frame. */\r\n\tframes: ArrayLike<number>; // time, ...\r\n\r\n\t/** The draw order for each key frame. See {@link #setFrame(int, float, int[])}. */\r\n\tdrawOrders: Array<Array<number>>;\r\n\r\n\tconstructor (frameCount: number) {\r\n\t\tthis.frames = Utils.newFloatArray(frameCount);\r\n\t\tthis.drawOrders = new Array<Array<number>>(frameCount);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn TimelineType.drawOrder << 24;\r\n\t}\r\n\r\n\t/** The number of key frames for this timeline. */\r\n\tgetFrameCount () {\r\n\t\treturn this.frames.length;\r\n\t}\r\n\r\n\t/** Sets the time in seconds and the draw order for the specified key frame.\r\n\t * @param drawOrder For each slot in {@link Skeleton#slots}, the index of the new draw order. May be null to use setup pose\r\n\t * draw order. */\r\n\tsetFrame (frameIndex: number, time: number, drawOrder: Array<number>) {\r\n\t\tthis.frames[frameIndex] = time;\r\n\t\tthis.drawOrders[frameIndex] = drawOrder;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet drawOrder: Array<Slot> = skeleton.drawOrder;\r\n\t\tlet slots: Array<Slot> = skeleton.slots;\r\n\t\tif (direction == MixDirection.mixOut) {\r\n\t\t\tif (blend == MixBlend.setup) Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet frames = this.frames;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tif (blend == MixBlend.setup || blend == MixBlend.first) Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet frame = 0;\r\n\t\tif (time >= frames[frames.length - 1]) // Time is after last frame.\r\n\t\t\tframe = frames.length - 1;\r\n\t\telse\r\n\t\t\tframe = Animation.binarySearch(frames, time) - 1;\r\n\r\n\t\tlet drawOrderToSetupIndex = this.drawOrders[frame];\r\n\t\tif (drawOrderToSetupIndex == null)\r\n\t\t\tUtils.arrayCopy(slots, 0, drawOrder, 0, slots.length);\r\n\t\telse {\r\n\t\t\tfor (let i = 0, n = drawOrderToSetupIndex.length; i < n; i++)\r\n\t\t\t\tdrawOrder[i] = slots[drawOrderToSetupIndex[i]];\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/** Changes an IK constraint's {@link IkConstraint#mix}, {@link IkConstraint#softness},\r\n * {@link IkConstraint#bendDirection}, {@link IkConstraint#stretch}, and {@link IkConstraint#compress}. */\r\nexport class IkConstraintTimeline extends CurveTimeline {\r\n\tstatic ENTRIES = 6;\r\n\tstatic PREV_TIME = -6; static PREV_MIX = -5; static PREV_SOFTNESS = -4; static PREV_BEND_DIRECTION = -3; static PREV_COMPRESS = -2; static PREV_STRETCH = -1;\r\n\tstatic MIX = 1; static SOFTNESS = 2; static BEND_DIRECTION = 3; static COMPRESS = 4; static STRETCH = 5;\r\n\r\n\t/** The index of the IK constraint slot in {@link Skeleton#ikConstraints} that will be changed. */\r\n\tikConstraintIndex: number;\r\n\r\n\t/** The time in seconds, mix, softness, bend direction, compress, and stretch for each key frame. */\r\n\tframes: ArrayLike<number>; // time, mix, softness, bendDirection, compress, stretch, ...\r\n\r\n\tconstructor (frameCount: number) {\r\n\t\tsuper(frameCount);\r\n\t\tthis.frames = Utils.newFloatArray(frameCount * IkConstraintTimeline.ENTRIES);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn (TimelineType.ikConstraint << 24) + this.ikConstraintIndex;\r\n\t}\r\n\r\n\t/** Sets the time in seconds, mix, softness, bend direction, compress, and stretch for the specified key frame. */\r\n\tsetFrame (frameIndex: number, time: number, mix: number, softness: number, bendDirection: number, compress: boolean, stretch: boolean) {\r\n\t\tframeIndex *= IkConstraintTimeline.ENTRIES;\r\n\t\tthis.frames[frameIndex] = time;\r\n\t\tthis.frames[frameIndex + IkConstraintTimeline.MIX] = mix;\r\n\t\tthis.frames[frameIndex + IkConstraintTimeline.SOFTNESS] = softness;\r\n\t\tthis.frames[frameIndex + IkConstraintTimeline.BEND_DIRECTION] = bendDirection;\r\n\t\tthis.frames[frameIndex + IkConstraintTimeline.COMPRESS] = compress ? 1 : 0;\r\n\t\tthis.frames[frameIndex + IkConstraintTimeline.STRETCH] = stretch ? 1 : 0;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet frames = this.frames;\r\n\t\tlet constraint: IkConstraint = skeleton.ikConstraints[this.ikConstraintIndex];\r\n\t\tif (!constraint.active) return;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup:\r\n\t\t\t\tconstraint.mix = constraint.data.mix;\r\n\t\t\t\tconstraint.softness = constraint.data.softness;\r\n\t\t\t\tconstraint.bendDirection = constraint.data.bendDirection;\r\n\t\t\t\tconstraint.compress = constraint.data.compress;\r\n\t\t\t\tconstraint.stretch = constraint.data.stretch;\r\n\t\t\t\treturn;\r\n\t\t\tcase MixBlend.first:\r\n\t\t\t\tconstraint.mix += (constraint.data.mix - constraint.mix) * alpha;\r\n\t\t\t\tconstraint.softness += (constraint.data.softness - constraint.softness) * alpha;\r\n\t\t\t\tconstraint.bendDirection = constraint.data.bendDirection;\r\n\t\t\t\tconstraint.compress = constraint.data.compress;\r\n\t\t\t\tconstraint.stretch = constraint.data.stretch;\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (time >= frames[frames.length - IkConstraintTimeline.ENTRIES]) { // Time is after last frame.\r\n\t\t\tif (blend == MixBlend.setup) {\r\n\t\t\t\tconstraint.mix = constraint.data.mix + (frames[frames.length + IkConstraintTimeline.PREV_MIX] - constraint.data.mix) * alpha;\r\n\t\t\t\tconstraint.softness = constraint.data.softness\r\n\t\t\t\t\t+ (frames[frames.length + IkConstraintTimeline.PREV_SOFTNESS] - constraint.data.softness) * alpha;\r\n\t\t\t\tif (direction == MixDirection.mixOut) {\r\n\t\t\t\t\tconstraint.bendDirection = constraint.data.bendDirection;\r\n\t\t\t\t\tconstraint.compress = constraint.data.compress;\r\n\t\t\t\t\tconstraint.stretch = constraint.data.stretch;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tconstraint.bendDirection = frames[frames.length + IkConstraintTimeline.PREV_BEND_DIRECTION]\r\n\t\t\t\t\tconstraint.compress = frames[frames.length + IkConstraintTimeline.PREV_COMPRESS] != 0;\r\n\t\t\t\t\tconstraint.stretch = frames[frames.length + IkConstraintTimeline.PREV_STRETCH] != 0;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tconstraint.mix += (frames[frames.length + IkConstraintTimeline.PREV_MIX] - constraint.mix) * alpha;\r\n\t\t\t\tconstraint.softness += (frames[frames.length + IkConstraintTimeline.PREV_SOFTNESS] - constraint.softness) * alpha;\r\n\t\t\t\tif (direction == MixDirection.mixIn) {\r\n\t\t\t\t\tconstraint.bendDirection = frames[frames.length + IkConstraintTimeline.PREV_BEND_DIRECTION];\r\n\t\t\t\t\tconstraint.compress = frames[frames.length + IkConstraintTimeline.PREV_COMPRESS] != 0;\r\n\t\t\t\t\tconstraint.stretch = frames[frames.length + IkConstraintTimeline.PREV_STRETCH] != 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Interpolate between the previous frame and the current frame.\r\n\t\tlet frame = Animation.binarySearch(frames, time, IkConstraintTimeline.ENTRIES);\r\n\t\tlet mix = frames[frame + IkConstraintTimeline.PREV_MIX];\r\n\t\tlet softness = frames[frame + IkConstraintTimeline.PREV_SOFTNESS];\r\n\t\tlet frameTime = frames[frame];\r\n\t\tlet percent = this.getCurvePercent(frame / IkConstraintTimeline.ENTRIES - 1,\r\n\t\t\t1 - (time - frameTime) / (frames[frame + IkConstraintTimeline.PREV_TIME] - frameTime));\r\n\r\n\t\tif (blend == MixBlend.setup) {\r\n\t\t\tconstraint.mix = constraint.data.mix + (mix + (frames[frame + IkConstraintTimeline.MIX] - mix) * percent - constraint.data.mix) * alpha;\r\n\t\t\tconstraint.softness = constraint.data.softness\r\n\t\t\t\t+ (softness + (frames[frame + IkConstraintTimeline.SOFTNESS] - softness) * percent - constraint.data.softness) * alpha;\r\n\t\t\tif (direction == MixDirection.mixOut) {\r\n\t\t\t\tconstraint.bendDirection = constraint.data.bendDirection;\r\n\t\t\t\tconstraint.compress = constraint.data.compress;\r\n\t\t\t\tconstraint.stretch = constraint.data.stretch;\r\n\t\t\t} else {\r\n\t\t\t\tconstraint.bendDirection = frames[frame + IkConstraintTimeline.PREV_BEND_DIRECTION];\r\n\t\t\t\tconstraint.compress = frames[frame + IkConstraintTimeline.PREV_COMPRESS] != 0;\r\n\t\t\t\tconstraint.stretch = frames[frame + IkConstraintTimeline.PREV_STRETCH] != 0;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tconstraint.mix += (mix + (frames[frame + IkConstraintTimeline.MIX] - mix) * percent - constraint.mix) * alpha;\r\n\t\t\tconstraint.softness += (softness + (frames[frame + IkConstraintTimeline.SOFTNESS] - softness) * percent - constraint.softness) * alpha;\r\n\t\t\tif (direction == MixDirection.mixIn) {\r\n\t\t\t\tconstraint.bendDirection = frames[frame + IkConstraintTimeline.PREV_BEND_DIRECTION];\r\n\t\t\t\tconstraint.compress = frames[frame + IkConstraintTimeline.PREV_COMPRESS] != 0;\r\n\t\t\t\tconstraint.stretch = frames[frame + IkConstraintTimeline.PREV_STRETCH] != 0;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/** Changes a transform constraint's {@link TransformConstraint#rotateMix}, {@link TransformConstraint#translateMix},\r\n * {@link TransformConstraint#scaleMix}, and {@link TransformConstraint#shearMix}. */\r\nexport class TransformConstraintTimeline extends CurveTimeline {\r\n\tstatic ENTRIES = 5;\r\n\tstatic PREV_TIME = -5; static PREV_ROTATE = -4; static PREV_TRANSLATE = -3; static PREV_SCALE = -2; static PREV_SHEAR = -1;\r\n\tstatic ROTATE = 1; static TRANSLATE = 2; static SCALE = 3; static SHEAR = 4;\r\n\r\n\t/** The index of the transform constraint slot in {@link Skeleton#transformConstraints} that will be changed. */\r\n\ttransformConstraintIndex: number;\r\n\r\n\t/** The time in seconds, rotate mix, translate mix, scale mix, and shear mix for each key frame. */\r\n\tframes: ArrayLike<number>; // time, rotate mix, translate mix, scale mix, shear mix, ...\r\n\r\n\tconstructor (frameCount: number) {\r\n\t\tsuper(frameCount);\r\n\t\tthis.frames = Utils.newFloatArray(frameCount * TransformConstraintTimeline.ENTRIES);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn (TimelineType.transformConstraint << 24) + this.transformConstraintIndex;\r\n\t}\r\n\r\n\t/** The time in seconds, rotate mix, translate mix, scale mix, and shear mix for the specified key frame. */\r\n\tsetFrame (frameIndex: number, time: number, rotateMix: number, translateMix: number, scaleMix: number, shearMix: number) {\r\n\t\tframeIndex *= TransformConstraintTimeline.ENTRIES;\r\n\t\tthis.frames[frameIndex] = time;\r\n\t\tthis.frames[frameIndex + TransformConstraintTimeline.ROTATE] = rotateMix;\r\n\t\tthis.frames[frameIndex + TransformConstraintTimeline.TRANSLATE] = translateMix;\r\n\t\tthis.frames[frameIndex + TransformConstraintTimeline.SCALE] = scaleMix;\r\n\t\tthis.frames[frameIndex + TransformConstraintTimeline.SHEAR] = shearMix;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet frames = this.frames;\r\n\r\n\t\tlet constraint: TransformConstraint = skeleton.transformConstraints[this.transformConstraintIndex];\r\n\t\tif (!constraint.active) return;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tlet data = constraint.data;\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup:\r\n\t\t\t\tconstraint.rotateMix = data.rotateMix;\r\n\t\t\t\tconstraint.translateMix = data.translateMix;\r\n\t\t\t\tconstraint.scaleMix = data.scaleMix;\r\n\t\t\t\tconstraint.shearMix = data.shearMix;\r\n\t\t\t\treturn;\r\n\t\t\tcase MixBlend.first:\r\n\t\t\t\tconstraint.rotateMix += (data.rotateMix - constraint.rotateMix) * alpha;\r\n\t\t\t\tconstraint.translateMix += (data.translateMix - constraint.translateMix) * alpha;\r\n\t\t\t\tconstraint.scaleMix += (data.scaleMix - constraint.scaleMix) * alpha;\r\n\t\t\t\tconstraint.shearMix += (data.shearMix - constraint.shearMix) * alpha;\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet rotate = 0, translate = 0, scale = 0, shear = 0;\r\n\t\tif (time >= frames[frames.length - TransformConstraintTimeline.ENTRIES]) { // Time is after last frame.\r\n\t\t\tlet i = frames.length;\r\n\t\t\trotate = frames[i + TransformConstraintTimeline.PREV_ROTATE];\r\n\t\t\ttranslate = frames[i + TransformConstraintTimeline.PREV_TRANSLATE];\r\n\t\t\tscale = frames[i + TransformConstraintTimeline.PREV_SCALE];\r\n\t\t\tshear = frames[i + TransformConstraintTimeline.PREV_SHEAR];\r\n\t\t} else {\r\n\t\t\t// Interpolate between the previous frame and the current frame.\r\n\t\t\tlet frame = Animation.binarySearch(frames, time, TransformConstraintTimeline.ENTRIES);\r\n\t\t\trotate = frames[frame + TransformConstraintTimeline.PREV_ROTATE];\r\n\t\t\ttranslate = frames[frame + TransformConstraintTimeline.PREV_TRANSLATE];\r\n\t\t\tscale = frames[frame + TransformConstraintTimeline.PREV_SCALE];\r\n\t\t\tshear = frames[frame + TransformConstraintTimeline.PREV_SHEAR];\r\n\t\t\tlet frameTime = frames[frame];\r\n\t\t\tlet percent = this.getCurvePercent(frame / TransformConstraintTimeline.ENTRIES - 1,\r\n\t\t\t\t1 - (time - frameTime) / (frames[frame + TransformConstraintTimeline.PREV_TIME] - frameTime));\r\n\r\n\t\t\trotate += (frames[frame + TransformConstraintTimeline.ROTATE] - rotate) * percent;\r\n\t\t\ttranslate += (frames[frame + TransformConstraintTimeline.TRANSLATE] - translate) * percent;\r\n\t\t\tscale += (frames[frame + TransformConstraintTimeline.SCALE] - scale) * percent;\r\n\t\t\tshear += (frames[frame + TransformConstraintTimeline.SHEAR] - shear) * percent;\r\n\t\t}\r\n\t\tif (blend == MixBlend.setup) {\r\n\t\t\tlet data = constraint.data;\r\n\t\t\tconstraint.rotateMix = data.rotateMix + (rotate - data.rotateMix) * alpha;\r\n\t\t\tconstraint.translateMix = data.translateMix + (translate - data.translateMix) * alpha;\r\n\t\t\tconstraint.scaleMix = data.scaleMix + (scale - data.scaleMix) * alpha;\r\n\t\t\tconstraint.shearMix = data.shearMix + (shear - data.shearMix) * alpha;\r\n\t\t} else {\r\n\t\t\tconstraint.rotateMix += (rotate - constraint.rotateMix) * alpha;\r\n\t\t\tconstraint.translateMix += (translate - constraint.translateMix) * alpha;\r\n\t\t\tconstraint.scaleMix += (scale - constraint.scaleMix) * alpha;\r\n\t\t\tconstraint.shearMix += (shear - constraint.shearMix) * alpha;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/** Changes a path constraint's {@link PathConstraint#position}. */\r\nexport class PathConstraintPositionTimeline extends CurveTimeline {\r\n\tstatic ENTRIES = 2;\r\n\tstatic PREV_TIME = -2; static PREV_VALUE = -1;\r\n\tstatic VALUE = 1;\r\n\r\n\t/** The index of the path constraint slot in {@link Skeleton#pathConstraints} that will be changed. */\r\n\tpathConstraintIndex: number;\r\n\r\n\t/** The time in seconds and path constraint position for each key frame. */\r\n\tframes: ArrayLike<number>; // time, position, ...\r\n\r\n\tconstructor (frameCount: number) {\r\n\t\tsuper(frameCount);\r\n\t\tthis.frames = Utils.newFloatArray(frameCount * PathConstraintPositionTimeline.ENTRIES);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn (TimelineType.pathConstraintPosition << 24) + this.pathConstraintIndex;\r\n\t}\r\n\r\n\t/** Sets the time in seconds and path constraint position for the specified key frame. */\r\n\tsetFrame (frameIndex: number, time: number, value: number) {\r\n\t\tframeIndex *= PathConstraintPositionTimeline.ENTRIES;\r\n\t\tthis.frames[frameIndex] = time;\r\n\t\tthis.frames[frameIndex + PathConstraintPositionTimeline.VALUE] = value;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet frames = this.frames;\r\n\t\tlet constraint: PathConstraint = skeleton.pathConstraints[this.pathConstraintIndex];\r\n\t\tif (!constraint.active) return;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup:\r\n\t\t\t\tconstraint.position = constraint.data.position;\r\n\t\t\t\treturn;\r\n\t\t\tcase MixBlend.first:\r\n\t\t\t\tconstraint.position += (constraint.data.position - constraint.position) * alpha;\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet position = 0;\r\n\t\tif (time >= frames[frames.length - PathConstraintPositionTimeline.ENTRIES]) // Time is after last frame.\r\n\t\t\tposition = frames[frames.length + PathConstraintPositionTimeline.PREV_VALUE];\r\n\t\telse {\r\n\t\t\t// Interpolate between the previous frame and the current frame.\r\n\t\t\tlet frame = Animation.binarySearch(frames, time, PathConstraintPositionTimeline.ENTRIES);\r\n\t\t\tposition = frames[frame + PathConstraintPositionTimeline.PREV_VALUE];\r\n\t\t\tlet frameTime = frames[frame];\r\n\t\t\tlet percent = this.getCurvePercent(frame / PathConstraintPositionTimeline.ENTRIES - 1,\r\n\t\t\t\t1 - (time - frameTime) / (frames[frame + PathConstraintPositionTimeline.PREV_TIME] - frameTime));\r\n\r\n\t\t\tposition += (frames[frame + PathConstraintPositionTimeline.VALUE] - position) * percent;\r\n\t\t}\r\n\t\tif (blend == MixBlend.setup)\r\n\t\t\tconstraint.position = constraint.data.position + (position - constraint.data.position) * alpha;\r\n\t\telse\r\n\t\t\tconstraint.position += (position - constraint.position) * alpha;\r\n\t}\r\n}\r\n\r\n/** Changes a path constraint's {@link PathConstraint#spacing}. */\r\nexport class PathConstraintSpacingTimeline extends PathConstraintPositionTimeline {\r\n\tconstructor (frameCount: number) {\r\n\t\tsuper(frameCount);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn (TimelineType.pathConstraintSpacing << 24) + this.pathConstraintIndex;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet frames = this.frames;\r\n\t\tlet constraint: PathConstraint = skeleton.pathConstraints[this.pathConstraintIndex];\r\n\t\tif (!constraint.active) return;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup:\r\n\t\t\t\tconstraint.spacing = constraint.data.spacing;\r\n\t\t\t\treturn;\r\n\t\t\tcase MixBlend.first:\r\n\t\t\t\tconstraint.spacing += (constraint.data.spacing - constraint.spacing) * alpha;\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet spacing = 0;\r\n\t\tif (time >= frames[frames.length - PathConstraintSpacingTimeline.ENTRIES]) // Time is after last frame.\r\n\t\t\tspacing = frames[frames.length + PathConstraintSpacingTimeline.PREV_VALUE];\r\n\t\telse {\r\n\t\t\t// Interpolate between the previous frame and the current frame.\r\n\t\t\tlet frame = Animation.binarySearch(frames, time, PathConstraintSpacingTimeline.ENTRIES);\r\n\t\t\tspacing = frames[frame + PathConstraintSpacingTimeline.PREV_VALUE];\r\n\t\t\tlet frameTime = frames[frame];\r\n\t\t\tlet percent = this.getCurvePercent(frame / PathConstraintSpacingTimeline.ENTRIES - 1,\r\n\t\t\t\t1 - (time - frameTime) / (frames[frame + PathConstraintSpacingTimeline.PREV_TIME] - frameTime));\r\n\r\n\t\t\tspacing += (frames[frame + PathConstraintSpacingTimeline.VALUE] - spacing) * percent;\r\n\t\t}\r\n\r\n\t\tif (blend == MixBlend.setup)\r\n\t\t\tconstraint.spacing = constraint.data.spacing + (spacing - constraint.data.spacing) * alpha;\r\n\t\telse\r\n\t\t\tconstraint.spacing += (spacing - constraint.spacing) * alpha;\r\n\t}\r\n}\r\n\r\n/** Changes a transform constraint's {@link PathConstraint#rotateMix} and\r\n * {@link TransformConstraint#translateMix}. */\r\nexport class PathConstraintMixTimeline extends CurveTimeline {\r\n\tstatic ENTRIES = 3;\r\n\tstatic PREV_TIME = -3; static PREV_ROTATE = -2; static PREV_TRANSLATE = -1;\r\n\tstatic ROTATE = 1; static TRANSLATE = 2;\r\n\r\n\t/** The index of the path constraint slot in {@link Skeleton#getPathConstraints()} that will be changed. */\r\n\tpathConstraintIndex: number;\r\n\r\n\t/** The time in seconds, rotate mix, and translate mix for each key frame. */\r\n\tframes: ArrayLike<number>; // time, rotate mix, translate mix, ...\r\n\r\n\tconstructor (frameCount: number) {\r\n\t\tsuper(frameCount);\r\n\t\tthis.frames = Utils.newFloatArray(frameCount * PathConstraintMixTimeline.ENTRIES);\r\n\t}\r\n\r\n\tgetPropertyId () {\r\n\t\treturn (TimelineType.pathConstraintMix << 24) + this.pathConstraintIndex;\r\n\t}\r\n\r\n\t/** The time in seconds, rotate mix, and translate mix for the specified key frame. */\r\n\tsetFrame (frameIndex: number, time: number, rotateMix: number, translateMix: number) {\r\n\t\tframeIndex *= PathConstraintMixTimeline.ENTRIES;\r\n\t\tthis.frames[frameIndex] = time;\r\n\t\tthis.frames[frameIndex + PathConstraintMixTimeline.ROTATE] = rotateMix;\r\n\t\tthis.frames[frameIndex + PathConstraintMixTimeline.TRANSLATE] = translateMix;\r\n\t}\r\n\r\n\tapply (skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {\r\n\t\tlet frames = this.frames;\r\n\t\tlet constraint: PathConstraint = skeleton.pathConstraints[this.pathConstraintIndex];\r\n\t\tif (!constraint.active) return;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tswitch (blend) {\r\n\t\t\tcase MixBlend.setup:\r\n\t\t\t\tconstraint.rotateMix = constraint.data.rotateMix;\r\n\t\t\t\tconstraint.translateMix = constraint.data.translateMix;\r\n\t\t\t\treturn;\r\n\t\t\tcase MixBlend.first:\r\n\t\t\t\tconstraint.rotateMix += (constraint.data.rotateMix - constraint.rotateMix) * alpha;\r\n\t\t\t\tconstraint.translateMix += (constraint.data.translateMix - constraint.translateMix) * alpha;\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet rotate = 0, translate = 0;\r\n\t\tif (time >= frames[frames.length - PathConstraintMixTimeline.ENTRIES]) { // Time is after last frame.\r\n\t\t\trotate = frames[frames.length + PathConstraintMixTimeline.PREV_ROTATE];\r\n\t\t\ttranslate = frames[frames.length + PathConstraintMixTimeline.PREV_TRANSLATE];\r\n\t\t} else {\r\n\t\t\t// Interpolate between the previous frame and the current frame.\r\n\t\t\tlet frame = Animation.binarySearch(frames, time, PathConstraintMixTimeline.ENTRIES);\r\n\t\t\trotate = frames[frame + PathConstraintMixTimeline.PREV_ROTATE];\r\n\t\t\ttranslate = frames[frame + PathConstraintMixTimeline.PREV_TRANSLATE];\r\n\t\t\tlet frameTime = frames[frame];\r\n\t\t\tlet percent = this.getCurvePercent(frame / PathConstraintMixTimeline.ENTRIES - 1,\r\n\t\t\t\t1 - (time - frameTime) / (frames[frame + PathConstraintMixTimeline.PREV_TIME] - frameTime));\r\n\r\n\t\t\trotate += (frames[frame + PathConstraintMixTimeline.ROTATE] - rotate) * percent;\r\n\t\t\ttranslate += (frames[frame + PathConstraintMixTimeline.TRANSLATE] - translate) * percent;\r\n\t\t}\r\n\r\n\t\tif (blend == MixBlend.setup) {\r\n\t\t\tconstraint.rotateMix = constraint.data.rotateMix + (rotate - constraint.data.rotateMix) * alpha;\r\n\t\t\tconstraint.translateMix = constraint.data.translateMix + (translate - constraint.data.translateMix) * alpha;\r\n\t\t} else {\r\n\t\t\tconstraint.rotateMix += (rotate - constraint.rotateMix) * alpha;\r\n\t\t\tconstraint.translateMix += (translate - constraint.translateMix) * alpha;\r\n\t\t}\r\n\t}\r\n}\r\n","\r\n\r\nimport { Disposable } from \"./Utils\";\r\nimport { Texture, TextureFilter } from \"./Texture\";\r\nimport { TextureWrap, TextureRegion } from \"./Texture\";\r\n\r\n\r\n\texport class TextureAtlas implements Disposable {\r\n\t\tpages = new Array<TextureAtlasPage>();\r\n\t\tregions = new Array<TextureAtlasRegion>();\r\n\r\n\t\tconstructor (atlasText: string, textureLoader: (path: string, width?: number, height?: number) => any) {\r\n\t\t\tthis.load(atlasText, textureLoader);\r\n\t\t}\r\n\r\n\t\tprivate load (atlasText: string, textureLoader: (path: string, width?: number, height?: number) => any) {\r\n\t\t\tif (textureLoader == null)\r\n\t\t\t\tthrow new Error(\"textureLoader cannot be null.\");\r\n\r\n\t\t\tlet reader = new TextureAtlasReader(atlasText);\r\n\t\t\tlet tuple = new Array<string>(4);\r\n\t\t\tlet page:TextureAtlasPage = null;\r\n\t\t\twhile (true) {\r\n\t\t\t\tlet line = reader.readLine();\r\n\t\t\t\tif (line == null)\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tline = line.trim();\r\n\t\t\t\tif (line.length == 0)\r\n\t\t\t\t\tpage = null;\r\n\t\t\t\telse if (!page) {\r\n\t\t\t\t\tpage = new TextureAtlasPage();\r\n\t\t\t\t\tpage.name = line;\r\n\r\n\t\t\t\t\tif (reader.readTuple(tuple) == 2) { // size is only optional for an atlas packed with an old TexturePacker.\r\n\t\t\t\t\t\tpage.width = parseInt(tuple[0]);\r\n\t\t\t\t\t\tpage.height = parseInt(tuple[1]);\r\n\t\t\t\t\t\treader.readTuple(tuple);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// page.format = Format[tuple[0]]; we don't need format in WebGL\r\n\r\n\t\t\t\t\treader.readTuple(tuple);\r\n\t\t\t\t\tpage.minFilter = Texture.filterFromString(tuple[0]);\r\n\t\t\t\t\tpage.magFilter = Texture.filterFromString(tuple[1]);\r\n\r\n\t\t\t\t\tlet direction= reader.readValue();\r\n\t\t\t\t\tpage.uWrap = TextureWrap.ClampToEdge;\r\n\t\t\t\t\tpage.vWrap = TextureWrap.ClampToEdge;\r\n\t\t\t\t\tif (direction == \"x\")\r\n\t\t\t\t\t\tpage.uWrap = TextureWrap.Repeat;\r\n\t\t\t\t\telse if (direction == \"y\")\r\n\t\t\t\t\t\tpage.vWrap = TextureWrap.Repeat;\r\n\t\t\t\t\telse if (direction == \"xy\")\r\n\t\t\t\t\t\tpage.uWrap = page.vWrap = TextureWrap.Repeat;\r\n\r\n\t\t\t\t\tpage.texture = textureLoader(line);\r\n\t\t\t\t\tpage.texture.setFilters(page.minFilter, page.magFilter);\r\n\t\t\t\t\tpage.texture.setWraps(page.uWrap, page.vWrap);\r\n\t\t\t\t\tpage.width = page.texture.getImage().width;\r\n\t\t\t\t\tpage.height = page.texture.getImage().height;\r\n\t\t\t\t\tthis.pages.push(page);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tlet region:TextureAtlasRegion = new TextureAtlasRegion();\r\n\t\t\t\t\tregion.name = line;\r\n\t\t\t\t\tregion.page = page;\r\n\r\n\t\t\t\t\tlet rotateValue = reader.readValue();\r\n\t\t\t\t\tif (rotateValue.toLocaleLowerCase() == \"true\") {\r\n\t\t\t\t\t\tregion.degrees = 90;\r\n\t\t\t\t\t} else if (rotateValue.toLocaleLowerCase() == \"false\") {\r\n\t\t\t\t\t\tregion.degrees = 0;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tregion.degrees = parseFloat(rotateValue);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tregion.rotate = region.degrees == 90;\r\n\r\n\t\t\t\t\treader.readTuple(tuple);\r\n\t\t\t\t\tlet x = parseInt(tuple[0]);\r\n\t\t\t\t\tlet y = parseInt(tuple[1]);\r\n\r\n\t\t\t\t\treader.readTuple(tuple);\r\n\t\t\t\t\tlet width = parseInt(tuple[0]);\r\n\t\t\t\t\tlet height = parseInt(tuple[1]);\r\n\r\n\t\t\t\t\tregion.u = x / page.width;\r\n\t\t\t\t\tregion.v = y / page.height;\r\n\t\t\t\t\tif (region.rotate) {\r\n\t\t\t\t\t\tregion.u2 = (x + height) / page.width;\r\n\t\t\t\t\t\tregion.v2 = (y + width) / page.height;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tregion.u2 = (x + width) / page.width;\r\n\t\t\t\t\t\tregion.v2 = (y + height) / page.height;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tregion.x = x;\r\n\t\t\t\t\tregion.y = y;\r\n\t\t\t\t\tregion.width = Math.abs(width);\r\n\t\t\t\t\tregion.height = Math.abs(height);\r\n\r\n\t\t\t\t\tif (reader.readTuple(tuple) == 4) { // split is optional\r\n\t\t\t\t\t\t// region.splits = new Vector.<int>(parseInt(tuple[0]), parseInt(tuple[1]), parseInt(tuple[2]), parseInt(tuple[3]));\r\n\t\t\t\t\t\tif (reader.readTuple(tuple) == 4) { // pad is optional, but only present with splits\r\n\t\t\t\t\t\t\t//region.pads = Vector.<int>(parseInt(tuple[0]), parseInt(tuple[1]), parseInt(tuple[2]), parseInt(tuple[3]));\r\n\t\t\t\t\t\t\treader.readTuple(tuple);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tregion.originalWidth = parseInt(tuple[0]);\r\n\t\t\t\t\tregion.originalHeight = parseInt(tuple[1]);\r\n\r\n\t\t\t\t\treader.readTuple(tuple);\r\n\t\t\t\t\tregion.offsetX = parseInt(tuple[0]);\r\n\t\t\t\t\tregion.offsetY = parseInt(tuple[1]);\r\n\r\n\t\t\t\t\tregion.index = parseInt(reader.readValue());\r\n\r\n\t\t\t\t\tregion.texture = page.texture;\r\n\t\t\t\t\tthis.regions.push(region);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfindRegion (name: string): TextureAtlasRegion {\r\n\t\t\tfor (let i = 0; i < this.regions.length; i++) {\r\n\t\t\t\tif (this.regions[i].name == name) {\r\n\t\t\t\t\treturn this.regions[i];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn null;\r\n\t\t}\r\n\r\n\t\tdispose () {\r\n\t\t\tfor (let i = 0; i < this.pages.length; i++) {\r\n\t\t\t\tthis.pages[i].texture.dispose();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tclass TextureAtlasReader {\r\n\t\tlines: Array<string>;\r\n\t\tindex: number = 0;\r\n\r\n\t\tconstructor (text: string) {\r\n\t\t\tthis.lines = text.split(/\\r\\n|\\r|\\n/);\r\n\t\t}\r\n\r\n\t\treadLine (): string {\r\n\t\t\tif (this.index >= this.lines.length)\r\n\t\t\t\treturn null;\r\n\t\t\treturn this.lines[this.index++];\r\n\t\t}\r\n\r\n\t\treadValue (): string {\r\n\t\t\tlet line = this.readLine();\r\n\t\t\tlet colon= line.indexOf(\":\");\r\n\t\t\tif (colon == -1)\r\n\t\t\t\tthrow new Error(\"Invalid line: \" + line);\r\n\t\t\treturn line.substring(colon + 1).trim();\r\n\t\t}\r\n\r\n\t\treadTuple (tuple: Array<string>): number {\r\n\t\t\tlet line = this.readLine();\r\n\t\t\tlet colon = line.indexOf(\":\");\r\n\t\t\tif (colon == -1)\r\n\t\t\t\tthrow new Error(\"Invalid line: \" + line);\r\n\t\t\tlet i = 0, lastMatch = colon + 1;\r\n\t\t\tfor (; i < 3; i++) {\r\n\t\t\t\tlet comma = line.indexOf(\",\", lastMatch);\r\n\t\t\t\tif (comma == -1) break;\r\n\t\t\t\ttuple[i] = line.substr(lastMatch, comma - lastMatch).trim();\r\n\t\t\t\tlastMatch = comma + 1;\r\n\t\t\t}\r\n\t\t\ttuple[i] = line.substring(lastMatch).trim();\r\n\t\t\treturn i + 1;\r\n\t\t}\r\n\t}\r\n\r\n\texport class TextureAtlasPage {\r\n\t\tname: string;\r\n\t\tminFilter: TextureFilter;\r\n\t\tmagFilter: TextureFilter;\r\n\t\tuWrap: TextureWrap;\r\n\t\tvWrap: TextureWrap;\r\n\t\ttexture: Texture;\r\n\t\twidth: number;\r\n\t\theight: number;\r\n\t}\r\n\r\n\texport class TextureAtlasRegion extends TextureRegion {\r\n\t\tpage: TextureAtlasPage;\r\n\t\tname: string;\r\n\t\tx: number;\r\n\t\ty: number;\r\n\t\tindex: number;\r\n\t\tdegrees: number;\r\n\t\ttexture: Texture;\r\n\t}\r\n","\r\n\r\nimport { VertexAttachment, Attachment } from \"./Attachment\";\r\nimport { TextureRegion } from \"../Texture\";\r\nimport { Color, Utils, ArrayLike } from \"../Utils\";\r\nimport { TextureAtlasRegion } from \"../TextureAtlas\";\r\n\r\n\r\n/** An attachment that displays a textured mesh. A mesh has hull vertices and internal vertices within the hull. Holes are not\r\n * supported. Each vertex has UVs (texture coordinates) and triangles are used to map an image on to the mesh.\r\n *\r\n * See [Mesh attachments](http://esotericsoftware.com/spine-meshes) in the Spine User Guide. */\r\nexport class MeshAttachment extends VertexAttachment {\r\n\tregion: TextureRegion;\r\n\r\n\t/** The name of the texture region for this attachment. */\r\n\tpath: string;\r\n\r\n\t/** The UV pair for each vertex, normalized within the texture region. */\r\n\tregionUVs: ArrayLike<number>;\r\n\r\n\t/** The UV pair for each vertex, normalized within the entire texture.\r\n\t *\r\n\t * See {@link #updateUVs}. */\r\n\tuvs: ArrayLike<number>;\r\n\r\n\t/** Triplets of vertex indices which describe the mesh's triangulation. */\r\n\ttriangles: Array<number>;\r\n\r\n\t/** The color to tint the mesh. */\r\n\tcolor = new Color(1, 1, 1, 1);\r\n\r\n\t/** The width of the mesh's image. Available only when nonessential data was exported. */\r\n\twidth: number;\r\n\r\n\t/** The height of the mesh's image. Available only when nonessential data was exported. */\r\n\theight: number;\r\n\r\n\t/** The number of entries at the beginning of {@link #vertices} that make up the mesh hull. */\r\n\thullLength: number;\r\n\r\n\t/** Vertex index pairs describing edges for controling triangulation. Mesh triangles will never cross edges. Only available if\r\n\t * nonessential data was exported. Triangulation is not performed at runtime. */\r\n\tedges: Array<number>;\r\n\r\n\tprivate parentMesh: MeshAttachment;\r\n\ttempColor = new Color(0, 0, 0, 0);\r\n\r\n\tconstructor (name: string) {\r\n\t\tsuper(name);\r\n\t}\r\n\r\n\t/** Calculates {@link #uvs} using {@link #regionUVs} and the {@link #region}. Must be called after changing the region UVs or\r\n\t * region. */\r\n\tupdateUVs () {\r\n\t\tlet regionUVs = this.regionUVs;\r\n\t\tif (this.uvs == null || this.uvs.length != regionUVs.length) this.uvs = Utils.newFloatArray(regionUVs.length);\r\n\t\tlet uvs = this.uvs;\r\n\t\tlet n = this.uvs.length;\r\n\t\tlet u = this.region.u, v = this.region.v, width = 0, height = 0;\r\n\t\tif (this.region instanceof TextureAtlasRegion) {\r\n\t\t\tlet region = this.region;\r\n\t\t\tlet textureWidth = region.texture.getImage().width, textureHeight = region.texture.getImage().height;\r\n\t\t\tswitch(region.degrees) {\r\n\t\t\tcase 90:\r\n\t\t\t\tu -= (region.originalHeight - region.offsetY - region.height) / textureWidth;\r\n\t\t\t\tv -= (region.originalWidth - region.offsetX - region.width) / textureHeight;\r\n\t\t\t\twidth = region.originalHeight / textureWidth;\r\n\t\t\t\theight = region.originalWidth / textureHeight;\r\n\t\t\t\tfor (let i = 0; i < n; i += 2) {\r\n\t\t\t\t\tuvs[i] = u + regionUVs[i + 1] * width;\r\n\t\t\t\t\tuvs[i + 1] = v + (1 - regionUVs[i]) * height;\r\n\t\t\t\t}\r\n\t\t\t\treturn;\r\n\t\t\tcase 180:\r\n\t\t\t\tu -= (region.originalWidth - region.offsetX - region.width) / textureWidth;\r\n\t\t\t\tv -= region.offsetY / textureHeight;\r\n\t\t\t\twidth = region.originalWidth / textureWidth;\r\n\t\t\t\theight = region.originalHeight / textureHeight;\r\n\t\t\t\tfor (let i = 0; i < n; i += 2) {\r\n\t\t\t\t\tuvs[i] = u + (1 - regionUVs[i]) * width;\r\n\t\t\t\t\tuvs[i + 1] = v + (1 - regionUVs[i + 1]) * height;\r\n\t\t\t\t}\r\n\t\t\t\treturn;\r\n\t\t\tcase 270:\r\n\t\t\t\tu -= region.offsetY / textureWidth;\r\n\t\t\t\tv -= region.offsetX / textureHeight;\r\n\t\t\t\twidth = region.originalHeight / textureWidth;\r\n\t\t\t\theight = region.originalWidth / textureHeight;\r\n\t\t\t\tfor (let i = 0; i < n; i += 2) {\r\n\t\t\t\t\tuvs[i] = u + (1 - regionUVs[i + 1]) * width;\r\n\t\t\t\t\tuvs[i + 1] = v + regionUVs[i] * height;\r\n\t\t\t\t}\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tu -= region.offsetX / textureWidth;\r\n\t\t\tv -= (region.originalHeight - region.offsetY - region.height) / textureHeight;\r\n\t\t\twidth = region.originalWidth / textureWidth;\r\n\t\t\theight = region.originalHeight / textureHeight;\r\n\t\t} else if (this.region == null) {\r\n\t\t\tu = v = 0;\r\n\t\t\twidth = height = 1;\r\n\t\t} else {\r\n\t\t\twidth = this.region.u2 - u;\r\n\t\t\theight = this.region.v2 - v;\r\n\t\t}\r\n\r\n\t\tfor (let i = 0; i < n; i += 2) {\r\n\t\t\tuvs[i] = u + regionUVs[i] * width;\r\n\t\t\tuvs[i + 1] = v + regionUVs[i + 1] * height;\r\n\t\t}\r\n\t}\r\n\r\n\t/** The parent mesh if this is a linked mesh, else null. A linked mesh shares the {@link #bones}, {@link #vertices},\r\n\t * {@link #regionUVs}, {@link #triangles}, {@link #hullLength}, {@link #edges}, {@link #width}, and {@link #height} with the\r\n\t * parent mesh, but may have a different {@link #name} or {@link #path} (and therefore a different texture). */\r\n\tgetParentMesh () {\r\n\t\treturn this.parentMesh;\r\n\t}\r\n\r\n\t/** @param parentMesh May be null. */\r\n\tsetParentMesh (parentMesh: MeshAttachment) {\r\n\t\tthis.parentMesh = parentMesh;\r\n\t\tif (parentMesh != null) {\r\n\t\t\tthis.bones = parentMesh.bones;\r\n\t\t\tthis.vertices = parentMesh.vertices;\r\n\t\t\tthis.worldVerticesLength = parentMesh.worldVerticesLength;\r\n\t\t\tthis.regionUVs = parentMesh.regionUVs;\r\n\t\t\tthis.triangles = parentMesh.triangles;\r\n\t\t\tthis.hullLength = parentMesh.hullLength;\r\n\t\t\tthis.worldVerticesLength = parentMesh.worldVerticesLength\r\n\t\t}\r\n\t}\r\n\r\n\tcopy (): Attachment {\r\n\t\tif (this.parentMesh != null) return this.newLinkedMesh();\r\n\r\n\t\tlet copy = new MeshAttachment(this.name);\r\n\t\tcopy.region = this.region;\r\n\t\tcopy.path = this.path;\r\n\t\tcopy.color.setFromColor(this.color);\r\n\r\n\t\tthis.copyTo(copy);\r\n\t\tcopy.regionUVs = new Array<number>(this.regionUVs.length);\r\n\t\tUtils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);\r\n\t\tcopy.uvs = new Array<number>(this.uvs.length);\r\n\t\tUtils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);\r\n\t\tcopy.triangles = new Array<number>(this.triangles.length);\r\n\t\tUtils.arrayCopy(this.triangles, 0, copy.triangles, 0, this.triangles.length);\r\n\t\tcopy.hullLength = this.hullLength;\r\n\r\n\t\t// Nonessential.\r\n\t\tif (this.edges != null) {\r\n\t\t\tcopy.edges = new Array<number>(this.edges.length);\r\n\t\t\tUtils.arrayCopy(this.edges, 0, copy.edges, 0, this.edges.length);\r\n\t\t}\r\n\t\tcopy.width = this.width;\r\n\t\tcopy.height = this.height;\r\n\r\n\t\treturn copy;\r\n\t}\r\n\r\n\t/** Returns a new mesh with the {@link #parentMesh} set to this mesh's parent mesh, if any, else to this mesh. **/\r\n\tnewLinkedMesh (): MeshAttachment {\r\n\t\tlet copy = new MeshAttachment(this.name);\r\n\t\tcopy.region = this.region;\r\n\t\tcopy.path = this.path;\r\n\t\tcopy.color.setFromColor(this.color);\r\n\t\tcopy.deformAttachment = this.deformAttachment;\r\n\t\tcopy.setParentMesh(this.parentMesh != null ? this.parentMesh : this);\r\n\t\tcopy.updateUVs();\r\n\t\treturn copy;\r\n\t}\r\n}\r\n\r\n","\r\n\r\nimport { SkeletonData } from \"./SkeletonData\";\r\nimport { Bone } from \"./Bone\";\r\nimport { Slot } from \"./Slot\";\r\nimport { IkConstraint } from \"./IkConstraint\";\r\nimport { TransformConstraint } from \"./TransformConstraint\";\r\nimport { PathConstraint } from \"./PathConstraint\";\r\nimport { Updatable } from \"./Updatable\";\r\nimport { Skin } from \"./Skin\";\r\nimport { Color, Utils, Vector2 } from \"./Utils\";\r\nimport { PathAttachment } from \"./attachments/PathAttachment\";\r\nimport { Attachment } from \"./attachments/Attachment\";\r\nimport { RegionAttachment } from \"./attachments/RegionAttachment\";\r\nimport { MeshAttachment } from \"./attachments/MeshAttachment\";\r\n\r\n/** Stores the current pose for a skeleton.\r\n *\r\n * See [Instance objects](http://esotericsoftware.com/spine-runtime-architecture#Instance-objects) in the Spine Runtimes Guide. */\r\nexport class Skeleton {\r\n\t/** The skeleton's setup pose data. */\r\n\tdata: SkeletonData;\r\n\r\n\t/** The skeleton's bones, sorted parent first. The root bone is always the first bone. */\r\n\tbones: Array<Bone>;\r\n\r\n\t/** The skeleton's slots. */\r\n\tslots: Array<Slot>;\r\n\r\n\t/** The skeleton's slots in the order they should be drawn. The returned array may be modified to change the draw order. */\r\n\tdrawOrder: Array<Slot>;\r\n\r\n\t/** The skeleton's IK constraints. */\r\n\tikConstraints: Array<IkConstraint>;\r\n\r\n\t/** The skeleton's transform constraints. */\r\n\ttransformConstraints: Array<TransformConstraint>;\r\n\r\n\t/** The skeleton's path constraints. */\r\n\tpathConstraints: Array<PathConstraint>;\r\n\r\n\t/** The list of bones and constraints, sorted in the order they should be updated, as computed by {@link #updateCache()}. */\r\n\t_updateCache = new Array<Updatable>();\r\n\tupdateCacheReset = new Array<Updatable>();\r\n\r\n\t/** The skeleton's current skin. May be null. */\r\n\tskin: Skin;\r\n\r\n\t/** The color to tint all the skeleton's attachments. */\r\n\tcolor: Color;\r\n\r\n\t/** Returns the skeleton's time. This can be used for tracking, such as with Slot {@link Slot#attachmentTime}.\r\n\t * <p>\r\n\t * See {@link #update()}. */\r\n\ttime = 0;\r\n\r\n\t/** Scales the entire skeleton on the X axis. This affects all bones, even if the bone's transform mode disallows scale\r\n\t* inheritance. */\r\n\tscaleX = 1;\r\n\r\n\t/** Scales the entire skeleton on the Y axis. This affects all bones, even if the bone's transform mode disallows scale\r\n\t* inheritance. */\r\n\tscaleY = 1;\r\n\r\n\t/** Sets the skeleton X position, which is added to the root bone worldX position. */\r\n\tx = 0;\r\n\r\n\t/** Sets the skeleton Y position, which is added to the root bone worldY position. */\r\n\ty = 0;\r\n\r\n\tconstructor(data: SkeletonData) {\r\n\t\tif (data == null) throw new Error(\"data cannot be null.\");\r\n\t\tthis.data = data;\r\n\r\n\t\tthis.bones = new Array<Bone>();\r\n\t\tfor (let i = 0; i < data.bones.length; i++) {\r\n\t\t\tlet boneData = data.bones[i];\r\n\t\t\tlet bone: Bone;\r\n\t\t\tif (boneData.parent == null)\r\n\t\t\t\tbone = new Bone(boneData, this, null);\r\n\t\t\telse {\r\n\t\t\t\tlet parent = this.bones[boneData.parent.index];\r\n\t\t\t\tbone = new Bone(boneData, this, parent);\r\n\t\t\t\tparent.children.push(bone);\r\n\t\t\t}\r\n\t\t\tthis.bones.push(bone);\r\n\t\t}\r\n\r\n\t\tthis.slots = new Array<Slot>();\r\n\t\tthis.drawOrder = new Array<Slot>();\r\n\t\tfor (let i = 0; i < data.slots.length; i++) {\r\n\t\t\tlet slotData = data.slots[i];\r\n\t\t\tlet bone = this.bones[slotData.boneData.index];\r\n\t\t\tlet slot = new Slot(slotData, bone);\r\n\t\t\tthis.slots.push(slot);\r\n\t\t\tthis.drawOrder.push(slot);\r\n\t\t}\r\n\r\n\t\tthis.ikConstraints = new Array<IkConstraint>();\r\n\t\tfor (let i = 0; i < data.ikConstraints.length; i++) {\r\n\t\t\tlet ikConstraintData = data.ikConstraints[i];\r\n\t\t\tthis.ikConstraints.push(new IkConstraint(ikConstraintData, this));\r\n\t\t}\r\n\r\n\t\tthis.transformConstraints = new Array<TransformConstraint>();\r\n\t\tfor (let i = 0; i < data.transformConstraints.length; i++) {\r\n\t\t\tlet transformConstraintData = data.transformConstraints[i];\r\n\t\t\tthis.transformConstraints.push(new TransformConstraint(transformConstraintData, this));\r\n\t\t}\r\n\r\n\t\tthis.pathConstraints = new Array<PathConstraint>();\r\n\t\tfor (let i = 0; i < data.pathConstraints.length; i++) {\r\n\t\t\tlet pathConstraintData = data.pathConstraints[i];\r\n\t\t\tthis.pathConstraints.push(new PathConstraint(pathConstraintData, this));\r\n\t\t}\r\n\r\n\t\tthis.color = new Color(1, 1, 1, 1);\r\n\t\tthis.updateCache();\r\n\t}\r\n\r\n\t/** Caches information about bones and constraints. Must be called if the {@link #getSkin()} is modified or if bones,\r\n\t * constraints, or weighted path attachments are added or removed. */\r\n\tupdateCache() {\r\n\t\tlet updateCache = this._updateCache;\r\n\t\tupdateCache.length = 0;\r\n\t\tthis.updateCacheReset.length = 0;\r\n\r\n\t\tlet bones = this.bones;\r\n\t\tfor (let i = 0, n = bones.length; i < n; i++) {\r\n\t\t\tlet bone = bones[i];\r\n\t\t\tbone.sorted = bone.data.skinRequired;\r\n\t\t\tbone.active = !bone.sorted;\r\n\t\t}\r\n\r\n\t\tif (this.skin != null) {\r\n\t\t\tlet skinBones = this.skin.bones;\r\n\t\t\tfor (let i = 0, n = this.skin.bones.length; i < n; i++) {\r\n\t\t\t\tlet bone = this.bones[skinBones[i].index];\r\n\t\t\t\tdo {\r\n\t\t\t\t\tbone.sorted = false;\r\n\t\t\t\t\tbone.active = true;\r\n\t\t\t\t\tbone = bone.parent;\r\n\t\t\t\t} while (bone != null);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// IK first, lowest hierarchy depth first.\r\n\t\tlet ikConstraints = this.ikConstraints;\r\n\t\tlet transformConstraints = this.transformConstraints;\r\n\t\tlet pathConstraints = this.pathConstraints;\r\n\t\tlet ikCount = ikConstraints.length, transformCount = transformConstraints.length, pathCount = pathConstraints.length;\r\n\t\tlet constraintCount = ikCount + transformCount + pathCount;\r\n\r\n\t\touter:\r\n\t\tfor (let i = 0; i < constraintCount; i++) {\r\n\t\t\tfor (let ii = 0; ii < ikCount; ii++) {\r\n\t\t\t\tlet constraint = ikConstraints[ii];\r\n\t\t\t\tif (constraint.data.order == i) {\r\n\t\t\t\t\tthis.sortIkConstraint(constraint);\r\n\t\t\t\t\tcontinue outer;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tfor (let ii = 0; ii < transformCount; ii++) {\r\n\t\t\t\tlet constraint = transformConstraints[ii];\r\n\t\t\t\tif (constraint.data.order == i) {\r\n\t\t\t\t\tthis.sortTransformConstraint(constraint);\r\n\t\t\t\t\tcontinue outer;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tfor (let ii = 0; ii < pathCount; ii++) {\r\n\t\t\t\tlet constraint = pathConstraints[ii];\r\n\t\t\t\tif (constraint.data.order == i) {\r\n\t\t\t\t\tthis.sortPathConstraint(constraint);\r\n\t\t\t\t\tcontinue outer;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (let i = 0, n = bones.length; i < n; i++)\r\n\t\t\tthis.sortBone(bones[i]);\r\n\t}\r\n\r\n\tsortIkConstraint(constraint: IkConstraint) {\r\n\t\tconstraint.active = constraint.target.isActive() && (!constraint.data.skinRequired || (this.skin != null && Utils.contains(this.skin.constraints, constraint.data, true)));\r\n\t\tif (!constraint.active) return;\r\n\r\n\t\tlet target = constraint.target;\r\n\t\tthis.sortBone(target);\r\n\r\n\t\tlet constrained = constraint.bones;\r\n\t\tlet parent = constrained[0];\r\n\t\tthis.sortBone(parent);\r\n\r\n\t\tif (constrained.length > 1) {\r\n\t\t\tlet child = constrained[constrained.length - 1];\r\n\t\t\tif (!(this._updateCache.indexOf(child) > -1)) this.updateCacheReset.push(child);\r\n\t\t}\r\n\r\n\t\tthis._updateCache.push(constraint);\r\n\r\n\t\tthis.sortReset(parent.children);\r\n\t\tconstrained[constrained.length - 1].sorted = true;\r\n\t}\r\n\r\n\tsortPathConstraint(constraint: PathConstraint) {\r\n\t\tconstraint.active = constraint.target.bone.isActive() && (!constraint.data.skinRequired || (this.skin != null && Utils.contains(this.skin.constraints, constraint.data, true)));\r\n\t\tif (!constraint.active) return;\r\n\r\n\t\tlet slot = constraint.target;\r\n\t\tlet slotIndex = slot.data.index;\r\n\t\tlet slotBone = slot.bone;\r\n\t\tif (this.skin != null) this.sortPathConstraintAttachment(this.skin, slotIndex, slotBone);\r\n\t\tif (this.data.defaultSkin != null && this.data.defaultSkin != this.skin)\r\n\t\t\tthis.sortPathConstraintAttachment(this.data.defaultSkin, slotIndex, slotBone);\r\n\t\tfor (let i = 0, n = this.data.skins.length; i < n; i++)\r\n\t\t\tthis.sortPathConstraintAttachment(this.data.skins[i], slotIndex, slotBone);\r\n\r\n\t\tlet attachment = slot.getAttachment();\r\n\t\tif (attachment instanceof PathAttachment) this.sortPathConstraintAttachmentWith(attachment, slotBone);\r\n\r\n\t\tlet constrained = constraint.bones;\r\n\t\tlet boneCount = constrained.length;\r\n\t\tfor (let i = 0; i < boneCount; i++)\r\n\t\t\tthis.sortBone(constrained[i]);\r\n\r\n\t\tthis._updateCache.push(constraint);\r\n\r\n\t\tfor (let i = 0; i < boneCount; i++)\r\n\t\t\tthis.sortReset(constrained[i].children);\r\n\t\tfor (let i = 0; i < boneCount; i++)\r\n\t\t\tconstrained[i].sorted = true;\r\n\t}\r\n\r\n\tsortTransformConstraint(constraint: TransformConstraint) {\r\n\t\tconstraint.active = constraint.target.isActive() && (!constraint.data.skinRequired || (this.skin != null && Utils.contains(this.skin.constraints, constraint.data, true)));\r\n\t\tif (!constraint.active) return;\r\n\r\n\t\tthis.sortBone(constraint.target);\r\n\r\n\t\tlet constrained = constraint.bones;\r\n\t\tlet boneCount = constrained.length;\r\n\t\tif (constraint.data.local) {\r\n\t\t\tfor (let i = 0; i < boneCount; i++) {\r\n\t\t\t\tlet child = constrained[i];\r\n\t\t\t\tthis.sortBone(child.parent);\r\n\t\t\t\tif (!(this._updateCache.indexOf(child) > -1)) this.updateCacheReset.push(child);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tfor (let i = 0; i < boneCount; i++) {\r\n\t\t\t\tthis.sortBone(constrained[i]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthis._updateCache.push(constraint);\r\n\r\n\t\tfor (let ii = 0; ii < boneCount; ii++)\r\n\t\t\tthis.sortReset(constrained[ii].children);\r\n\t\tfor (let ii = 0; ii < boneCount; ii++)\r\n\t\t\tconstrained[ii].sorted = true;\r\n\t}\r\n\r\n\tsortPathConstraintAttachment(skin: Skin, slotIndex: number, slotBone: Bone) {\r\n\t\tlet attachments = skin.attachments[slotIndex];\r\n\t\tif (!attachments) return;\r\n\t\tfor (let key in attachments) {\r\n\t\t\tthis.sortPathConstraintAttachmentWith(attachments[key], slotBone);\r\n\t\t}\r\n\t}\r\n\r\n\tsortPathConstraintAttachmentWith(attachment: Attachment, slotBone: Bone) {\r\n\t\tif (!(attachment instanceof PathAttachment)) return;\r\n\t\tlet pathBones = (<PathAttachment>attachment).bones;\r\n\t\tif (pathBones == null)\r\n\t\t\tthis.sortBone(slotBone);\r\n\t\telse {\r\n\t\t\tlet bones = this.bones;\r\n\t\t\tlet i = 0;\r\n\t\t\twhile (i < pathBones.length) {\r\n\t\t\t\tlet boneCount = pathBones[i++];\r\n\t\t\t\tfor (let n = i + boneCount; i < n; i++) {\r\n\t\t\t\t\tlet boneIndex = pathBones[i];\r\n\t\t\t\t\tthis.sortBone(bones[boneIndex]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tsortBone(bone: Bone) {\r\n\t\tif (bone.sorted) return;\r\n\t\tlet parent = bone.parent;\r\n\t\tif (parent != null) this.sortBone(parent);\r\n\t\tbone.sorted = true;\r\n\t\tthis._updateCache.push(bone);\r\n\t}\r\n\r\n\tsortReset(bones: Array<Bone>) {\r\n\t\tfor (let i = 0, n = bones.length; i < n; i++) {\r\n\t\t\tlet bone = bones[i];\r\n\t\t\tif (!bone.active) continue;\r\n\t\t\tif (bone.sorted) this.sortReset(bone.children);\r\n\t\t\tbone.sorted = false;\r\n\t\t}\r\n\t}\r\n\r\n\t/** Updates the world transform for each bone and applies all constraints.\r\n\t *\r\n\t * See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine\r\n\t * Runtimes Guide. */\r\n\tupdateWorldTransform() {\r\n\t\tlet updateCacheReset = this.updateCacheReset;\r\n\t\tfor (let i = 0, n = updateCacheReset.length; i < n; i++) {\r\n\t\t\tlet bone = updateCacheReset[i] as Bone;\r\n\t\t\tbone.ax = bone.x;\r\n\t\t\tbone.ay = bone.y;\r\n\t\t\tbone.arotation = bone.rotation;\r\n\t\t\tbone.ascaleX = bone.scaleX;\r\n\t\t\tbone.ascaleY = bone.scaleY;\r\n\t\t\tbone.ashearX = bone.shearX;\r\n\t\t\tbone.ashearY = bone.shearY;\r\n\t\t\tbone.appliedValid = true;\r\n\t\t}\r\n\t\tlet updateCache = this._updateCache;\r\n\t\tfor (let i = 0, n = updateCache.length; i < n; i++)\r\n\t\t\tupdateCache[i].update();\r\n\t}\r\n\r\n\t/** Sets the bones, constraints, and slots to their setup pose values. */\r\n\tsetToSetupPose() {\r\n\t\tthis.setBonesToSetupPose();\r\n\t\tthis.setSlotsToSetupPose();\r\n\t}\r\n\r\n\t/** Sets the bones and constraints to their setup pose values. */\r\n\tsetBonesToSetupPose() {\r\n\t\tlet bones = this.bones;\r\n\t\tfor (let i = 0, n = bones.length; i < n; i++)\r\n\t\t\tbones[i].setToSetupPose();\r\n\r\n\t\tlet ikConstraints = this.ikConstraints;\r\n\t\tfor (let i = 0, n = ikConstraints.length; i < n; i++) {\r\n\t\t\tlet constraint = ikConstraints[i];\r\n\t\t\tconstraint.mix = constraint.data.mix;\r\n\t\t\tconstraint.softness = constraint.data.softness;\r\n\t\t\tconstraint.bendDirection = constraint.data.bendDirection;\r\n\t\t\tconstraint.compress = constraint.data.compress;\r\n\t\t\tconstraint.stretch = constraint.data.stretch;\r\n\t\t}\r\n\r\n\t\tlet transformConstraints = this.transformConstraints;\r\n\t\tfor (let i = 0, n = transformConstraints.length; i < n; i++) {\r\n\t\t\tlet constraint = transformConstraints[i];\r\n\t\t\tlet data = constraint.data;\r\n\t\t\tconstraint.rotateMix = data.rotateMix;\r\n\t\t\tconstraint.translateMix = data.translateMix;\r\n\t\t\tconstraint.scaleMix = data.scaleMix;\r\n\t\t\tconstraint.shearMix = data.shearMix;\r\n\t\t}\r\n\r\n\t\tlet pathConstraints = this.pathConstraints;\r\n\t\tfor (let i = 0, n = pathConstraints.length; i < n; i++) {\r\n\t\t\tlet constraint = pathConstraints[i];\r\n\t\t\tlet data = constraint.data;\r\n\t\t\tconstraint.position = data.position;\r\n\t\t\tconstraint.spacing = data.spacing;\r\n\t\t\tconstraint.rotateMix = data.rotateMix;\r\n\t\t\tconstraint.translateMix = data.translateMix;\r\n\t\t}\r\n\t}\r\n\r\n\t/** Sets the slots and draw order to their setup pose values. */\r\n\tsetSlotsToSetupPose() {\r\n\t\tlet slots = this.slots;\r\n\t\tUtils.arrayCopy(slots, 0, this.drawOrder, 0, slots.length);\r\n\t\tfor (let i = 0, n = slots.length; i < n; i++)\r\n\t\t\tslots[i].setToSetupPose();\r\n\t}\r\n\r\n\t/** @returns May return null. */\r\n\tgetRootBone() {\r\n\t\tif (this.bones.length == 0) return null;\r\n\t\treturn this.bones[0];\r\n\t}\r\n\r\n\t/** @returns May be null. */\r\n\tfindBone(boneName: string) {\r\n\t\tif (boneName == null) throw new Error(\"boneName cannot be null.\");\r\n\t\tlet bones = this.bones;\r\n\t\tfor (let i = 0, n = bones.length; i < n; i++) {\r\n\t\t\tlet bone = bones[i];\r\n\t\t\tif (bone.data.name == boneName) return bone;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/** @returns -1 if the bone was not found. */\r\n\tfindBoneIndex(boneName: string) {\r\n\t\tif (boneName == null) throw new Error(\"boneName cannot be null.\");\r\n\t\tlet bones = this.bones;\r\n\t\tfor (let i = 0, n = bones.length; i < n; i++)\r\n\t\t\tif (bones[i].data.name == boneName) return i;\r\n\t\treturn -1;\r\n\t}\r\n\r\n\t/** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it\r\n\t * repeatedly.\r\n\t * @returns May be null. */\r\n\tfindSlot(slotName: string) {\r\n\t\tif (slotName == null) throw new Error(\"slotName cannot be null.\");\r\n\t\tlet slots = this.slots;\r\n\t\tfor (let i = 0, n = slots.length; i < n; i++) {\r\n\t\t\tlet slot = slots[i];\r\n\t\t\tif (slot.data.name == slotName) return slot;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/** @returns -1 if the bone was not found. */\r\n\tfindSlotIndex(slotName: string) {\r\n\t\tif (slotName == null) throw new Error(\"slotName cannot be null.\");\r\n\t\tlet slots = this.slots;\r\n\t\tfor (let i = 0, n = slots.length; i < n; i++)\r\n\t\t\tif (slots[i].data.name == slotName) return i;\r\n\t\treturn -1;\r\n\t}\r\n\r\n\t/** Sets a skin by name.\r\n\t *\r\n\t * See {@link #setSkin()}. */\r\n\tsetSkinByName(skinName: string) {\r\n\t\tlet skin = this.data.findSkin(skinName);\r\n\t\tif (skin == null) throw new Error(\"Skin not found: \" + skinName);\r\n\t\tthis.setSkin(skin);\r\n\t}\r\n\r\n\t/** Sets the skin used to look up attachments before looking in the {@link SkeletonData#defaultSkin default skin}. If the\r\n\t * skin is changed, {@link #updateCache()} is called.\r\n\t *\r\n\t * Attachments from the new skin are attached if the corresponding attachment from the old skin was attached. If there was no\r\n\t * old skin, each slot's setup mode attachment is attached from the new skin.\r\n\t *\r\n\t * After changing the skin, the visible attachments can be reset to those attached in the setup pose by calling\r\n\t * {@link #setSlotsToSetupPose()}. Also, often {@link AnimationState#apply()} is called before the next time the\r\n\t * skeleton is rendered to allow any attachment keys in the current animation(s) to hide or show attachments from the new skin.\r\n\t * @param newSkin May be null. */\r\n\tsetSkin(newSkin: Skin) {\r\n\t\tif (newSkin == this.skin) return;\r\n\t\tif (newSkin != null) {\r\n\t\t\tif (this.skin != null)\r\n\t\t\t\tnewSkin.attachAll(this, this.skin);\r\n\t\t\telse {\r\n\t\t\t\tlet slots = this.slots;\r\n\t\t\t\tfor (let i = 0, n = slots.length; i < n; i++) {\r\n\t\t\t\t\tlet slot = slots[i];\r\n\t\t\t\t\tlet name = slot.data.attachmentName;\r\n\t\t\t\t\tif (name != null) {\r\n\t\t\t\t\t\tlet attachment: Attachment = newSkin.getAttachment(i, name);\r\n\t\t\t\t\t\tif (attachment != null) slot.setAttachment(attachment);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.skin = newSkin;\r\n\t\tthis.updateCache();\r\n\t}\r\n\r\n\r\n\t/** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot name and attachment\r\n\t * name.\r\n\t *\r\n\t * See {@link #getAttachment()}.\r\n\t * @returns May be null. */\r\n\tgetAttachmentByName(slotName: string, attachmentName: string): Attachment {\r\n\t\treturn this.getAttachment(this.data.findSlotIndex(slotName), attachmentName);\r\n\t}\r\n\r\n\t/** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot index and\r\n\t * attachment name. First the skin is checked and if the attachment was not found, the default skin is checked.\r\n\t *\r\n\t * See [Runtime skins](http://esotericsoftware.com/spine-runtime-skins) in the Spine Runtimes Guide.\r\n\t * @returns May be null. */\r\n\tgetAttachment(slotIndex: number, attachmentName: string): Attachment {\r\n\t\tif (attachmentName == null) throw new Error(\"attachmentName cannot be null.\");\r\n\t\tif (this.skin != null) {\r\n\t\t\tlet attachment: Attachment = this.skin.getAttachment(slotIndex, attachmentName);\r\n\t\t\tif (attachment != null) return attachment;\r\n\t\t}\r\n\t\tif (this.data.defaultSkin != null) return this.data.defaultSkin.getAttachment(slotIndex, attachmentName);\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/** A convenience method to set an attachment by finding the slot with {@link #findSlot()}, finding the attachment with\r\n\t * {@link #getAttachment()}, then setting the slot's {@link Slot#attachment}.\r\n\t * @param attachmentName May be null to clear the slot's attachment. */\r\n\tsetAttachment(slotName: string, attachmentName: string) {\r\n\t\tif (slotName == null) throw new Error(\"slotName cannot be null.\");\r\n\t\tlet slots = this.slots;\r\n\t\tfor (let i = 0, n = slots.length; i < n; i++) {\r\n\t\t\tlet slot = slots[i];\r\n\t\t\tif (slot.data.name == slotName) {\r\n\t\t\t\tlet attachment: Attachment = null;\r\n\t\t\t\tif (attachmentName != null) {\r\n\t\t\t\t\tattachment = this.getAttachment(i, attachmentName);\r\n\t\t\t\t\tif (attachment == null)\r\n\t\t\t\t\t\tthrow new Error(\"Attachment not found: \" + attachmentName + \", for slot: \" + slotName);\r\n\t\t\t\t}\r\n\t\t\t\tslot.setAttachment(attachment);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t\tthrow new Error(\"Slot not found: \" + slotName);\r\n\t}\r\n\r\n\r\n\t/** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method\r\n\t * than to call it repeatedly.\r\n\t * @return May be null. */\r\n\tfindIkConstraint(constraintName: string) {\r\n\t\tif (constraintName == null) throw new Error(\"constraintName cannot be null.\");\r\n\t\tlet ikConstraints = this.ikConstraints;\r\n\t\tfor (let i = 0, n = ikConstraints.length; i < n; i++) {\r\n\t\t\tlet ikConstraint = ikConstraints[i];\r\n\t\t\tif (ikConstraint.data.name == constraintName) return ikConstraint;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of\r\n\t * this method than to call it repeatedly.\r\n\t * @return May be null. */\r\n\tfindTransformConstraint(constraintName: string) {\r\n\t\tif (constraintName == null) throw new Error(\"constraintName cannot be null.\");\r\n\t\tlet transformConstraints = this.transformConstraints;\r\n\t\tfor (let i = 0, n = transformConstraints.length; i < n; i++) {\r\n\t\t\tlet constraint = transformConstraints[i];\r\n\t\t\tif (constraint.data.name == constraintName) return constraint;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method\r\n\t * than to call it repeatedly.\r\n\t * @return May be null. */\r\n\tfindPathConstraint(constraintName: string) {\r\n\t\tif (constraintName == null) throw new Error(\"constraintName cannot be null.\");\r\n\t\tlet pathConstraints = this.pathConstraints;\r\n\t\tfor (let i = 0, n = pathConstraints.length; i < n; i++) {\r\n\t\t\tlet constraint = pathConstraints[i];\r\n\t\t\tif (constraint.data.name == constraintName) return constraint;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose.\r\n\t * @param offset An output value, the distance from the skeleton origin to the bottom left corner of the AABB.\r\n\t * @param size An output value, the width and height of the AABB.\r\n\t * @param temp Working memory to temporarily store attachments' computed world vertices. */\r\n\tgetBounds(offset: Vector2, size: Vector2, temp: Array<number> = new Array<number>(2)) {\r\n\t\tif (offset == null) throw new Error(\"offset cannot be null.\");\r\n\t\tif (size == null) throw new Error(\"size cannot be null.\");\r\n\t\tlet drawOrder = this.drawOrder;\r\n\t\tlet minX = Number.POSITIVE_INFINITY, minY = Number.POSITIVE_INFINITY, maxX = Number.NEGATIVE_INFINITY, maxY = Number.NEGATIVE_INFINITY;\r\n\t\tfor (let i = 0, n = drawOrder.length; i < n; i++) {\r\n\t\t\tlet slot = drawOrder[i];\r\n\t\t\tif (!slot.bone.active) continue;\r\n\t\t\tlet verticesLength = 0;\r\n\t\t\tlet vertices: ArrayLike<number> = null;\r\n\t\t\tlet attachment = slot.getAttachment();\r\n\t\t\tif (attachment instanceof RegionAttachment) {\r\n\t\t\t\tverticesLength = 8;\r\n\t\t\t\tvertices = Utils.setArraySize(temp, verticesLength, 0);\r\n\t\t\t\t(<RegionAttachment>attachment).computeWorldVertices(slot.bone, vertices, 0, 2);\r\n\t\t\t} else if (attachment instanceof MeshAttachment) {\r\n\t\t\t\tlet mesh = (<MeshAttachment>attachment);\r\n\t\t\t\tverticesLength = mesh.worldVerticesLength;\r\n\t\t\t\tvertices = Utils.setArraySize(temp, verticesLength, 0);\r\n\t\t\t\tmesh.computeWorldVertices(slot, 0, verticesLength, vertices, 0, 2);\r\n\t\t\t}\r\n\t\t\tif (vertices != null) {\r\n\t\t\t\tfor (let ii = 0, nn = vertices.length; ii < nn; ii += 2) {\r\n\t\t\t\t\tlet x = vertices[ii], y = vertices[ii + 1];\r\n\t\t\t\t\tminX = Math.min(minX, x);\r\n\t\t\t\t\tminY = Math.min(minY, y);\r\n\t\t\t\t\tmaxX = Math.max(maxX, x);\r\n\t\t\t\t\tmaxY = Math.max(maxY, y);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\toffset.set(minX, minY);\r\n\t\tsize.set(maxX - minX, maxY - minY);\r\n\t}\r\n\r\n\t/** Increments the skeleton's {@link #time}. */\r\n\tupdate(delta: number) {\r\n\t\tthis.time += delta;\r\n\t}\r\n}\r\n","\r\n\r\nimport { AnimationStateData } from \"./AnimationStateData\";\r\nimport { IntSet, Pool, Utils, MathUtils } from \"./Utils\";\r\nimport { Skeleton } from \"./Skeleton\";\r\nimport { MixBlend, AttachmentTimeline, MixDirection, RotateTimeline, DrawOrderTimeline, Timeline, EventTimeline } from \"./Animation\";\r\nimport { Slot } from \"./Slot\";\r\nimport { Animation } from \"./Animation\";\r\nimport { Event } from \"./Event\";\r\n\r\n\r\n/** Applies animations over time, queues animations for later playback, mixes (crossfading) between animations, and applies\r\n * multiple animations on top of each other (layering).\r\n *\r\n * See [Applying Animations](http://esotericsoftware.com/spine-applying-animations/) in the Spine Runtimes Guide. */\r\nexport class AnimationState {\r\n\tstatic emptyAnimation = new Animation(\"<empty>\", [], 0);\r\n\r\n\t/** 1. A previously applied timeline has set this property.\r\n\t *\r\n\t * Result: Mix from the current pose to the timeline pose. */\r\n\tstatic SUBSEQUENT = 0;\r\n\t/** 1. This is the first timeline to set this property.\r\n\t * 2. The next track entry applied after this one does not have a timeline to set this property.\r\n\t *\r\n\t * Result: Mix from the setup pose to the timeline pose. */\r\n\tstatic FIRST = 1;\r\n\t/** 1) A previously applied timeline has set this property.<br>\r\n\t * 2) The next track entry to be applied does have a timeline to set this property.<br>\r\n\t * 3) The next track entry after that one does not have a timeline to set this property.<br>\r\n\t * Result: Mix from the current pose to the timeline pose, but do not mix out. This avoids \"dipping\" when crossfading\r\n\t * animations that key the same property. A subsequent timeline will set this property using a mix. */\r\n\tstatic HOLD_SUBSEQUENT = 2;\r\n\t/** 1) This is the first timeline to set this property.<br>\r\n\t * 2) The next track entry to be applied does have a timeline to set this property.<br>\r\n\t * 3) The next track entry after that one does not have a timeline to set this property.<br>\r\n\t * Result: Mix from the setup pose to the timeline pose, but do not mix out. This avoids \"dipping\" when crossfading animations\r\n\t * that key the same property. A subsequent timeline will set this property using a mix. */\r\n\tstatic HOLD_FIRST = 3;\r\n\t/** 1. This is the first timeline to set this property.\r\n\t * 2. The next track entry to be applied does have a timeline to set this property.\r\n\t * 3. The next track entry after that one does have a timeline to set this property.\r\n\t * 4. timelineHoldMix stores the first subsequent track entry that does not have a timeline to set this property.\r\n\t *\r\n\t * Result: The same as HOLD except the mix percentage from the timelineHoldMix track entry is used. This handles when more than\r\n\t * 2 track entries in a row have a timeline that sets the same property.\r\n\t *\r\n\t * Eg, A -> B -> C -> D where A, B, and C have a timeline setting same property, but D does not. When A is applied, to avoid\r\n\t * \"dipping\" A is not mixed out, however D (the first entry that doesn't set the property) mixing in is used to mix out A\r\n\t * (which affects B and C). Without using D to mix out, A would be applied fully until mixing completes, then snap into\r\n\t * place. */\r\n\tstatic HOLD_MIX = 4;\r\n\r\n\tstatic SETUP = 1;\r\n\tstatic CURRENT = 2;\r\n\r\n\t/** The AnimationStateData to look up mix durations. */\r\n\tdata: AnimationStateData;\r\n\r\n\t/** The list of tracks that currently have animations, which may contain null entries. */\r\n\ttracks = new Array<TrackEntry>();\r\n\r\n\t/** Multiplier for the delta time when the animation state is updated, causing time for all animations and mixes to play slower\r\n\t * or faster. Defaults to 1.\r\n\t *\r\n\t * See TrackEntry {@link TrackEntry#timeScale} for affecting a single animation. */\r\n\ttimeScale = 1;\r\n\tunkeyedState = 0;\r\n\r\n\tevents = new Array<Event>();\r\n\tlisteners = new Array<AnimationStateListener>();\r\n\tqueue = new EventQueue(this);\r\n\tpropertyIDs = new IntSet();\r\n\tanimationsChanged = false;\r\n\r\n\ttrackEntryPool = new Pool<TrackEntry>(() => new TrackEntry());\r\n\r\n\tconstructor (data: AnimationStateData) {\r\n\t\tthis.data = data;\r\n\t}\r\n\r\n\t/** Increments each track entry {@link TrackEntry#trackTime()}, setting queued animations as current if needed. */\r\n\tupdate (delta: number) {\r\n\t\tdelta *= this.timeScale;\r\n\t\tlet tracks = this.tracks;\r\n\t\tfor (let i = 0, n = tracks.length; i < n; i++) {\r\n\t\t\tlet current = tracks[i];\r\n\t\t\tif (current == null) continue;\r\n\r\n\t\t\tcurrent.animationLast = current.nextAnimationLast;\r\n\t\t\tcurrent.trackLast = current.nextTrackLast;\r\n\r\n\t\t\tlet currentDelta = delta * current.timeScale;\r\n\r\n\t\t\tif (current.delay > 0) {\r\n\t\t\t\tcurrent.delay -= currentDelta;\r\n\t\t\t\tif (current.delay > 0) continue;\r\n\t\t\t\tcurrentDelta = -current.delay;\r\n\t\t\t\tcurrent.delay = 0;\r\n\t\t\t}\r\n\r\n\t\t\tlet next = current.next;\r\n\t\t\tif (next != null) {\r\n\t\t\t\t// When the next entry's delay is passed, change to the next entry, preserving leftover time.\r\n\t\t\t\tlet nextTime = current.trackLast - next.delay;\r\n\t\t\t\tif (nextTime >= 0) {\r\n\t\t\t\t\tnext.delay = 0;\r\n\t\t\t\t\tnext.trackTime += current.timeScale == 0 ? 0 : (nextTime / current.timeScale + delta) * next.timeScale;\r\n\t\t\t\t\tcurrent.trackTime += currentDelta;\r\n\t\t\t\t\tthis.setCurrent(i, next, true);\r\n\t\t\t\t\twhile (next.mixingFrom != null) {\r\n\t\t\t\t\t\tnext.mixTime += delta;\r\n\t\t\t\t\t\tnext = next.mixingFrom;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t} else if (current.trackLast >= current.trackEnd && current.mixingFrom == null) {\r\n\t\t\t\ttracks[i] = null;\r\n\t\t\t\tthis.queue.end(current);\r\n\t\t\t\tthis.disposeNext(current);\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tif (current.mixingFrom != null && this.updateMixingFrom(current, delta)) {\r\n\t\t\t\t// End mixing from entries once all have completed.\r\n\t\t\t\tlet from = current.mixingFrom;\r\n\t\t\t\tcurrent.mixingFrom = null;\r\n\t\t\t\tif (from != null) from.mixingTo = null;\r\n\t\t\t\twhile (from != null) {\r\n\t\t\t\t\tthis.queue.end(from);\r\n\t\t\t\t\tfrom = from.mixingFrom;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tcurrent.trackTime += currentDelta;\r\n\t\t}\r\n\r\n\t\tthis.queue.drain();\r\n\t}\r\n\r\n\t/** Returns true when all mixing from entries are complete. */\r\n\tupdateMixingFrom (to: TrackEntry, delta: number): boolean {\r\n\t\tlet from = to.mixingFrom;\r\n\t\tif (from == null) return true;\r\n\r\n\t\tlet finished = this.updateMixingFrom(from, delta);\r\n\r\n\t\tfrom.animationLast = from.nextAnimationLast;\r\n\t\tfrom.trackLast = from.nextTrackLast;\r\n\r\n\t\t// Require mixTime > 0 to ensure the mixing from entry was applied at least once.\r\n\t\tif (to.mixTime > 0 && to.mixTime >= to.mixDuration) {\r\n\t\t\t// Require totalAlpha == 0 to ensure mixing is complete, unless mixDuration == 0 (the transition is a single frame).\r\n\t\t\tif (from.totalAlpha == 0 || to.mixDuration == 0) {\r\n\t\t\t\tto.mixingFrom = from.mixingFrom;\r\n\t\t\t\tif (from.mixingFrom != null) from.mixingFrom.mixingTo = to;\r\n\t\t\t\tto.interruptAlpha = from.interruptAlpha;\r\n\t\t\t\tthis.queue.end(from);\r\n\t\t\t}\r\n\t\t\treturn finished;\r\n\t\t}\r\n\r\n\t\tfrom.trackTime += delta * from.timeScale;\r\n\t\tto.mixTime += delta;\r\n\t\treturn false;\r\n\t}\r\n\r\n\t/** Poses the skeleton using the track entry animations. There are no side effects other than invoking listeners, so the\r\n\t * animation state can be applied to multiple skeletons to pose them identically.\r\n\t * @returns True if any animations were applied. */\r\n\tapply (skeleton: Skeleton) : boolean {\r\n\t\tif (skeleton == null) throw new Error(\"skeleton cannot be null.\");\r\n\t\tif (this.animationsChanged) this._animationsChanged();\r\n\r\n\t\tlet events = this.events;\r\n\t\tlet tracks = this.tracks;\r\n\t\tlet applied = false;\r\n\r\n\t\tfor (let i = 0, n = tracks.length; i < n; i++) {\r\n\t\t\tlet current = tracks[i];\r\n\t\t\tif (current == null || current.delay > 0) continue;\r\n\t\t\tapplied = true;\r\n\t\t\tlet blend: MixBlend = i == 0 ? MixBlend.first : current.mixBlend;\r\n\r\n\t\t\t// Apply mixing from entries first.\r\n\t\t\tlet mix = current.alpha;\r\n\t\t\tif (current.mixingFrom != null)\r\n\t\t\t\tmix *= this.applyMixingFrom(current, skeleton, blend);\r\n\t\t\telse if (current.trackTime >= current.trackEnd && current.next == null)\r\n\t\t\t\tmix = 0;\r\n\r\n\t\t\t// Apply current entry.\r\n\t\t\tlet animationLast = current.animationLast, animationTime = current.getAnimationTime();\r\n\t\t\tlet timelineCount = current.animation.timelines.length;\r\n\t\t\tlet timelines = current.animation.timelines;\r\n\t\t\tif ((i == 0 && mix == 1) || blend == MixBlend.add) {\r\n\t\t\t\tfor (let ii = 0; ii < timelineCount; ii++) {\r\n\t\t\t\t\t// Fixes issue #302 on IOS9 where mix, blend sometimes became undefined and caused assets\r\n\t\t\t\t\t// to sometimes stop rendering when using color correction, as their RGBA values become NaN.\r\n\t\t\t\t\t// (https://github.com/pixijs/pixi-spine/issues/302)\r\n\t\t\t\t\tUtils.webkit602BugfixHelper(mix, blend);\r\n\t\t\t\t\tvar timeline = timelines[ii];\r\n\t\t\t\t\tif (timeline instanceof AttachmentTimeline)\r\n\t\t\t\t\t\tthis.applyAttachmentTimeline(timeline, skeleton, animationTime, blend, true);\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\ttimeline.apply(skeleton, animationLast, animationTime, events, mix, blend, MixDirection.mixIn);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tlet timelineMode = current.timelineMode;\r\n\r\n\t\t\t\tlet firstFrame = current.timelinesRotation.length == 0;\r\n\t\t\t\tif (firstFrame) Utils.setArraySize(current.timelinesRotation, timelineCount << 1, null);\r\n\t\t\t\tlet timelinesRotation = current.timelinesRotation;\r\n\r\n\t\t\t\tfor (let ii = 0; ii < timelineCount; ii++) {\r\n\t\t\t\t\tlet timeline = timelines[ii];\r\n\t\t\t\t\tlet timelineBlend = timelineMode[ii] == AnimationState.SUBSEQUENT ? blend : MixBlend.setup;\r\n\t\t\t\t\tif (timeline instanceof RotateTimeline) {\r\n\t\t\t\t\t\tthis.applyRotateTimeline(timeline, skeleton, animationTime, mix, timelineBlend, timelinesRotation, ii << 1, firstFrame);\r\n\t\t\t\t\t} else if (timeline instanceof AttachmentTimeline) {\r\n\t\t\t\t\t\tthis.applyAttachmentTimeline(timeline, skeleton, animationTime, blend, true);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// This fixes the WebKit 602 specific issue described at http://esotericsoftware.com/forum/iOS-10-disappearing-graphics-10109\r\n\t\t\t\t\t\tUtils.webkit602BugfixHelper(mix, blend);\r\n\t\t\t\t\t\ttimeline.apply(skeleton, animationLast, animationTime, events, mix, timelineBlend, MixDirection.mixIn);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.queueEvents(current, animationTime);\r\n\t\t\tevents.length = 0;\r\n\t\t\tcurrent.nextAnimationLast = animationTime;\r\n\t\t\tcurrent.nextTrackLast = current.trackTime;\r\n\t\t}\r\n\r\n\t\t// Set slots attachments to the setup pose, if needed. This occurs if an animation that is mixing out sets attachments so\r\n\t\t// subsequent timelines see any deform, but the subsequent timelines don't set an attachment (eg they are also mixing out or\r\n\t\t// the time is before the first key).\r\n\t\tvar setupState = this.unkeyedState + AnimationState.SETUP;\r\n\t\tvar slots = skeleton.slots;\r\n\t\tfor (var i = 0, n = skeleton.slots.length; i < n; i++) {\r\n\t\t\tvar slot = slots[i];\r\n\t\t\tif (slot.attachmentState == setupState) {\r\n\t\t\t\tvar attachmentName = slot.data.attachmentName;\r\n\t\t\t\tslot.attachment = (attachmentName == null ? null : skeleton.getAttachment(slot.data.index, attachmentName));\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.unkeyedState += 2; // Increasing after each use avoids the need to reset attachmentState for every slot.\r\n\r\n\t\tthis.queue.drain();\r\n\t\treturn applied;\r\n\t}\r\n\r\n\tapplyMixingFrom (to: TrackEntry, skeleton: Skeleton, blend: MixBlend) {\r\n\t\tlet from = to.mixingFrom;\r\n\t\tif (from.mixingFrom != null) this.applyMixingFrom(from, skeleton, blend);\r\n\r\n\t\tlet mix = 0;\r\n\t\tif (to.mixDuration == 0) { // Single frame mix to undo mixingFrom changes.\r\n\t\t\tmix = 1;\r\n\t\t\tif (blend == MixBlend.first) blend = MixBlend.setup;\r\n\t\t} else {\r\n\t\t\tmix = to.mixTime / to.mixDuration;\r\n\t\t\tif (mix > 1) mix = 1;\r\n\t\t\tif (blend != MixBlend.first) blend = from.mixBlend;\r\n\t\t}\r\n\r\n\t\tlet events = mix < from.eventThreshold ? this.events : null;\r\n\t\tlet attachments = mix < from.attachmentThreshold, drawOrder = mix < from.drawOrderThreshold;\r\n\t\tlet animationLast = from.animationLast, animationTime = from.getAnimationTime();\r\n\t\tlet timelineCount = from.animation.timelines.length;\r\n\t\tlet timelines = from.animation.timelines;\r\n\t\tlet alphaHold = from.alpha * to.interruptAlpha, alphaMix = alphaHold * (1 - mix);\r\n\t\tif (blend == MixBlend.add) {\r\n\t\t\tfor (let i = 0; i < timelineCount; i++)\r\n\t\t\t\ttimelines[i].apply(skeleton, animationLast, animationTime, events, alphaMix, blend, MixDirection.mixOut);\r\n\t\t} else {\r\n\t\t\tlet timelineMode = from.timelineMode;\r\n\t\t\tlet timelineHoldMix = from.timelineHoldMix;\r\n\r\n\t\t\tlet firstFrame = from.timelinesRotation.length == 0;\r\n\t\t\tif (firstFrame) Utils.setArraySize(from.timelinesRotation, timelineCount << 1, null);\r\n\t\t\tlet timelinesRotation = from.timelinesRotation;\r\n\r\n\t\t\tfrom.totalAlpha = 0;\r\n\t\t\tfor (let i = 0; i < timelineCount; i++) {\r\n\t\t\t\tlet timeline = timelines[i];\r\n\t\t\t\tlet direction = MixDirection.mixOut;\r\n\t\t\t\tlet timelineBlend: MixBlend;\r\n\t\t\t\tlet alpha = 0;\r\n\t\t\t\tswitch (timelineMode[i]) {\r\n\t\t\t\tcase AnimationState.SUBSEQUENT:\r\n\t\t\t\t\tif (!drawOrder && timeline instanceof DrawOrderTimeline) continue;\r\n\t\t\t\t\ttimelineBlend = blend;\r\n\t\t\t\t\talpha = alphaMix;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase AnimationState.FIRST:\r\n\t\t\t\t\ttimelineBlend = MixBlend.setup;\r\n\t\t\t\t\talpha = alphaMix;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase AnimationState.HOLD_SUBSEQUENT:\r\n\t\t\t\t\ttimelineBlend = blend;\r\n\t\t\t\t\talpha = alphaHold;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase AnimationState.HOLD_FIRST:\r\n\t\t\t\t\ttimelineBlend = MixBlend.setup;\r\n\t\t\t\t\talpha = alphaHold;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\ttimelineBlend = MixBlend.setup;\r\n\t\t\t\t\tlet holdMix = timelineHoldMix[i];\r\n\t\t\t\t\talpha = alphaHold * Math.max(0, 1 - holdMix.mixTime / holdMix.mixDuration);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tfrom.totalAlpha += alpha;\r\n\r\n\t\t\t\tif (timeline instanceof RotateTimeline)\r\n\t\t\t\t\tthis.applyRotateTimeline(timeline, skeleton, animationTime, alpha, timelineBlend, timelinesRotation, i << 1, firstFrame);\r\n\t\t\t\telse if (timeline instanceof AttachmentTimeline)\r\n\t\t\t\t\tthis.applyAttachmentTimeline(timeline, skeleton, animationTime, timelineBlend, attachments);\r\n\t\t\t\telse {\r\n\t\t\t\t\t// This fixes the WebKit 602 specific issue described at http://esotericsoftware.com/forum/iOS-10-disappearing-graphics-10109\r\n\t\t\t\t\tUtils.webkit602BugfixHelper(alpha, blend);\r\n\t\t\t\t\tif (drawOrder && timeline instanceof DrawOrderTimeline && timelineBlend == MixBlend.setup)\r\n\t\t\t\t\t\tdirection = MixDirection.mixIn;\r\n\t\t\t\t\ttimeline.apply(skeleton, animationLast, animationTime, events, alpha, timelineBlend, direction);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (to.mixDuration > 0) this.queueEvents(from, animationTime);\r\n\t\tthis.events.length = 0;\r\n\t\tfrom.nextAnimationLast = animationTime;\r\n\t\tfrom.nextTrackLast = from.trackTime;\r\n\r\n\t\treturn mix;\r\n\t}\r\n\r\n\tapplyAttachmentTimeline (timeline: AttachmentTimeline, skeleton: Skeleton, time: number, blend: MixBlend, attachments: boolean) {\r\n\r\n\t\tvar slot = skeleton.slots[timeline.slotIndex];\r\n\t\tif (!slot.bone.active) return;\r\n\r\n\t\tvar frames = timeline.frames;\r\n\t\tif (time < frames[0]) { // Time is before first frame.\r\n\t\t\tif (blend == MixBlend.setup || blend == MixBlend.first)\r\n\t\t\t\tthis.setAttachment(skeleton, slot, slot.data.attachmentName, attachments);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tvar frameIndex;\r\n\t\t\tif (time >= frames[frames.length - 1]) // Time is after last frame.\r\n\t\t\t\tframeIndex = frames.length - 1;\r\n\t\t\telse\r\n\t\t\t\tframeIndex = Animation.binarySearch(frames, time) - 1;\r\n\t\t\tthis.setAttachment(skeleton, slot, timeline.attachmentNames[frameIndex], attachments);\r\n\t\t}\r\n\r\n\t\t// If an attachment wasn't set (ie before the first frame or attachments is false), set the setup attachment later.\r\n\t\tif (slot.attachmentState <= this.unkeyedState) slot.attachmentState = this.unkeyedState + AnimationState.SETUP;\r\n\t}\r\n\r\n\tsetAttachment (skeleton: Skeleton, slot: Slot, attachmentName: string, attachments: boolean) {\r\n\t\tslot.attachment = attachmentName == null ? null : skeleton.getAttachment(slot.data.index, attachmentName);\r\n\t\tif (attachments) slot.attachmentState = this.unkeyedState + AnimationState.CURRENT;\r\n\t}\r\n\r\n\r\n\tapplyRotateTimeline (timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, blend: MixBlend,\r\n\t\ttimelinesRotation: Array<number>, i: number, firstFrame: boolean) {\r\n\r\n\t\tif (firstFrame) timelinesRotation[i] = 0;\r\n\r\n\t\tif (alpha == 1) {\r\n\t\t\ttimeline.apply(skeleton, 0, time, null, 1, blend, MixDirection.mixIn);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet rotateTimeline = timeline as RotateTimeline;\r\n\t\tlet frames = rotateTimeline.frames;\r\n\t\tlet bone = skeleton.bones[rotateTimeline.boneIndex];\r\n\t\tif (!bone.active) return;\r\n\t\tlet r1 = 0, r2 = 0;\r\n\t\tif (time < frames[0]) {\r\n\t\t\tswitch (blend) {\r\n\t\t\t\tcase MixBlend.setup:\r\n\t\t\t\t\tbone.rotation = bone.data.rotation;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\treturn;\r\n\t\t\t\tcase MixBlend.first:\r\n\t\t\t\t\tr1 = bone.rotation;\r\n\t\t\t\t\tr2 = bone.data.rotation;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tr1 = blend == MixBlend.setup ? bone.data.rotation : bone.rotation;\r\n\t\t\tif (time >= frames[frames.length - RotateTimeline.ENTRIES]) // Time is after last frame.\r\n\t\t\t\tr2 = bone.data.rotation + frames[frames.length + RotateTimeline.PREV_ROTATION];\r\n\t\t\telse {\r\n\t\t\t\t// Interpolate between the previous frame and the current frame.\r\n\t\t\t\tlet frame = Animation.binarySearch(frames, time, RotateTimeline.ENTRIES);\r\n\t\t\t\tlet prevRotation = frames[frame + RotateTimeline.PREV_ROTATION];\r\n\t\t\t\tlet frameTime = frames[frame];\r\n\t\t\t\tlet percent = rotateTimeline.getCurvePercent((frame >> 1) - 1,\r\n\t\t\t\t\t1 - (time - frameTime) / (frames[frame + RotateTimeline.PREV_TIME] - frameTime));\r\n\r\n\t\t\t\tr2 = frames[frame + RotateTimeline.ROTATION] - prevRotation;\r\n\t\t\t\tr2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;\r\n\t\t\t\tr2 = prevRotation + r2 * percent + bone.data.rotation;\r\n\t\t\t\tr2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Mix between rotations using the direction of the shortest route on the first frame while detecting crosses.\r\n\t\tlet total = 0, diff = r2 - r1;\r\n\t\tdiff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;\r\n\t\tif (diff == 0) {\r\n\t\t\ttotal = timelinesRotation[i];\r\n\t\t} else {\r\n\t\t\tlet lastTotal = 0, lastDiff = 0;\r\n\t\t\tif (firstFrame) {\r\n\t\t\t\tlastTotal = 0;\r\n\t\t\t\tlastDiff = diff;\r\n\t\t\t} else {\r\n\t\t\t\tlastTotal = timelinesRotation[i]; // Angle and direction of mix, including loops.\r\n\t\t\t\tlastDiff = timelinesRotation[i + 1]; // Difference between bones.\r\n\t\t\t}\r\n\t\t\tlet current = diff > 0, dir = lastTotal >= 0;\r\n\t\t\t// Detect cross at 0 (not 180).\r\n\t\t\tif (MathUtils.signum(lastDiff) != MathUtils.signum(diff) && Math.abs(lastDiff) <= 90) {\r\n\t\t\t\t// A cross after a 360 rotation is a loop.\r\n\t\t\t\tif (Math.abs(lastTotal) > 180) lastTotal += 360 * MathUtils.signum(lastTotal);\r\n\t\t\t\tdir = current;\r\n\t\t\t}\r\n\t\t\ttotal = diff + lastTotal - lastTotal % 360; // Store loops as part of lastTotal.\r\n\t\t\tif (dir != current) total += 360 * MathUtils.signum(lastTotal);\r\n\t\t\ttimelinesRotation[i] = total;\r\n\t\t}\r\n\t\ttimelinesRotation[i + 1] = diff;\r\n\t\tr1 += total * alpha;\r\n\t\tbone.rotation = r1 - (16384 - ((16384.499999999996 - r1 / 360) | 0)) * 360;\r\n\t}\r\n\r\n\tqueueEvents (entry: TrackEntry, animationTime: number) {\r\n\t\tlet animationStart = entry.animationStart, animationEnd = entry.animationEnd;\r\n\t\tlet duration = animationEnd - animationStart;\r\n\t\tlet trackLastWrapped = entry.trackLast % duration;\r\n\r\n\t\t// Queue events before complete.\r\n\t\tlet events = this.events;\r\n\t\tlet i = 0, n = events.length;\r\n\t\tfor (; i < n; i++) {\r\n\t\t\tlet event = events[i];\r\n\t\t\tif (event.time < trackLastWrapped) break;\r\n\t\t\tif (event.time > animationEnd) continue; // Discard events outside animation start/end.\r\n\t\t\tthis.queue.event(entry, event);\r\n\t\t}\r\n\r\n\t\t// Queue complete if completed a loop iteration or the animation.\r\n\t\tlet complete = false;\r\n\t\tif (entry.loop)\r\n\t\t\tcomplete = duration == 0 || trackLastWrapped > entry.trackTime % duration;\r\n\t\telse\r\n\t\t\tcomplete = animationTime >= animationEnd && entry.animationLast < animationEnd;\r\n\t\tif (complete) this.queue.complete(entry);\r\n\r\n\t\t// Queue events after complete.\r\n\t\tfor (; i < n; i++) {\r\n\t\t\tlet event = events[i];\r\n\t\t\tif (event.time < animationStart) continue; // Discard events outside animation start/end.\r\n\t\t\tthis.queue.event(entry, events[i]);\r\n\t\t}\r\n\t}\r\n\r\n\t/** Removes all animations from all tracks, leaving skeletons in their current pose.\r\n\t *\r\n\t * It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,\r\n\t * rather than leaving them in their current pose. */\r\n\tclearTracks () {\r\n\t\tlet oldDrainDisabled = this.queue.drainDisabled;\r\n\t\tthis.queue.drainDisabled = true;\r\n\t\tfor (let i = 0, n = this.tracks.length; i < n; i++)\r\n\t\t\tthis.clearTrack(i);\r\n\t\tthis.tracks.length = 0;\r\n\t\tthis.queue.drainDisabled = oldDrainDisabled;\r\n\t\tthis.queue.drain();\r\n\t}\r\n\r\n\t/** Removes all animations from the track, leaving skeletons in their current pose.\r\n\t *\r\n\t * It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,\r\n\t * rather than leaving them in their current pose. */\r\n\tclearTrack (trackIndex: number) {\r\n\t\tif (trackIndex >= this.tracks.length) return;\r\n\t\tlet current = this.tracks[trackIndex];\r\n\t\tif (current == null) return;\r\n\r\n\t\tthis.queue.end(current);\r\n\r\n\t\tthis.disposeNext(current);\r\n\r\n\t\tlet entry = current;\r\n\t\twhile (true) {\r\n\t\t\tlet from = entry.mixingFrom;\r\n\t\t\tif (from == null) break;\r\n\t\t\tthis.queue.end(from);\r\n\t\t\tentry.mixingFrom = null;\r\n\t\t\tentry.mixingTo = null;\r\n\t\t\tentry = from;\r\n\t\t}\r\n\r\n\t\tthis.tracks[current.trackIndex] = null;\r\n\r\n\t\tthis.queue.drain();\r\n\t}\r\n\r\n\tsetCurrent (index: number, current: TrackEntry, interrupt: boolean) {\r\n\t\tlet from = this.expandToIndex(index);\r\n\t\tthis.tracks[index] = current;\r\n\r\n\t\tif (from != null) {\r\n\t\t\tif (interrupt) this.queue.interrupt(from);\r\n\t\t\tcurrent.mixingFrom = from;\r\n\t\t\tfrom.mixingTo = current;\r\n\t\t\tcurrent.mixTime = 0;\r\n\r\n\t\t\t// Store the interrupted mix percentage.\r\n\t\t\tif (from.mixingFrom != null && from.mixDuration > 0)\r\n\t\t\t\tcurrent.interruptAlpha *= Math.min(1, from.mixTime / from.mixDuration);\r\n\r\n\t\t\tfrom.timelinesRotation.length = 0; // Reset rotation for mixing out, in case entry was mixed in.\r\n\t\t}\r\n\r\n\t\tthis.queue.start(current);\r\n\t}\r\n\r\n\t/** Sets an animation by name.\r\n\t*\r\n\t* {@link #setAnimationWith(}. */\r\n\tsetAnimation (trackIndex: number, animationName: string, loop: boolean) {\r\n\t\tlet animation = this.data.skeletonData.findAnimation(animationName);\r\n\t\tif (animation == null) throw new Error(\"Animation not found: \" + animationName);\r\n\t\treturn this.setAnimationWith(trackIndex, animation, loop);\r\n\t}\r\n\r\n\t/** Sets the current animation for a track, discarding any queued animations. If the formerly current track entry was never\r\n\t * applied to a skeleton, it is replaced (not mixed from).\r\n\t * @param loop If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its\r\n\t * duration. In either case {@link TrackEntry#trackEnd} determines when the track is cleared.\r\n\t * @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept\r\n\t * after the {@link AnimationStateListener#dispose()} event occurs. */\r\n\tsetAnimationWith (trackIndex: number, animation: Animation, loop: boolean) {\r\n\t\tif (animation == null) throw new Error(\"animation cannot be null.\");\r\n\t\tlet interrupt = true;\r\n\t\tlet current = this.expandToIndex(trackIndex);\r\n\t\tif (current != null) {\r\n\t\t\tif (current.nextTrackLast == -1) {\r\n\t\t\t\t// Don't mix from an entry that was never applied.\r\n\t\t\t\tthis.tracks[trackIndex] = current.mixingFrom;\r\n\t\t\t\tthis.queue.interrupt(current);\r\n\t\t\t\tthis.queue.end(current);\r\n\t\t\t\tthis.disposeNext(current);\r\n\t\t\t\tcurrent = current.mixingFrom;\r\n\t\t\t\tinterrupt = false;\r\n\t\t\t} else\r\n\t\t\t\tthis.disposeNext(current);\r\n\t\t}\r\n\t\tlet entry = this.trackEntry(trackIndex, animation, loop, current);\r\n\t\tthis.setCurrent(trackIndex, entry, interrupt);\r\n\t\tthis.queue.drain();\r\n\t\treturn entry;\r\n\t}\r\n\r\n\t/** Queues an animation by name.\r\n\t *\r\n\t * See {@link #addAnimationWith()}. */\r\n\taddAnimation (trackIndex: number, animationName: string, loop: boolean, delay: number) {\r\n\t\tlet animation = this.data.skeletonData.findAnimation(animationName);\r\n\t\tif (animation == null) throw new Error(\"Animation not found: \" + animationName);\r\n\t\treturn this.addAnimationWith(trackIndex, animation, loop, delay);\r\n\t}\r\n\r\n\t/** Adds an animation to be played after the current or last queued animation for a track. If the track is empty, it is\r\n\t * equivalent to calling {@link #setAnimationWith()}.\r\n\t * @param delay If > 0, sets {@link TrackEntry#delay}. If <= 0, the delay set is the duration of the previous track entry\r\n\t * minus any mix duration (from the {@link AnimationStateData}) plus the specified `delay` (ie the mix\r\n\t * ends at (`delay` = 0) or before (`delay` < 0) the previous track entry duration). If the\r\n\t * previous entry is looping, its next loop completion is used instead of its duration.\r\n\t * @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept\r\n\t * after the {@link AnimationStateListener#dispose()} event occurs. */\r\n\taddAnimationWith (trackIndex: number, animation: Animation, loop: boolean, delay: number) {\r\n\t\tif (animation == null) throw new Error(\"animation cannot be null.\");\r\n\r\n\t\tlet last = this.expandToIndex(trackIndex);\r\n\t\tif (last != null) {\r\n\t\t\twhile (last.next != null)\r\n\t\t\t\tlast = last.next;\r\n\t\t}\r\n\r\n\t\tlet entry = this.trackEntry(trackIndex, animation, loop, last);\r\n\r\n\t\tif (last == null) {\r\n\t\t\tthis.setCurrent(trackIndex, entry, true);\r\n\t\t\tthis.queue.drain();\r\n\t\t} else {\r\n\t\t\tlast.next = entry;\r\n\t\t\tif (delay <= 0) {\r\n\t\t\t\tlet duration = last.animationEnd - last.animationStart;\r\n\t\t\t\tif (duration != 0) {\r\n\t\t\t\t\tif (last.loop)\r\n\t\t\t\t\t\tdelay += duration * (1 + ((last.trackTime / duration) | 0));\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tdelay += Math.max(duration, last.trackTime);\r\n\t\t\t\t\tdelay -= this.data.getMix(last.animation, animation);\r\n\t\t\t\t} else\r\n\t\t\t\t\tdelay = last.trackTime;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tentry.delay = delay;\r\n\t\treturn entry;\r\n\t}\r\n\r\n\t/** Sets an empty animation for a track, discarding any queued animations, and sets the track entry's\r\n\t * {@link TrackEntry#mixduration}. An empty animation has no timelines and serves as a placeholder for mixing in or out.\r\n\t *\r\n\t * Mixing out is done by setting an empty animation with a mix duration using either {@link #setEmptyAnimation()},\r\n\t * {@link #setEmptyAnimations()}, or {@link #addEmptyAnimation()}. Mixing to an empty animation causes\r\n\t * the previous animation to be applied less and less over the mix duration. Properties keyed in the previous animation\r\n\t * transition to the value from lower tracks or to the setup pose value if no lower tracks key the property. A mix duration of\r\n\t * 0 still mixes out over one frame.\r\n\t *\r\n\t * Mixing in is done by first setting an empty animation, then adding an animation using\r\n\t * {@link #addAnimation()} and on the returned track entry, set the\r\n\t * {@link TrackEntry#setMixDuration()}. Mixing from an empty animation causes the new animation to be applied more and\r\n\t * more over the mix duration. Properties keyed in the new animation transition from the value from lower tracks or from the\r\n\t * setup pose value if no lower tracks key the property to the value keyed in the new animation. */\r\n\tsetEmptyAnimation (trackIndex: number, mixDuration: number) {\r\n\t\tlet entry = this.setAnimationWith(trackIndex, AnimationState.emptyAnimation, false);\r\n\t\tentry.mixDuration = mixDuration;\r\n\t\tentry.trackEnd = mixDuration;\r\n\t\treturn entry;\r\n\t}\r\n\r\n\t/** Adds an empty animation to be played after the current or last queued animation for a track, and sets the track entry's\r\n\t * {@link TrackEntry#mixDuration}. If the track is empty, it is equivalent to calling\r\n\t * {@link #setEmptyAnimation()}.\r\n\t *\r\n\t * See {@link #setEmptyAnimation()}.\r\n\t * @param delay If > 0, sets {@link TrackEntry#delay}. If <= 0, the delay set is the duration of the previous track entry\r\n\t * minus any mix duration plus the specified `delay` (ie the mix ends at (`delay` = 0) or\r\n\t * before (`delay` < 0) the previous track entry duration). If the previous entry is looping, its next\r\n\t * loop completion is used instead of its duration.\r\n\t * @return A track entry to allow further customization of animation playback. References to the track entry must not be kept\r\n\t * after the {@link AnimationStateListener#dispose()} event occurs. */\r\n\taddEmptyAnimation (trackIndex: number, mixDuration: number, delay: number) {\r\n\t\tif (delay <= 0) delay -= mixDuration;\r\n\t\tlet entry = this.addAnimationWith(trackIndex, AnimationState.emptyAnimation, false, delay);\r\n\t\tentry.mixDuration = mixDuration;\r\n\t\tentry.trackEnd = mixDuration;\r\n\t\treturn entry;\r\n\t}\r\n\r\n\t/** Sets an empty animation for every track, discarding any queued animations, and mixes to it over the specified mix\r\n\t* duration. */\r\n\tsetEmptyAnimations (mixDuration: number) {\r\n\t\tlet oldDrainDisabled = this.queue.drainDisabled;\r\n\t\tthis.queue.drainDisabled = true;\r\n\t\tfor (let i = 0, n = this.tracks.length; i < n; i++) {\r\n\t\t\tlet current = this.tracks[i];\r\n\t\t\tif (current != null) this.setEmptyAnimation(current.trackIndex, mixDuration);\r\n\t\t}\r\n\t\tthis.queue.drainDisabled = oldDrainDisabled;\r\n\t\tthis.queue.drain();\r\n\t}\r\n\r\n\texpandToIndex (index: number) {\r\n\t\tif (index < this.tracks.length) return this.tracks[index];\r\n\t\tUtils.ensureArrayCapacity(this.tracks, index + 1, null);\r\n\t\tthis.tracks.length = index + 1;\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/** @param last May be null. */\r\n\ttrackEntry (trackIndex: number, animation: Animation, loop: boolean, last: TrackEntry) {\r\n\t\tlet entry = this.trackEntryPool.obtain();\r\n\t\tentry.trackIndex = trackIndex;\r\n\t\tentry.animation = animation;\r\n\t\tentry.loop = loop;\r\n\t\tentry.holdPrevious = false;\r\n\r\n\t\tentry.eventThreshold = 0;\r\n\t\tentry.attachmentThreshold = 0;\r\n\t\tentry.drawOrderThreshold = 0;\r\n\r\n\t\tentry.animationStart = 0;\r\n\t\tentry.animationEnd = animation.duration;\r\n\t\tentry.animationLast = -1;\r\n\t\tentry.nextAnimationLast = -1;\r\n\r\n\t\tentry.delay = 0;\r\n\t\tentry.trackTime = 0;\r\n\t\tentry.trackLast = -1;\r\n\t\tentry.nextTrackLast = -1;\r\n\t\tentry.trackEnd = Number.MAX_VALUE;\r\n\t\tentry.timeScale = 1;\r\n\r\n\t\tentry.alpha = 1;\r\n\t\tentry.interruptAlpha = 1;\r\n\t\tentry.mixTime = 0;\r\n\t\tentry.mixDuration = last == null ? 0 : this.data.getMix(last.animation, animation);\r\n\t\tentry.mixBlend = MixBlend.replace;\r\n\t\treturn entry;\r\n\t}\r\n\r\n\tdisposeNext (entry: TrackEntry) {\r\n\t\tlet next = entry.next;\r\n\t\twhile (next != null) {\r\n\t\t\tthis.queue.dispose(next);\r\n\t\t\tnext = next.next;\r\n\t\t}\r\n\t\tentry.next = null;\r\n\t}\r\n\r\n\t_animationsChanged () {\r\n\t\tthis.animationsChanged = false;\r\n\r\n\t\tthis.propertyIDs.clear();\r\n\r\n\t\tfor (let i = 0, n = this.tracks.length; i < n; i++) {\r\n\t\t\tlet entry = this.tracks[i];\r\n\t\t\tif (entry == null) continue;\r\n\t\t\twhile (entry.mixingFrom != null)\r\n\t\t\t\tentry = entry.mixingFrom;\r\n\r\n\t\t\tdo {\r\n\t\t\t\tif (entry.mixingFrom == null || entry.mixBlend != MixBlend.add) this.computeHold(entry);\r\n\t\t\t\tentry = entry.mixingTo;\r\n\t\t\t} while (entry != null)\r\n\t\t}\r\n\t}\r\n\r\n\tcomputeHold (entry: TrackEntry) {\r\n\t\tlet to = entry.mixingTo;\r\n\t\tlet timelines = entry.animation.timelines;\r\n\t\tlet timelinesCount = entry.animation.timelines.length;\r\n\t\tlet timelineMode = Utils.setArraySize(entry.timelineMode, timelinesCount);\r\n\t\tentry.timelineHoldMix.length = 0;\r\n\t\tlet timelineDipMix = Utils.setArraySize(entry.timelineHoldMix, timelinesCount);\r\n\t\tlet propertyIDs = this.propertyIDs;\r\n\r\n\t\tif (to != null && to.holdPrevious) {\r\n\t\t\tfor (let i = 0; i < timelinesCount; i++) {\r\n\t\t\t\ttimelineMode[i] = propertyIDs.add(timelines[i].getPropertyId()) ? AnimationState.HOLD_FIRST : AnimationState.HOLD_SUBSEQUENT;\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\touter:\r\n\t\tfor (let i = 0; i < timelinesCount; i++) {\r\n\t\t\tlet timeline = timelines[i];\r\n\t\t\tlet id = timeline.getPropertyId();\r\n\t\t\tif (!propertyIDs.add(id))\r\n\t\t\t\ttimelineMode[i] = AnimationState.SUBSEQUENT;\r\n\t\t\telse if (to == null || timeline instanceof AttachmentTimeline || timeline instanceof DrawOrderTimeline\r\n\t\t\t\t|| timeline instanceof EventTimeline || !to.animation.hasTimeline(id)) {\r\n\t\t\t\ttimelineMode[i] = AnimationState.FIRST;\r\n\t\t\t} else {\r\n\t\t\t\tfor (let next = to.mixingTo; next != null; next = next.mixingTo) {\r\n\t\t\t\t\tif (next.animation.hasTimeline(id)) continue;\r\n\t\t\t\t\tif (entry.mixDuration > 0) {\r\n\t\t\t\t\t\ttimelineMode[i] = AnimationState.HOLD_MIX;\r\n\t\t\t\t\t\ttimelineDipMix[i] = next;\r\n\t\t\t\t\t\tcontinue outer;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\ttimelineMode[i] = AnimationState.HOLD_FIRST;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/** Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing. */\r\n\tgetCurrent (trackIndex: number) {\r\n\t\tif (trackIndex >= this.tracks.length) return null;\r\n\t\treturn this.tracks[trackIndex];\r\n\t}\r\n\r\n\t/** Adds a listener to receive events for all track entries. */\r\n\taddListener (listener: AnimationStateListener) {\r\n\t\tif (listener == null) throw new Error(\"listener cannot be null.\");\r\n\t\tthis.listeners.push(listener);\r\n\t}\r\n\r\n\t/** Removes the listener added with {@link #addListener()}. */\r\n\tremoveListener (listener: AnimationStateListener) {\r\n\t\tlet index = this.listeners.indexOf(listener);\r\n\t\tif (index >= 0) this.listeners.splice(index, 1);\r\n\t}\r\n\r\n\t/** Removes all listeners added with {@link #addListener()}. */\r\n\tclearListeners () {\r\n\t\tthis.listeners.length = 0;\r\n\t}\r\n\r\n\t/** Discards all listener notifications that have not yet been delivered. This can be useful to call from an\r\n\t * {@link AnimationStateListener} when it is known that further notifications that may have been already queued for delivery\r\n\t * are not wanted because new animations are being set. */\r\n\tclearListenerNotifications () {\r\n\t\tthis.queue.clear();\r\n\t}\r\n}\r\n\r\n/** Stores settings and other state for the playback of an animation on an {@link AnimationState} track.\r\n *\r\n * References to a track entry must not be kept after the {@link AnimationStateListener#dispose()} event occurs. */\r\nexport class TrackEntry {\r\n\t/** The animation to apply for this track entry. */\r\n\tanimation: Animation;\r\n\r\n\t/** The animation queued to start after this animation, or null. `next` makes up a linked list. */\r\n\tnext: TrackEntry;\r\n\r\n\t/** The track entry for the previous animation when mixing from the previous animation to this animation, or null if no\r\n\t * mixing is currently occuring. When mixing from multiple animations, `mixingFrom` makes up a linked list. */\r\n\tmixingFrom: TrackEntry;\r\n\r\n\t/** The track entry for the next animation when mixing from this animation to the next animation, or null if no mixing is\r\n\t * currently occuring. When mixing to multiple animations, `mixingTo` makes up a linked list. */\r\n\tmixingTo: TrackEntry;\r\n\r\n\t/** The listener for events generated by this track entry, or null.\r\n\t *\r\n\t * A track entry returned from {@link AnimationState#setAnimation()} is already the current animation\r\n\t * for the track, so the track entry listener {@link AnimationStateListener#start()} will not be called. */\r\n\tlistener: AnimationStateListener;\r\n\r\n\t/** The index of the track where this track entry is either current or queued.\r\n\t *\r\n\t * See {@link AnimationState#getCurrent()}. */\r\n\ttrackIndex: number;\r\n\r\n\t/** If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its\r\n\t * duration. */\r\n\tloop: boolean;\r\n\r\n\t/** If true, when mixing from the previous animation to this animation, the previous animation is applied as normal instead\r\n\t * of being mixed out.\r\n\t *\r\n\t * When mixing between animations that key the same property, if a lower track also keys that property then the value will\r\n\t * briefly dip toward the lower track value during the mix. This happens because the first animation mixes from 100% to 0%\r\n\t * while the second animation mixes from 0% to 100%. Setting `holdPrevious` to true applies the first animation\r\n\t * at 100% during the mix so the lower track value is overwritten. Such dipping does not occur on the lowest track which\r\n\t * keys the property, only when a higher track also keys the property.\r\n\t *\r\n\t * Snapping will occur if `holdPrevious` is true and this animation does not key all the same properties as the\r\n\t * previous animation. */\r\n\tholdPrevious: boolean;\r\n\r\n\t/** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the\r\n\t * `eventThreshold`, event timelines are applied while this animation is being mixed out. Defaults to 0, so event\r\n\t * timelines are not applied while this animation is being mixed out. */\r\n\teventThreshold: number;\r\n\r\n\t/** When the mix percentage ({@link #mixtime} / {@link #mixDuration}) is less than the\r\n\t * `attachmentThreshold`, attachment timelines are applied while this animation is being mixed out. Defaults to\r\n\t * 0, so attachment timelines are not applied while this animation is being mixed out. */\r\n\tattachmentThreshold: number;\r\n\r\n\t/** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the\r\n\t * `drawOrderThreshold`, draw order timelines are applied while this animation is being mixed out. Defaults to 0,\r\n\t * so draw order timelines are not applied while this animation is being mixed out. */\r\n\tdrawOrderThreshold: number;\r\n\r\n\t/** Seconds when this animation starts, both initially and after looping. Defaults to 0.\r\n\t *\r\n\t * When changing the `animationStart` time, it often makes sense to set {@link #animationLast} to the same\r\n\t * value to prevent timeline keys before the start time from triggering. */\r\n\tanimationStart: number;\r\n\r\n\t/** Seconds for the last frame of this animation. Non-looping animations won't play past this time. Looping animations will\r\n\t * loop back to {@link #animationStart} at this time. Defaults to the animation {@link Animation#duration}. */\r\n\tanimationEnd: number;\r\n\r\n\r\n\t/** The time in seconds this animation was last applied. Some timelines use this for one-time triggers. Eg, when this\r\n\t * animation is applied, event timelines will fire all events between the `animationLast` time (exclusive) and\r\n\t * `animationTime` (inclusive). Defaults to -1 to ensure triggers on frame 0 happen the first time this animation\r\n\t * is applied. */\r\n\tanimationLast: number;\r\n\r\n\tnextAnimationLast: number;\r\n\r\n\t/** Seconds to postpone playing the animation. When this track entry is the current track entry, `delay`\r\n\t * postpones incrementing the {@link #trackTime}. When this track entry is queued, `delay` is the time from\r\n\t * the start of the previous animation to when this track entry will become the current track entry (ie when the previous\r\n\t * track entry {@link TrackEntry#trackTime} >= this track entry's `delay`).\r\n\t *\r\n\t * {@link #timeScale} affects the delay. */\r\n\tdelay: number;\r\n\r\n\t/** Current time in seconds this track entry has been the current track entry. The track time determines\r\n\t * {@link #animationTime}. The track time can be set to start the animation at a time other than 0, without affecting\r\n\t * looping. */\r\n\ttrackTime: number;\r\n\r\n\ttrackLast: number; nextTrackLast: number;\r\n\r\n\t/** The track time in seconds when this animation will be removed from the track. Defaults to the highest possible float\r\n\t * value, meaning the animation will be applied until a new animation is set or the track is cleared. If the track end time\r\n\t * is reached, no other animations are queued for playback, and mixing from any previous animations is complete, then the\r\n\t * properties keyed by the animation are set to the setup pose and the track is cleared.\r\n\t *\r\n\t * It may be desired to use {@link AnimationState#addEmptyAnimation()} rather than have the animation\r\n\t * abruptly cease being applied. */\r\n\ttrackEnd: number;\r\n\r\n\t/** Multiplier for the delta time when this track entry is updated, causing time for this animation to pass slower or\r\n\t * faster. Defaults to 1.\r\n\t *\r\n\t * {@link #mixTime} is not affected by track entry time scale, so {@link #mixDuration} may need to be adjusted to\r\n\t * match the animation speed.\r\n\t *\r\n\t * When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the\r\n\t * {@link #delay} is set using the mix duration from the {@link AnimationStateData}, assuming time scale to be 1. If\r\n\t * the time scale is not 1, the delay may need to be adjusted.\r\n\t *\r\n\t * See AnimationState {@link AnimationState#timeScale} for affecting all animations. */\r\n\ttimeScale: number;\r\n\r\n\t/** Values < 1 mix this animation with the skeleton's current pose (usually the pose resulting from lower tracks). Defaults\r\n\t * to 1, which overwrites the skeleton's current pose with this animation.\r\n\t *\r\n\t * Typically track 0 is used to completely pose the skeleton, then alpha is used on higher tracks. It doesn't make sense to\r\n\t * use alpha on track 0 if the skeleton pose is from the last frame render. */\r\n\talpha: number;\r\n\r\n\t/** Seconds from 0 to the {@link #getMixDuration()} when mixing from the previous animation to this animation. May be\r\n\t * slightly more than `mixDuration` when the mix is complete. */\r\n\tmixTime: number;\r\n\r\n\t/** Seconds for mixing from the previous animation to this animation. Defaults to the value provided by AnimationStateData\r\n\t * {@link AnimationStateData#getMix()} based on the animation before this animation (if any).\r\n\t *\r\n\t * A mix duration of 0 still mixes out over one frame to provide the track entry being mixed out a chance to revert the\r\n\t * properties it was animating.\r\n\t *\r\n\t * The `mixDuration` can be set manually rather than use the value from\r\n\t * {@link AnimationStateData#getMix()}. In that case, the `mixDuration` can be set for a new\r\n\t * track entry only before {@link AnimationState#update(float)} is first called.\r\n\t *\r\n\t * When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the\r\n\t * {@link #delay} is set using the mix duration from the {@link AnimationStateData}, not a mix duration set\r\n\t * afterward. */\r\n\tmixDuration: number; interruptAlpha: number; totalAlpha: number;\r\n\r\n\t/** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to {@link MixBlend#replace}, which\r\n\t * replaces the values from the lower tracks with the animation values. {@link MixBlend#add} adds the animation values to\r\n\t * the values from the lower tracks.\r\n\t *\r\n\t * The `mixBlend` can be set for a new track entry only before {@link AnimationState#apply()} is first\r\n\t * called. */\r\n\tmixBlend = MixBlend.replace;\r\n\ttimelineMode = new Array<number>();\r\n\ttimelineHoldMix = new Array<TrackEntry>();\r\n\ttimelinesRotation = new Array<number>();\r\n\r\n\treset () {\r\n\t\tthis.next = null;\r\n\t\tthis.mixingFrom = null;\r\n\t\tthis.mixingTo = null;\r\n\t\tthis.animation = null;\r\n\t\tthis.listener = null;\r\n\t\tthis.timelineMode.length = 0;\r\n\t\tthis.timelineHoldMix.length = 0;\r\n\t\tthis.timelinesRotation.length = 0;\r\n\t}\r\n\r\n\t/** Uses {@link #trackTime} to compute the `animationTime`, which is between {@link #animationStart}\r\n\t * and {@link #animationEnd}. When the `trackTime` is 0, the `animationTime` is equal to the\r\n\t * `animationStart` time. */\r\n\tgetAnimationTime () {\r\n\t\tif (this.loop) {\r\n\t\t\tlet duration = this.animationEnd - this.animationStart;\r\n\t\t\tif (duration == 0) return this.animationStart;\r\n\t\t\treturn (this.trackTime % duration) + this.animationStart;\r\n\t\t}\r\n\t\treturn Math.min(this.trackTime + this.animationStart, this.animationEnd);\r\n\t}\r\n\r\n\tsetAnimationLast(animationLast: number) {\r\n\t\tthis.animationLast = animationLast;\r\n\t\tthis.nextAnimationLast = animationLast;\r\n\t}\r\n\r\n\t/** Returns true if at least one loop has been completed.\r\n\t *\r\n\t * See {@link AnimationStateListener#complete()}. */\r\n\tisComplete () {\r\n\t\treturn this.trackTime >= this.animationEnd - this.animationStart;\r\n\t}\r\n\r\n\t/** Resets the rotation directions for mixing this entry's rotate timelines. This can be useful to avoid bones rotating the\r\n\t * long way around when using {@link #alpha} and starting animations on other tracks.\r\n\t *\r\n\t * Mixing with {@link MixBlend#replace} involves finding a rotation between two others, which has two possible solutions:\r\n\t * the short way or the long way around. The two rotations likely change over time, so which direction is the short or long\r\n\t * way also changes. If the short way was always chosen, bones would flip to the other side when that direction became the\r\n\t * long way. TrackEntry chooses the short way the first time it is applied and remembers that direction. */\r\n\tresetRotationDirections () {\r\n\t\tthis.timelinesRotation.length = 0;\r\n\t}\r\n}\r\n\r\nexport class EventQueue {\r\n\tobjects: Array<any> = [];\r\n\tdrainDisabled = false;\r\n\tanimState: AnimationState;\r\n\r\n\tconstructor(animState: AnimationState) {\r\n\t\tthis.animState = animState;\r\n\t}\r\n\r\n\tstart (entry: TrackEntry) {\r\n\t\tthis.objects.push(EventType.start);\r\n\t\tthis.objects.push(entry);\r\n\t\tthis.animState.animationsChanged = true;\r\n\t}\r\n\r\n\tinterrupt (entry: TrackEntry) {\r\n\t\tthis.objects.push(EventType.interrupt);\r\n\t\tthis.objects.push(entry);\r\n\t}\r\n\r\n\tend (entry: TrackEntry) {\r\n\t\tthis.objects.push(EventType.end);\r\n\t\tthis.objects.push(entry);\r\n\t\tthis.animState.animationsChanged = true;\r\n\t}\r\n\r\n\tdispose (entry: TrackEntry) {\r\n\t\tthis.objects.push(EventType.dispose);\r\n\t\tthis.objects.push(entry);\r\n\t}\r\n\r\n\tcomplete (entry: TrackEntry) {\r\n\t\tthis.objects.push(EventType.complete);\r\n\t\tthis.objects.push(entry);\r\n\t}\r\n\r\n\tevent (entry: TrackEntry, event: Event) {\r\n\t\tthis.objects.push(EventType.event);\r\n\t\tthis.objects.push(entry);\r\n\t\tthis.objects.push(event);\r\n\t}\r\n\r\n\tdrain () {\r\n\t\tif (this.drainDisabled) return;\r\n\t\tthis.drainDisabled = true;\r\n\r\n\t\tlet objects = this.objects;\r\n\t\tlet listeners = this.animState.listeners;\r\n\r\n\t\tfor (let i = 0; i < objects.length; i += 2) {\r\n\t\t\tlet type = objects[i] as EventType;\r\n\t\t\tlet entry = objects[i + 1] as TrackEntry;\r\n\t\t\tswitch (type) {\r\n\t\t\tcase EventType.start:\r\n\t\t\t\tif (entry.listener != null && entry.listener.start) entry.listener.start(entry);\r\n\t\t\t\tfor (let ii = 0; ii < listeners.length; ii++)\r\n\t\t\t\t\tif (listeners[ii].start) listeners[ii].start(entry);\r\n\t\t\t\tbreak;\r\n\t\t\tcase EventType.interrupt:\r\n\t\t\t\tif (entry.listener != null && entry.listener.interrupt) entry.listener.interrupt(entry);\r\n\t\t\t\tfor (let ii = 0; ii < listeners.length; ii++)\r\n\t\t\t\t\tif (listeners[ii].interrupt) listeners[ii].interrupt(entry);\r\n\t\t\t\tbreak;\r\n\t\t\tcase EventType.end:\r\n\t\t\t\tif (entry.listener != null && entry.listener.end) entry.listener.end(entry);\r\n\t\t\t\tfor (let ii = 0; ii < listeners.length; ii++)\r\n\t\t\t\t\tif (listeners[ii].end) listeners[ii].end(entry);\r\n\t\t\t\t// Fall through.\r\n\t\t\tcase EventType.dispose:\r\n\t\t\t\tif (entry.listener != null && entry.listener.dispose) entry.listener.dispose(entry);\r\n\t\t\t\tfor (let ii = 0; ii < listeners.length; ii++)\r\n\t\t\t\t\tif (listeners[ii].dispose) listeners[ii].dispose(entry);\r\n\t\t\t\tthis.animState.trackEntryPool.free(entry);\r\n\t\t\t\tbreak;\r\n\t\t\tcase EventType.complete:\r\n\t\t\t\tif (entry.listener != null && entry.listener.complete) entry.listener.complete(entry);\r\n\t\t\t\tfor (let ii = 0; ii < listeners.length; ii++)\r\n\t\t\t\t\tif (listeners[ii].complete) listeners[ii].complete(entry);\r\n\t\t\t\tbreak;\r\n\t\t\tcase EventType.event:\r\n\t\t\t\tlet event = objects[i++ + 2] as Event;\r\n\t\t\t\tif (entry.listener != null && entry.listener.event) entry.listener.event(entry, event);\r\n\t\t\t\tfor (let ii = 0; ii < listeners.length; ii++)\r\n\t\t\t\t\tif (listeners[ii].event) listeners[ii].event(entry, event);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.clear();\r\n\r\n\t\tthis.drainDisabled = false;\r\n\t}\r\n\r\n\tclear () {\r\n\t\tthis.objects.length = 0;\r\n\t}\r\n}\r\n\r\nexport enum EventType {\r\n\tstart, interrupt, end, dispose, complete, event\r\n}\r\n\r\n/** The interface to implement for receiving TrackEntry events. It is always safe to call AnimationState methods when receiving\r\n * events.\r\n *\r\n * See TrackEntry {@link TrackEntry#listener} and AnimationState\r\n * {@link AnimationState#addListener()}. */\r\nexport interface AnimationStateListener {\r\n\t/** Invoked when this entry has been set as the current entry. */\r\n\tstart (entry: TrackEntry): void;\r\n\r\n\t/** Invoked when another entry has replaced this entry as the current entry. This entry may continue being applied for\r\n\t * mixing. */\r\n\tinterrupt (entry: TrackEntry): void;\r\n\r\n\t/** Invoked when this entry is no longer the current entry and will never be applied again. */\r\n\tend (entry: TrackEntry): void;\r\n\r\n\t/** Invoked when this entry will be disposed. This may occur without the entry ever being set as the current entry.\r\n\t * References to the entry should not be kept after dispose is called, as it may be destroyed or reused. */\r\n\tdispose (entry: TrackEntry): void;\r\n\r\n\t/** Invoked every time this entry's animation completes a loop. */\r\n\tcomplete (entry: TrackEntry): void;\r\n\r\n\t/** Invoked when this entry's animation triggers an event. */\r\n\tevent (entry: TrackEntry, event: Event): void;\r\n}\r\n\r\nexport abstract class AnimationStateAdapter implements AnimationStateListener {\r\n\tstart (entry: TrackEntry) {\r\n\t}\r\n\r\n\tinterrupt (entry: TrackEntry) {\r\n\t}\r\n\r\n\tend (entry: TrackEntry) {\r\n\t}\r\n\r\n\tdispose (entry: TrackEntry) {\r\n\t}\r\n\r\n\tcomplete (entry: TrackEntry) {\r\n\t}\r\n\r\n\tevent (entry: TrackEntry, event: Event) {\r\n\t}\r\n}\r\n","\r\n\r\nimport { SkeletonData } from \"./SkeletonData\";\r\nimport { Animation } from \"./Animation\";\r\nimport { Map } from \"./Utils\"\r\n\r\n\r\n/** Stores mix (crossfade) durations to be applied when {@link AnimationState} animations are changed. */\r\nexport class AnimationStateData {\r\n\t/** The SkeletonData to look up animations when they are specified by name. */\r\n\tskeletonData: SkeletonData;\r\n\r\n\tanimationToMixTime: Map<number> = {};\r\n\r\n\t/** The mix duration to use when no mix duration has been defined between two animations. */\r\n\tdefaultMix = 0;\r\n\r\n\tconstructor (skeletonData: SkeletonData) {\r\n\t\tif (skeletonData == null) throw new Error(\"skeletonData cannot be null.\");\r\n\t\tthis.skeletonData = skeletonData;\r\n\t}\r\n\r\n\t/** Sets a mix duration by animation name.\r\n\t *\r\n\t * See {@link #setMixWith()}. */\r\n\tsetMix (fromName: string, toName: string, duration: number) {\r\n\t\tlet from = this.skeletonData.findAnimation(fromName);\r\n\t\tif (from == null) throw new Error(\"Animation not found: \" + fromName);\r\n\t\tlet to = this.skeletonData.findAnimation(toName);\r\n\t\tif (to == null) throw new Error(\"Animation not found: \" + toName);\r\n\t\tthis.setMixWith(from, to, duration);\r\n\t}\r\n\r\n\t/** Sets the mix duration when changing from the specified animation to the other.\r\n\t *\r\n\t * See {@link TrackEntry#mixDuration}. */\r\n\tsetMixWith (from: Animation, to: Animation, duration: number) {\r\n\t\tif (from == null) throw new Error(\"from cannot be null.\");\r\n\t\tif (to == null) throw new Error(\"to cannot be null.\");\r\n\t\tlet key = from.name + \".\" + to.name;\r\n\t\tthis.animationToMixTime[key] = duration;\r\n\t}\r\n\r\n\t/** Returns the mix duration to use when changing from the specified animation to the other, or the {@link #defaultMix} if\r\n\t* no mix duration has been set. */\r\n\tgetMix (from: Animation, to: Animation) {\r\n\t\tlet key = from.name + \".\" + to.name;\r\n\t\tlet value = this.animationToMixTime[key];\r\n\t\treturn value === undefined ? this.defaultMix : value;\r\n\t}\r\n}\r\n","\n\nimport { VertexAttachment, Attachment } from \"./Attachment\";\nimport { SlotData } from \"../SlotData\";\nimport { Color } from \"../Utils\";\n\n\n/** An attachment with vertices that make up a polygon used for clipping the rendering of other attachments. */\nexport class ClippingAttachment extends VertexAttachment {\n\t/** Clipping is performed between the clipping polygon's slot and the end slot. Returns null if clipping is done until the end of\n\t * the skeleton's rendering. */\n\tendSlot: SlotData;\n\n\t// Nonessential.\n\t/** The color of the clipping polygon as it was in Spine. Available only when nonessential data was exported. Clipping polygons\n\t * are not usually rendered at runtime. */\n\tcolor = new Color(0.2275, 0.2275, 0.8078, 1); // ce3a3aff\n\n\tconstructor (name: string) {\n\t\tsuper(name);\n\t}\n\n\tcopy (): Attachment {\n\t\tlet copy = new ClippingAttachment(this.name);\n\t\tthis.copyTo(copy);\n\t\tcopy.endSlot = this.endSlot;\n\t\tcopy.color.setFromColor(this.color);\n\t\treturn copy;\n\t}\n}\n","\n\nimport { Pool } from \"./Utils\";\n\n\nexport class Triangulator {\n\tprivate convexPolygons = new Array<Array<number>>();\n\tprivate convexPolygonsIndices = new Array<Array<number>>();\n\n\tprivate indicesArray = new Array<number>();\n\tprivate isConcaveArray = new Array<boolean>();\n\tprivate triangles = new Array<number>();\n\n\tprivate polygonPool = new Pool<Array<number>>(() => {\n\t\treturn new Array<number>();\n\t});\n\n\tprivate polygonIndicesPool = new Pool<Array<number>>(() => {\n\t\treturn new Array<number>();\n\t});\n\n\tpublic triangulate (verticesArray: ArrayLike<number>): Array<number> {\n\t\tlet vertices = verticesArray;\n\t\tlet vertexCount = verticesArray.length >> 1;\n\n\t\tlet indices = this.indicesArray;\n\t\tindices.length = 0;\n\t\tfor (let i = 0; i < vertexCount; i++)\n\t\t\tindices[i] = i;\n\n\t\tlet isConcave = this.isConcaveArray;\n\t\tisConcave.length = 0;\n\t\tfor (let i = 0, n = vertexCount; i < n; ++i)\n\t\t\tisConcave[i] = Triangulator.isConcave(i, vertexCount, vertices, indices);\n\n\t\tlet triangles = this.triangles;\n\t\ttriangles.length = 0;\n\n\t\twhile (vertexCount > 3) {\n\t\t\t// Find ear tip.\n\t\t\tlet previous = vertexCount - 1, i = 0, next = 1;\n\t\t\twhile (true) {\n\t\t\t\touter:\n\t\t\t\tif (!isConcave[i]) {\n\t\t\t\t\tlet p1 = indices[previous] << 1, p2 = indices[i] << 1, p3 = indices[next] << 1;\n\t\t\t\t\tlet p1x = vertices[p1], p1y = vertices[p1 + 1];\n\t\t\t\t\tlet p2x = vertices[p2], p2y = vertices[p2 + 1];\n\t\t\t\t\tlet p3x = vertices[p3], p3y = vertices[p3 + 1];\n\t\t\t\t\tfor (let ii = (next + 1) % vertexCount; ii != previous; ii = (ii + 1) % vertexCount) {\n\t\t\t\t\t\tif (!isConcave[ii]) continue;\n\t\t\t\t\t\tlet v = indices[ii] << 1;\n\t\t\t\t\t\tlet vx = vertices[v], vy = vertices[v + 1];\n\t\t\t\t\t\tif (Triangulator.positiveArea(p3x, p3y, p1x, p1y, vx, vy)) {\n\t\t\t\t\t\t\tif (Triangulator.positiveArea(p1x, p1y, p2x, p2y, vx, vy)) {\n\t\t\t\t\t\t\t\tif (Triangulator.positiveArea(p2x, p2y, p3x, p3y, vx, vy)) break outer;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (next == 0) {\n\t\t\t\t\tdo {\n\t\t\t\t\t\tif (!isConcave[i]) break;\n\t\t\t\t\t\ti--;\n\t\t\t\t\t} while (i > 0);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tprevious = i;\n\t\t\t\ti = next;\n\t\t\t\tnext = (next + 1) % vertexCount;\n\t\t\t}\n\n\t\t\t// Cut ear tip.\n\t\t\ttriangles.push(indices[(vertexCount + i - 1) % vertexCount]);\n\t\t\ttriangles.push(indices[i]);\n\t\t\ttriangles.push(indices[(i + 1) % vertexCount]);\n\t\t\tindices.splice(i, 1);\n\t\t\tisConcave.splice(i, 1);\n\t\t\tvertexCount--;\n\n\t\t\tlet previousIndex = (vertexCount + i - 1) % vertexCount;\n\t\t\tlet nextIndex = i == vertexCount ? 0 : i;\n\t\t\tisConcave[previousIndex] = Triangulator.isConcave(previousIndex, vertexCount, vertices, indices);\n\t\t\tisConcave[nextIndex] = Triangulator.isConcave(nextIndex, vertexCount, vertices, indices);\n\t\t}\n\n\t\tif (vertexCount == 3) {\n\t\t\ttriangles.push(indices[2]);\n\t\t\ttriangles.push(indices[0]);\n\t\t\ttriangles.push(indices[1]);\n\t\t}\n\n\t\treturn triangles;\n\t}\n\n\tdecompose (verticesArray: Array<number>, triangles: Array<number>) : Array<Array<number>> {\n\t\tlet vertices = verticesArray;\n\t\tlet convexPolygons = this.convexPolygons;\n\t\tthis.polygonPool.freeAll(convexPolygons);\n\t\tconvexPolygons.length = 0;\n\n\t\tlet convexPolygonsIndices = this.convexPolygonsIndices;\n\t\tthis.polygonIndicesPool.freeAll(convexPolygonsIndices);\n\t\tconvexPolygonsIndices.length = 0;\n\n\t\tlet polygonIndices = this.polygonIndicesPool.obtain();\n\t\tpolygonIndices.length = 0;\n\n\t\tlet polygon = this.polygonPool.obtain();\n\t\tpolygon.length = 0;\n\n\t\t// Merge subsequent triangles if they form a triangle fan.\n\t\tlet fanBaseIndex = -1, lastWinding = 0;\n\t\tfor (let i = 0, n = triangles.length; i < n; i += 3) {\n\t\t\tlet t1 = triangles[i] << 1, t2 = triangles[i + 1] << 1, t3 = triangles[i + 2] << 1;\n\t\t\tlet x1 = vertices[t1], y1 = vertices[t1 + 1];\n\t\t\tlet x2 = vertices[t2], y2 = vertices[t2 + 1];\n\t\t\tlet x3 = vertices[t3], y3 = vertices[t3 + 1];\n\n\t\t\t// If the base of the last triangle is the same as this triangle, check if they form a convex polygon (triangle fan).\n\t\t\tlet merged = false;\n\t\t\tif (fanBaseIndex == t1) {\n\t\t\t\tlet o = polygon.length - 4;\n\t\t\t\tlet winding1 = Triangulator.winding(polygon[o], polygon[o + 1], polygon[o + 2], polygon[o + 3], x3, y3);\n\t\t\t\tlet winding2 = Triangulator.winding(x3, y3, polygon[0], polygon[1], polygon[2], polygon[3]);\n\t\t\t\tif (winding1 == lastWinding && winding2 == lastWinding) {\n\t\t\t\t\tpolygon.push(x3);\n\t\t\t\t\tpolygon.push(y3);\n\t\t\t\t\tpolygonIndices.push(t3);\n\t\t\t\t\tmerged = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Otherwise make this triangle the new base.\n\t\t\tif (!merged) {\n\t\t\t\tif (polygon.length > 0) {\n\t\t\t\t\tconvexPolygons.push(polygon);\n\t\t\t\t\tconvexPolygonsIndices.push(polygonIndices);\n\t\t\t\t} else {\n\t\t\t\t\tthis.polygonPool.free(polygon)\n\t\t\t\t\tthis.polygonIndicesPool.free(polygonIndices);\n\t\t\t\t}\n\t\t\t\tpolygon = this.polygonPool.obtain();\n\t\t\t\tpolygon.length = 0;\n\t\t\t\tpolygon.push(x1);\n\t\t\t\tpolygon.push(y1);\n\t\t\t\tpolygon.push(x2);\n\t\t\t\tpolygon.push(y2);\n\t\t\t\tpolygon.push(x3);\n\t\t\t\tpolygon.push(y3);\n\t\t\t\tpolygonIndices = this.polygonIndicesPool.obtain();\n\t\t\t\tpolygonIndices.length = 0;\n\t\t\t\tpolygonIndices.push(t1);\n\t\t\t\tpolygonIndices.push(t2);\n\t\t\t\tpolygonIndices.push(t3);\n\t\t\t\tlastWinding = Triangulator.winding(x1, y1, x2, y2, x3, y3);\n\t\t\t\tfanBaseIndex = t1;\n\t\t\t}\n\t\t}\n\n\t\tif (polygon.length > 0) {\n\t\t\tconvexPolygons.push(polygon);\n\t\t\tconvexPolygonsIndices.push(polygonIndices);\n\t\t}\n\n\t\t// Go through the list of polygons and try to merge the remaining triangles with the found triangle fans.\n\t\tfor (let i = 0, n = convexPolygons.length; i < n; i++) {\n\t\t\tpolygonIndices = convexPolygonsIndices[i];\n\t\t\tif (polygonIndices.length == 0) continue;\n\t\t\tlet firstIndex = polygonIndices[0];\n\t\t\tlet lastIndex = polygonIndices[polygonIndices.length - 1];\n\n\t\t\tpolygon = convexPolygons[i];\n\t\t\tlet o = polygon.length - 4;\n\t\t\tlet prevPrevX = polygon[o], prevPrevY = polygon[o + 1];\n\t\t\tlet prevX = polygon[o + 2], prevY = polygon[o + 3];\n\t\t\tlet firstX = polygon[0], firstY = polygon[1];\n\t\t\tlet secondX = polygon[2], secondY = polygon[3];\n\t\t\tlet winding = Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, firstX, firstY);\n\n\t\t\tfor (let ii = 0; ii < n; ii++) {\n\t\t\t\tif (ii == i) continue;\n\t\t\t\tlet otherIndices = convexPolygonsIndices[ii];\n\t\t\t\tif (otherIndices.length != 3) continue;\n\t\t\t\tlet otherFirstIndex = otherIndices[0];\n\t\t\t\tlet otherSecondIndex = otherIndices[1];\n\t\t\t\tlet otherLastIndex = otherIndices[2];\n\n\t\t\t\tlet otherPoly = convexPolygons[ii];\n\t\t\t\tlet x3 = otherPoly[otherPoly.length - 2], y3 = otherPoly[otherPoly.length - 1];\n\n\t\t\t\tif (otherFirstIndex != firstIndex || otherSecondIndex != lastIndex) continue;\n\t\t\t\tlet winding1 = Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, x3, y3);\n\t\t\t\tlet winding2 = Triangulator.winding(x3, y3, firstX, firstY, secondX, secondY);\n\t\t\t\tif (winding1 == winding && winding2 == winding) {\n\t\t\t\t\totherPoly.length = 0;\n\t\t\t\t\totherIndices.length = 0;\n\t\t\t\t\tpolygon.push(x3);\n\t\t\t\t\tpolygon.push(y3);\n\t\t\t\t\tpolygonIndices.push(otherLastIndex);\n\t\t\t\t\tprevPrevX = prevX;\n\t\t\t\t\tprevPrevY = prevY;\n\t\t\t\t\tprevX = x3;\n\t\t\t\t\tprevY = y3;\n\t\t\t\t\tii = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Remove empty polygons that resulted from the merge step above.\n\t\tfor (let i = convexPolygons.length - 1; i >= 0; i--) {\n\t\t\tpolygon = convexPolygons[i];\n\t\t\tif (polygon.length == 0) {\n\t\t\t\tconvexPolygons.splice(i, 1);\n\t\t\t\tthis.polygonPool.free(polygon);\n\t\t\t\tpolygonIndices = convexPolygonsIndices[i]\n\t\t\t\tconvexPolygonsIndices.splice(i, 1)\n\t\t\t\tthis.polygonIndicesPool.free(polygonIndices);\n\t\t\t}\n\t\t}\n\n\t\treturn convexPolygons;\n\t}\n\n\tprivate static isConcave (index: number, vertexCount: number, vertices: ArrayLike<number>, indices: ArrayLike<number>): boolean {\n\t\tlet previous = indices[(vertexCount + index - 1) % vertexCount] << 1;\n\t\tlet current = indices[index] << 1;\n\t\tlet next = indices[(index + 1) % vertexCount] << 1;\n\t\treturn !this.positiveArea(vertices[previous], vertices[previous + 1], vertices[current], vertices[current + 1], vertices[next],\n\t\t\tvertices[next + 1]);\n\t}\n\n\tprivate static positiveArea (p1x: number, p1y: number, p2x: number, p2y: number, p3x: number, p3y: number): boolean {\n\t\treturn p1x * (p3y - p2y) + p2x * (p1y - p3y) + p3x * (p2y - p1y) >= 0;\n\t}\n\n\tprivate static winding (p1x: number, p1y: number, p2x: number, p2y: number, p3x: number, p3y: number): number {\n\t\tlet px = p2x - p1x, py = p2y - p1y;\n\t\treturn p3x * py - p3y * px + px * p1y - p1x * py >= 0 ? 1 : -1;\n\t}\n}\n","import { Triangulator } from \"./Triangulator\";\nimport { ClippingAttachment } from \"./attachments/ClippingAttachment\";\nimport { Slot } from \"./Slot\";\nimport { Utils, Color, ArrayLike } from \"./Utils\";\n\n\nexport class SkeletonClipping {\n\tprivate triangulator = new Triangulator();\n\tprivate clippingPolygon = new Array<number>();\n\tprivate clipOutput = new Array<number>();\n\tclippedVertices = new Array<number>();\n\tclippedTriangles = new Array<number>();\n\tprivate scratch = new Array<number>();\n\n\tprivate clipAttachment: ClippingAttachment;\n\tprivate clippingPolygons: Array<Array<number>>;\n\n\tclipStart (slot: Slot, clip: ClippingAttachment): number {\n\t\tif (this.clipAttachment != null) return 0;\n\t\tthis.clipAttachment = clip;\n\n\t\tlet n = clip.worldVerticesLength;\n\t\tlet vertices = Utils.setArraySize(this.clippingPolygon, n);\n\t\tclip.computeWorldVertices(slot, 0, n, vertices, 0, 2);\n\t\tlet clippingPolygon = this.clippingPolygon;\n\t\tSkeletonClipping.makeClockwise(clippingPolygon);\n\t\tlet clippingPolygons = this.clippingPolygons = this.triangulator.decompose(clippingPolygon, this.triangulator.triangulate(clippingPolygon));\n\t\tfor (let i = 0, n = clippingPolygons.length; i < n; i++) {\n\t\t\tlet polygon = clippingPolygons[i];\n\t\t\tSkeletonClipping.makeClockwise(polygon);\n\t\t\tpolygon.push(polygon[0]);\n\t\t\tpolygon.push(polygon[1]);\n\t\t}\n\n\t\treturn clippingPolygons.length;\n\t}\n\n\tclipEndWithSlot (slot: Slot) {\n\t\tif (this.clipAttachment != null && this.clipAttachment.endSlot == slot.data) this.clipEnd();\n\t}\n\n\tclipEnd () {\n\t\tif (this.clipAttachment == null) return;\n\t\tthis.clipAttachment = null;\n\t\tthis.clippingPolygons = null;\n\t\tthis.clippedVertices.length = 0;\n\t\tthis.clippedTriangles.length = 0;\n\t\tthis.clippingPolygon.length = 0;\n\t}\n\n\tisClipping (): boolean {\n\t\treturn this.clipAttachment != null;\n\t}\n\n\tclipTriangles (vertices: ArrayLike<number>, verticesLength: number, triangles: ArrayLike<number>, trianglesLength: number, uvs: ArrayLike<number>,\n\t\tlight: Color, dark: Color, twoColor: boolean) {\n\n\t\tlet clipOutput = this.clipOutput, clippedVertices = this.clippedVertices;\n\t\tlet clippedTriangles = this.clippedTriangles;\n\t\tlet polygons = this.clippingPolygons;\n\t\tlet polygonsCount = this.clippingPolygons.length;\n\t\tlet vertexSize = twoColor ? 12 : 8;\n\n\t\tlet index = 0;\n\t\tclippedVertices.length = 0;\n\t\tclippedTriangles.length = 0;\n\t\touter:\n\t\tfor (let i = 0; i < trianglesLength; i += 3) {\n\t\t\tlet vertexOffset = triangles[i] << 1;\n\t\t\tlet x1 = vertices[vertexOffset], y1 = vertices[vertexOffset + 1];\n\t\t\tlet u1 = uvs[vertexOffset], v1 = uvs[vertexOffset + 1];\n\n\t\t\tvertexOffset = triangles[i + 1] << 1;\n\t\t\tlet x2 = vertices[vertexOffset], y2 = vertices[vertexOffset + 1];\n\t\t\tlet u2 = uvs[vertexOffset], v2 = uvs[vertexOffset + 1];\n\n\t\t\tvertexOffset = triangles[i + 2] << 1;\n\t\t\tlet x3 = vertices[vertexOffset], y3 = vertices[vertexOffset + 1];\n\t\t\tlet u3 = uvs[vertexOffset], v3 = uvs[vertexOffset + 1];\n\n\t\t\tfor (let p = 0; p < polygonsCount; p++) {\n\t\t\t\tlet s = clippedVertices.length;\n\t\t\t\tif (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {\n\t\t\t\t\tlet clipOutputLength = clipOutput.length;\n\t\t\t\t\tif (clipOutputLength == 0) continue;\n\t\t\t\t\tlet d0 = y2 - y3, d1 = x3 - x2, d2 = x1 - x3, d4 = y3 - y1;\n\t\t\t\t\tlet d = 1 / (d0 * d2 + d1 * (y1 - y3));\n\n\t\t\t\t\tlet clipOutputCount = clipOutputLength >> 1;\n\t\t\t\t\tlet clipOutputItems = this.clipOutput;\n\t\t\t\t\tlet clippedVerticesItems = Utils.setArraySize(clippedVertices, s + clipOutputCount * vertexSize);\n\t\t\t\t\tfor (let ii = 0; ii < clipOutputLength; ii += 2) {\n\t\t\t\t\t\tlet x = clipOutputItems[ii], y = clipOutputItems[ii + 1];\n\t\t\t\t\t\tclippedVerticesItems[s] = x;\n\t\t\t\t\t\tclippedVerticesItems[s + 1] = y;\n\t\t\t\t\t\tclippedVerticesItems[s + 2] = light.r;\n\t\t\t\t\t\tclippedVerticesItems[s + 3] = light.g;\n\t\t\t\t\t\tclippedVerticesItems[s + 4] = light.b;\n\t\t\t\t\t\tclippedVerticesItems[s + 5] = light.a;\n\t\t\t\t\t\tlet c0 = x - x3, c1 = y - y3;\n\t\t\t\t\t\tlet a = (d0 * c0 + d1 * c1) * d;\n\t\t\t\t\t\tlet b = (d4 * c0 + d2 * c1) * d;\n\t\t\t\t\t\tlet c = 1 - a - b;\n\t\t\t\t\t\tclippedVerticesItems[s + 6] = u1 * a + u2 * b + u3 * c;\n\t\t\t\t\t\tclippedVerticesItems[s + 7] = v1 * a + v2 * b + v3 * c;\n\t\t\t\t\t\tif (twoColor) {\n\t\t\t\t\t\t\tclippedVerticesItems[s + 8] = dark.r;\n\t\t\t\t\t\t\tclippedVerticesItems[s + 9] = dark.g;\n\t\t\t\t\t\t\tclippedVerticesItems[s + 10] = dark.b;\n\t\t\t\t\t\t\tclippedVerticesItems[s + 11] = dark.a;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ts += vertexSize;\n\t\t\t\t\t}\n\n\t\t\t\t\ts = clippedTriangles.length;\n\t\t\t\t\tlet clippedTrianglesItems = Utils.setArraySize(clippedTriangles, s + 3 * (clipOutputCount - 2));\n\t\t\t\t\tclipOutputCount--;\n\t\t\t\t\tfor (let ii = 1; ii < clipOutputCount; ii++) {\n\t\t\t\t\t\tclippedTrianglesItems[s] = index;\n\t\t\t\t\t\tclippedTrianglesItems[s + 1] = (index + ii);\n\t\t\t\t\t\tclippedTrianglesItems[s + 2] = (index + ii + 1);\n\t\t\t\t\t\ts += 3;\n\t\t\t\t\t}\n\t\t\t\t\tindex += clipOutputCount + 1;\n\n\t\t\t\t} else {\n\t\t\t\t\tlet clippedVerticesItems = Utils.setArraySize(clippedVertices, s + 3 * vertexSize);\n\t\t\t\t\tclippedVerticesItems[s] = x1;\n\t\t\t\t\tclippedVerticesItems[s + 1] = y1;\n\t\t\t\t\tclippedVerticesItems[s + 2] = light.r;\n\t\t\t\t\tclippedVerticesItems[s + 3] = light.g;\n\t\t\t\t\tclippedVerticesItems[s + 4] = light.b;\n\t\t\t\t\tclippedVerticesItems[s + 5] = light.a;\n\t\t\t\t\tif (!twoColor) {\n\t\t\t\t\t\tclippedVerticesItems[s + 6] = u1;\n\t\t\t\t\t\tclippedVerticesItems[s + 7] = v1;\n\n\t\t\t\t\t\tclippedVerticesItems[s + 8] = x2;\n\t\t\t\t\t\tclippedVerticesItems[s + 9] = y2;\n\t\t\t\t\t\tclippedVerticesItems[s + 10] = light.r;\n\t\t\t\t\t\tclippedVerticesItems[s + 11] = light.g;\n\t\t\t\t\t\tclippedVerticesItems[s + 12] = light.b;\n\t\t\t\t\t\tclippedVerticesItems[s + 13] = light.a;\n\t\t\t\t\t\tclippedVerticesItems[s + 14] = u2;\n\t\t\t\t\t\tclippedVerticesItems[s + 15] = v2;\n\n\t\t\t\t\t\tclippedVerticesItems[s + 16] = x3;\n\t\t\t\t\t\tclippedVerticesItems[s + 17] = y3;\n\t\t\t\t\t\tclippedVerticesItems[s + 18] = light.r;\n\t\t\t\t\t\tclippedVerticesItems[s + 19] = light.g;\n\t\t\t\t\t\tclippedVerticesItems[s + 20] = light.b;\n\t\t\t\t\t\tclippedVerticesItems[s + 21] = light.a;\n\t\t\t\t\t\tclippedVerticesItems[s + 22] = u3;\n\t\t\t\t\t\tclippedVerticesItems[s + 23] = v3;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tclippedVerticesItems[s + 6] = u1;\n\t\t\t\t\t\tclippedVerticesItems[s + 7] = v1;\n\t\t\t\t\t\tclippedVerticesItems[s + 8] = dark.r;\n\t\t\t\t\t\tclippedVerticesItems[s + 9] = dark.g;\n\t\t\t\t\t\tclippedVerticesItems[s + 10] = dark.b;\n\t\t\t\t\t\tclippedVerticesItems[s + 11] = dark.a;\n\n\t\t\t\t\t\tclippedVerticesItems[s + 12] = x2;\n\t\t\t\t\t\tclippedVerticesItems[s + 13] = y2;\n\t\t\t\t\t\tclippedVerticesItems[s + 14] = light.r;\n\t\t\t\t\t\tclippedVerticesItems[s + 15] = light.g;\n\t\t\t\t\t\tclippedVerticesItems[s + 16] = light.b;\n\t\t\t\t\t\tclippedVerticesItems[s + 17] = light.a;\n\t\t\t\t\t\tclippedVerticesItems[s + 18] = u2;\n\t\t\t\t\t\tclippedVerticesItems[s + 19] = v2;\n\t\t\t\t\t\tclippedVerticesItems[s + 20] = dark.r;\n\t\t\t\t\t\tclippedVerticesItems[s + 21] = dark.g;\n\t\t\t\t\t\tclippedVerticesItems[s + 22] = dark.b;\n\t\t\t\t\t\tclippedVerticesItems[s + 23] = dark.a;\n\n\t\t\t\t\t\tclippedVerticesItems[s + 24] = x3;\n\t\t\t\t\t\tclippedVerticesItems[s + 25] = y3;\n\t\t\t\t\t\tclippedVerticesItems[s + 26] = light.r;\n\t\t\t\t\t\tclippedVerticesItems[s + 27] = light.g;\n\t\t\t\t\t\tclippedVerticesItems[s + 28] = light.b;\n\t\t\t\t\t\tclippedVerticesItems[s + 29] = light.a;\n\t\t\t\t\t\tclippedVerticesItems[s + 30] = u3;\n\t\t\t\t\t\tclippedVerticesItems[s + 31] = v3;\n\t\t\t\t\t\tclippedVerticesItems[s + 32] = dark.r;\n\t\t\t\t\t\tclippedVerticesItems[s + 33] = dark.g;\n\t\t\t\t\t\tclippedVerticesItems[s + 34] = dark.b;\n\t\t\t\t\t\tclippedVerticesItems[s + 35] = dark.a;\n\t\t\t\t\t}\n\n\t\t\t\t\ts = clippedTriangles.length;\n\t\t\t\t\tlet clippedTrianglesItems = Utils.setArraySize(clippedTriangles, s + 3);\n\t\t\t\t\tclippedTrianglesItems[s] = index;\n\t\t\t\t\tclippedTrianglesItems[s + 1] = (index + 1);\n\t\t\t\t\tclippedTrianglesItems[s + 2] = (index + 2);\n\t\t\t\t\tindex += 3;\n\t\t\t\t\tcontinue outer;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Clips the input triangle against the convex, clockwise clipping area. If the triangle lies entirely within the clipping\n\t * area, false is returned. The clipping area must duplicate the first vertex at the end of the vertices list. */\n\tclip (x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, clippingArea: Array<number>, output: Array<number>) {\n\t\tlet originalOutput = output;\n\t\tlet clipped = false;\n\n\t\t// Avoid copy at the end.\n\t\tlet input: Array<number> = null;\n\t\tif (clippingArea.length % 4 >= 2) {\n\t\t\tinput = output;\n\t\t\toutput = this.scratch;\n\t\t} else\n\t\t\tinput = this.scratch;\n\n\t\tinput.length = 0;\n\t\tinput.push(x1);\n\t\tinput.push(y1);\n\t\tinput.push(x2);\n\t\tinput.push(y2);\n\t\tinput.push(x3);\n\t\tinput.push(y3);\n\t\tinput.push(x1);\n\t\tinput.push(y1);\n\t\toutput.length = 0;\n\n\t\tlet clippingVertices = clippingArea;\n\t\tlet clippingVerticesLast = clippingArea.length - 4;\n\t\tfor (let i = 0;; i += 2) {\n\t\t\tlet edgeX = clippingVertices[i], edgeY = clippingVertices[i + 1];\n\t\t\tlet edgeX2 = clippingVertices[i + 2], edgeY2 = clippingVertices[i + 3];\n\t\t\tlet deltaX = edgeX - edgeX2, deltaY = edgeY - edgeY2;\n\n\t\t\tlet inputVertices = input;\n\t\t\tlet inputVerticesLength = input.length - 2, outputStart = output.length;\n\t\t\tfor (let ii = 0; ii < inputVerticesLength; ii += 2) {\n\t\t\t\tlet inputX = inputVertices[ii], inputY = inputVertices[ii + 1];\n\t\t\t\tlet inputX2 = inputVertices[ii + 2], inputY2 = inputVertices[ii + 3];\n\t\t\t\tlet side2 = deltaX * (inputY2 - edgeY2) - deltaY * (inputX2 - edgeX2) > 0;\n\t\t\t\tif (deltaX * (inputY - edgeY2) - deltaY * (inputX - edgeX2) > 0) {\n\t\t\t\t\tif (side2) { // v1 inside, v2 inside\n\t\t\t\t\t\toutput.push(inputX2);\n\t\t\t\t\t\toutput.push(inputY2);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t// v1 inside, v2 outside\n\t\t\t\t\tlet c0 = inputY2 - inputY, c2 = inputX2 - inputX;\n\t\t\t\t\tlet s = c0 * (edgeX2 - edgeX) - c2 * (edgeY2 - edgeY);\n\t\t\t\t\tif (Math.abs(s) > 0.000001) {\n\t\t\t\t\t\tlet ua = (c2 * (edgeY - inputY) - c0 * (edgeX - inputX)) / s;\n\t\t\t\t\t\toutput.push(edgeX + (edgeX2 - edgeX) * ua);\n\t\t\t\t\t\toutput.push(edgeY + (edgeY2 - edgeY) * ua);\n\t\t\t\t\t} else {\n\t\t\t\t\t\toutput.push(edgeX);\n\t\t\t\t\t\toutput.push(edgeY);\n\t\t\t\t\t}\n\t\t\t\t} else if (side2) { // v1 outside, v2 inside\n\t\t\t\t\tlet c0 = inputY2 - inputY, c2 = inputX2 - inputX;\n\t\t\t\t\tlet s = c0 * (edgeX2 - edgeX) - c2 * (edgeY2 - edgeY);\n\t\t\t\t\tif (Math.abs(s) > 0.000001) {\n\t\t\t\t\t\tlet ua = (c2 * (edgeY - inputY) - c0 * (edgeX - inputX)) / s;\n\t\t\t\t\t\toutput.push(edgeX + (edgeX2 - edgeX) * ua);\n\t\t\t\t\t\toutput.push(edgeY + (edgeY2 - edgeY) * ua);\n\t\t\t\t\t} else {\n\t\t\t\t\t\toutput.push(edgeX);\n\t\t\t\t\t\toutput.push(edgeY);\n\t\t\t\t\t}\n\t\t\t\t\toutput.push(inputX2);\n\t\t\t\t\toutput.push(inputY2);\n\t\t\t\t}\n\t\t\t\tclipped = true;\n\t\t\t}\n\n\t\t\tif (outputStart == output.length) { // All edges outside.\n\t\t\t\toriginalOutput.length = 0;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\toutput.push(output[0]);\n\t\t\toutput.push(output[1]);\n\n\t\t\tif (i == clippingVerticesLast) break;\n\t\t\tlet temp = output;\n\t\t\toutput = input;\n\t\t\toutput.length = 0;\n\t\t\tinput = temp;\n\t\t}\n\n\t\tif (originalOutput != output) {\n\t\t\toriginalOutput.length = 0;\n\t\t\tfor (let i = 0, n = output.length - 2; i < n; i++)\n\t\t\t\toriginalOutput[i] = output[i];\n\t\t} else\n\t\t\toriginalOutput.length = originalOutput.length - 2;\n\n\t\treturn clipped;\n\t}\n\n\tpublic static makeClockwise (polygon: ArrayLike<number>) {\n\t\tlet vertices = polygon;\n\t\tlet verticeslength = polygon.length;\n\n\t\tlet area = vertices[verticeslength - 2] * vertices[1] - vertices[0] * vertices[verticeslength - 1], p1x = 0, p1y = 0, p2x = 0, p2y = 0;\n\t\tfor (let i = 0, n = verticeslength - 3; i < n; i += 2) {\n\t\t\tp1x = vertices[i];\n\t\t\tp1y = vertices[i + 1];\n\t\t\tp2x = vertices[i + 2];\n\t\t\tp2y = vertices[i + 3];\n\t\t\tarea += p1x * p2y - p2x * p1y;\n\t\t}\n\t\tif (area < 0) return;\n\n\t\tfor (let i = 0, lastX = verticeslength - 2, n = verticeslength >> 1; i < n; i += 2) {\n\t\t\tlet x = vertices[i], y = vertices[i + 1];\n\t\t\tlet other = lastX - i;\n\t\t\tvertices[i] = vertices[other];\n\t\t\tvertices[i + 1] = vertices[other + 1];\n\t\t\tvertices[other] = x;\n\t\t\tvertices[other + 1] = y;\n\t\t}\n\t}\n}\n","import {\n BufferMesh,\n Engine,\n Buffer,\n VertexElement,\n VertexElementFormat,\n BufferBindFlag,\n IndexFormat,\n BufferUsage,\n} from '@galacean/engine';\nimport { MeshGenerator } from './MeshGenerator';\n\nexport class SpineMesh {\n\n private _mesh: BufferMesh;\n\n private _indexBuffer: Buffer;\n private _vertexBuffer: Buffer;\n\n get mesh() {\n return this._mesh;\n }\n\n get indexBuffer() {\n return this._indexBuffer;\n }\n\n get vertexBuffer() {\n return this._vertexBuffer;\n }\n\n initialize(engine: Engine, vertexCount: number) {\n const mesh = this._mesh = new BufferMesh(engine);\n\n const vertexElements = [\n new VertexElement('POSITION', 0, VertexElementFormat.Vector3, 0),\n new VertexElement('COLOR_0', 12, VertexElementFormat.Vector4, 0),\n new VertexElement('TEXCOORD_0', 28, VertexElementFormat.Vector2, 0),\n ];\n\n const vertexStride = (MeshGenerator.VERTEX_STRIDE) * 4; // position + color + uv * Float32 byteLen\n const byteLength = vertexStride * vertexCount;\n const vertexBuffer = new Buffer(\n engine,\n BufferBindFlag.VertexBuffer,\n byteLength,\n BufferUsage.Dynamic\n );\n\n const indexBuffer = new Buffer(\n engine,\n BufferBindFlag.IndexBuffer,\n vertexCount * 2,\n BufferUsage.Dynamic\n );\n\n this._indexBuffer = indexBuffer;\n this._vertexBuffer = vertexBuffer;\n\n mesh.setVertexBufferBinding(vertexBuffer, vertexStride);\n mesh.setIndexBufferBinding(indexBuffer, IndexFormat.UInt16);\n mesh.setVertexElements(vertexElements);\n mesh.addSubMesh(0, vertexCount);\n }\n\n changeBuffer(engine: Engine, vertexCount: number) {\n const vertexStride = (MeshGenerator.VERTEX_STRIDE) * 4; // position + color + uv * Float32 byteLen\n const byteLength = vertexStride * vertexCount;\n const vertexBuffer = new Buffer(\n engine,\n BufferBindFlag.VertexBuffer,\n byteLength,\n BufferUsage.Dynamic\n );\n\n const indexBuffer = new Buffer(\n engine,\n BufferBindFlag.IndexBuffer,\n vertexCount * 2,\n BufferUsage.Dynamic\n );\n const mesh = this._mesh;\n this._indexBuffer = indexBuffer;\n this._vertexBuffer = vertexBuffer;\n mesh.setVertexBufferBinding(vertexBuffer, vertexStride);\n mesh.setIndexBufferBinding(indexBuffer, IndexFormat.UInt16);\n }\n}","import {\n Engine,\n Entity,\n MeshRenderer,\n SubMesh,\n} from '@galacean/engine';\nimport { Skeleton } from '../spine-core/Skeleton';\nimport { SkeletonData } from '../spine-core/SkeletonData';\nimport { RegionAttachment } from '../spine-core/attachments/RegionAttachment';\nimport { MeshAttachment } from '../spine-core/attachments/MeshAttachment';\nimport { ClippingAttachment } from '../spine-core/attachments/ClippingAttachment';\nimport { ArrayLike, Color } from '../spine-core/Utils';\nimport { SkeletonClipping } from '../spine-core/SkeletonClipping';\nimport { SpineMesh } from './SpineMesh';\nimport { SpineRenderSetting } from '../types';\n\ntype SubMeshItem = {\n subMesh: SubMesh;\n name: string;\n}\nexport class MeshGenerator {\n static QUAD_TRIANGLES = [0, 1, 2, 2, 3, 0];\n static VERTEX_SIZE = 8; // 2 2 4 position without z, uv, color\n static VERTEX_STRIDE = 9; // 3 2 4 position with z, uv, color\n static tempColor: Color = new Color();\n\n private _setting: SpineRenderSetting;\n private _engine: Engine;\n private _entity: Entity;\n private _clipper: SkeletonClipping = new SkeletonClipping();\n private _spineMesh: SpineMesh = new SpineMesh();\n\n private _vertexCount: number;\n private _vertices: Float32Array;\n private _verticesWithZ: Float32Array;\n private _indices: Uint16Array;\n private _needResize: boolean = false;\n private _meshRenderer: MeshRenderer;\n private _subMeshItems: SubMeshItem[] = [];\n readonly separateSlots: string[] = [];\n\n get mesh() {\n return this._spineMesh.mesh;\n }\n\n get subMeshItems() {\n return this._subMeshItems;\n }\n\n constructor(engine: Engine, entity: Entity) {\n this._engine = engine;\n this._entity = entity;\n }\n\n initialize(skeletonData: SkeletonData, setting?: SpineRenderSetting) {\n if (!skeletonData) return;\n\n const meshRenderer = this._entity.getComponent(MeshRenderer);\n if (!meshRenderer) {\n console.warn('You need add MeshRenderer component to entity first');\n return;\n }\n this._meshRenderer = meshRenderer;\n\n if (setting) {\n this._setting = setting;\n }\n\n // Prepare buffer by using all attachment data but clippingAttachment\n const { defaultSkin: { attachments } } = skeletonData;\n let vertexCount: number = 0;\n const QUAD_TRIANGLE_LENGTH = MeshGenerator.QUAD_TRIANGLES.length;\n for (let i = 0, n = attachments.length; i < n; i++) {\n const slotAttachment = attachments[i];\n for (let key in slotAttachment) {\n const attachment = slotAttachment[key];\n if (!attachment) {\n continue;\n } else if (attachment instanceof RegionAttachment) {\n vertexCount += QUAD_TRIANGLE_LENGTH;\n } else if (attachment instanceof MeshAttachment) {\n let mesh = attachment;\n vertexCount += mesh.triangles.length;\n } else continue;\n }\n }\n this._vertexCount = vertexCount;\n this._prepareBufferData(this._vertexCount);\n const { _spineMesh } = this;\n _spineMesh.initialize(this._engine, this._vertexCount);\n meshRenderer.mesh = _spineMesh.mesh;\n }\n\n buildMesh(skeleton: Skeleton) {\n const {\n useClipping = true,\n zSpacing = 0.01,\n } = this._setting || {};\n\n let verticesLength = 0;\n let indicesLength = 0;\n this._subMeshItems.length = 0;\n \n const meshRenderer = this._meshRenderer;\n const drawOrder = skeleton.drawOrder;\n const maxSlotCount = drawOrder.length;\n const { _clipper, _spineMesh } = this;\n const { mesh } = _spineMesh;\n const subMeshItems = this._subMeshItems;\n let vertices: ArrayLike<number> = this._vertices;\n let triangles: Array<number>;\n let uvs: ArrayLike<number>;\n let start = 0;\n let count = 0;\n for (let slotIndex = 0; slotIndex < maxSlotCount; slotIndex += 1) {\n const slot = drawOrder[slotIndex];\n\n if (!slot.bone.active) {\n _clipper.clipEndWithSlot(slot);\n continue;\n }\n const attachment = slot.getAttachment();\n let attachmentColor: Color = null;\n let texture = null;\n const z = zSpacing * slotIndex;\n let numFloats = 0;\n let vertexSize = _clipper.isClipping() ? 2 : MeshGenerator.VERTEX_SIZE;\n if (\n attachment instanceof RegionAttachment\n ) {\n let regionAttachment = <RegionAttachment>attachment;\n attachmentColor = regionAttachment.color;\n vertices = this._vertices;\n numFloats = vertexSize * 4;\n regionAttachment.computeWorldVertices(slot.bone, vertices, 0, vertexSize);\n triangles = MeshGenerator.QUAD_TRIANGLES;\n uvs = regionAttachment.uvs;\n texture = regionAttachment.region.renderObject.texture;\n } else if (\n attachment instanceof MeshAttachment\n ) {\n let meshAttachment = <MeshAttachment>attachment;\n attachmentColor = meshAttachment.color;\n vertices = this._vertices;\n numFloats = (meshAttachment.worldVerticesLength >> 1) * vertexSize;\n if (numFloats > vertices.length) {\n vertices = this._vertices = new Float32Array(numFloats);\n }\n meshAttachment.computeWorldVertices(slot, 0, meshAttachment.worldVerticesLength, vertices, 0, vertexSize);\n triangles = meshAttachment.triangles;\n uvs = meshAttachment.uvs;\n texture = meshAttachment.region.renderObject.texture;\n } else if (\n attachment instanceof ClippingAttachment\n ) {\n if (useClipping) {\n let clip = <ClippingAttachment>(attachment);\n _clipper.clipStart(slot, clip);\n continue;\n }\n } else if (useClipping) { // attachment might be null or BoundingBoxAttachment\n _clipper.clipEndWithSlot(slot);\n continue;\n }\n\n if (texture != null) {\n let finalVertices: ArrayLike<number>;\n let finalVerticesLength: number;\n let finalIndices: ArrayLike<number>;\n let finalIndicesLength: number;\n\n let skeleton = slot.bone.skeleton;\n let skeletonColor = skeleton.color;\n let slotColor = slot.color;\n let alpha = skeletonColor.a * slotColor.a * attachmentColor.a;\n let color = MeshGenerator.tempColor;\n color.set(skeletonColor.r * slotColor.r * attachmentColor.r,\n skeletonColor.g * slotColor.g * attachmentColor.g,\n skeletonColor.b * slotColor.b * attachmentColor.b,\n alpha);\n\n if (_clipper.isClipping()) {\n _clipper.clipTriangles(vertices, numFloats, triangles, triangles.length, uvs, color, null, false);\n let clippedVertices = _clipper.clippedVertices;\n let clippedTriangles = _clipper.clippedTriangles;\n finalVertices = clippedVertices;\n finalVerticesLength = clippedVertices.length;\n finalIndices = clippedTriangles;\n finalIndicesLength = clippedTriangles.length;\n } else {\n let verts = vertices;\n for (let v = 2, u = 0, n = numFloats; v < n; v += vertexSize, u += 2) {\n verts[v] = color.r;\n verts[v + 1] = color.g;\n verts[v + 2] = color.b;\n verts[v + 3] = color.a;\n verts[v + 4] = uvs[u];\n verts[v + 5] = uvs[u + 1];\n }\n finalVertices = vertices;\n finalVerticesLength = numFloats;\n finalIndices = triangles;\n finalIndicesLength = triangles.length;\n }\n\n let indexStart = verticesLength / MeshGenerator.VERTEX_STRIDE;\n let verticesWithZ = this._verticesWithZ;\n let i = verticesLength;\n let j = 0;\n for (; j < finalVerticesLength;) {\n verticesWithZ[i++] = finalVertices[j++];\n verticesWithZ[i++] = finalVertices[j++];\n verticesWithZ[i++] = z;\n verticesWithZ[i++] = finalVertices[j++];\n verticesWithZ[i++] = finalVertices[j++];\n verticesWithZ[i++] = finalVertices[j++];\n verticesWithZ[i++] = finalVertices[j++];\n verticesWithZ[i++] = finalVertices[j++];\n verticesWithZ[i++] = finalVertices[j++];\n }\n verticesLength = i;\n\n let indicesArray = this._indices;\n for (i = indicesLength, j = 0; j < finalIndicesLength; i++, j++) {\n indicesArray[i] = finalIndices[j] + indexStart;\n }\n\n // add submesh\n const slotName = slot.data.name;\n const needSeparate = this.separateSlots.includes(slotName);\n\n if (needSeparate) {\n const subMesh = new SubMesh(indicesLength, finalIndicesLength);\n subMeshItems.push({\n name: slotName,\n subMesh,\n });\n if (count > 0) {\n const prevSubMesh = new SubMesh(start, count);\n subMeshItems.push({\n name: 'default',\n subMesh: prevSubMesh,\n });\n count = 0;\n }\n start = indicesLength + finalIndicesLength;\n } else {\n count += finalIndicesLength;\n }\n \n indicesLength += finalIndicesLength;\n\n const materials = meshRenderer.getMaterials();\n const materialLength = materials.length;\n for (let i = 0; i < materialLength; i += 1) {\n const mtl = materials[i];\n if (!mtl.shaderData.getTexture('material_SpineTexture')) {\n mtl.shaderData.setTexture('material_SpineTexture', texture.texture);\n }\n }\n }\n\n _clipper.clipEndWithSlot(slot);\n\n } // slot traverse end\n\n _clipper.clipEnd();\n\n // add reset sub mesh\n if (count > 0) {\n const subMesh = new SubMesh(start, count);\n subMeshItems.push({\n name: 'default',\n subMesh,\n });\n count = 0;\n }\n\n // sort sub-mesh\n subMeshItems.sort((a, b) => a.subMesh.start - b.subMesh.start);\n\n // update buffer when vertex count change\n if (indicesLength > 0 && indicesLength !== this._vertexCount) {\n if (indicesLength > this._vertexCount) {\n this._vertexCount = indicesLength;\n this._prepareBufferData(this._vertexCount);\n this._needResize = true;\n return;\n }\n }\n\n // update sub-mesh\n mesh.clearSubMesh();\n const subMeshItemLength = subMeshItems.length;\n for (let i = 0; i < subMeshItemLength; i += 1) {\n mesh.addSubMesh(subMeshItems[i].subMesh);\n }\n\n if (this._needResize) {\n // #1\n _spineMesh.vertexBuffer.resize(this._verticesWithZ.byteLength);\n _spineMesh.indexBuffer.resize(this._indices.byteLength);\n // #2 https://github.com/galacean/engine/issues/376\n // spineMesh.changeBuffer(this.engine, this.vertexCount);\n this._needResize = false;\n }\n _spineMesh.vertexBuffer.setData(this._verticesWithZ);\n _spineMesh.indexBuffer.setData(this._indices);\n }\n\n addSeparateSlot(slotName: string) {\n this.separateSlots.push(slotName);\n }\n\n private _prepareBufferData(vertexCount: number) {\n this._vertices = new Float32Array(vertexCount * MeshGenerator.VERTEX_SIZE);\n this._verticesWithZ = new Float32Array(vertexCount * MeshGenerator.VERTEX_STRIDE);\n this._indices = new Uint16Array(vertexCount);\n }\n}","import {\n BlendFactor,\n BlendOperation,\n CullMode,\n Engine,\n Material,\n RenderQueueType,\n Shader,\n} from \"@galacean/engine\";\n\nexport class SpineMaterial extends Material {\n private static _spineVS = `\n uniform mat4 renderer_MVPMat;\n\n attribute vec3 POSITION;\n attribute vec2 TEXCOORD_0;\n attribute vec4 COLOR_0;\n \n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n gl_Position = renderer_MVPMat * vec4(POSITION, 1.0);\n \n v_uv = TEXCOORD_0;\n v_color = COLOR_0;\n }\n `;\n\n private static _spineFS = `\n uniform sampler2D material_SpineTexture;\n\n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n vec4 baseColor = texture2D(material_SpineTexture, v_uv);\n gl_FragColor = baseColor * v_color;\n }\n `;\n constructor(engine: Engine) {\n const shader =\n Shader.find(\"galacean-spine-shader\") ||\n Shader.create(\n \"galacean-spine-shader\",\n SpineMaterial._spineVS,\n SpineMaterial._spineFS\n );\n super(engine, shader);\n const renderState = this.renderState;\n const target = renderState.blendState.targetBlendState;\n target.enabled = true;\n target.sourceColorBlendFactor = BlendFactor.SourceAlpha;\n target.destinationColorBlendFactor = BlendFactor.OneMinusSourceAlpha;\n target.sourceAlphaBlendFactor = BlendFactor.One;\n target.destinationAlphaBlendFactor = BlendFactor.OneMinusSourceAlpha;\n target.colorBlendOperation = target.alphaBlendOperation =\n BlendOperation.Add;\n renderState.depthState.writeEnabled = false;\n renderState.rasterState.cullMode = CullMode.Off;\n renderState.renderQueueType = RenderQueueType.Transparent;\n }\n}\n","import { Skeleton } from \"./spine-core/Skeleton\";\nimport { SkeletonData } from \"./spine-core/SkeletonData\";\nimport { AnimationState } from \"./spine-core/AnimationState\";\nimport { AnimationStateData } from \"./spine-core/AnimationStateData\";\nimport { MeshGenerator } from \"./core/MeshGenerator\";\nimport { SpineRenderSetting } from \"./types\";\nimport { Vector2 } from \"./spine-core/Utils\";\nimport {\n Script,\n Entity,\n ignoreClone,\n MeshRenderer,\n Texture2D,\n Material,\n Engine,\n} from \"@galacean/engine\";\nimport { SpineMaterial } from \"./SpineMaterial\";\n\nexport class SpineAnimation extends Script {\n /** Spine 材质 */\n private static _defaultMaterial: Material;\n static getDefaultMaterial(engine: Engine): Material {\n if (!this._defaultMaterial) {\n this._defaultMaterial = new SpineMaterial(engine);\n this._defaultMaterial.isGCIgnored = true;\n }\n return this._defaultMaterial.clone();\n }\n\n @ignoreClone\n private _skeletonData: SkeletonData;\n @ignoreClone\n private _skeleton: Skeleton;\n @ignoreClone\n private _state: AnimationState;\n @ignoreClone\n private _tempOffset: Vector2 = new Vector2();\n @ignoreClone\n private _tempSize: Vector2 = new Vector2();\n @ignoreClone\n private _tempArray: Array<number> = [0, 0];\n @ignoreClone\n protected _meshGenerator: MeshGenerator;\n @ignoreClone\n setting: SpineRenderSetting;\n\n autoUpdate: boolean = true;\n autoUpdateBounds: boolean = false;\n\n get skeletonData() {\n return this._skeletonData;\n }\n\n get skeleton() {\n return this._skeleton;\n }\n\n get state() {\n return this._state;\n }\n\n get mesh() {\n return this._meshGenerator.mesh;\n }\n\n set scale(v: number) {\n if (this._skeleton) {\n this._skeleton.scaleX = v;\n this._skeleton.scaleY = v;\n }\n }\n\n constructor(entity: Entity) {\n super(entity);\n this._meshGenerator = new MeshGenerator(this.engine, entity);\n }\n\n setSkeletonData(skeletonData: SkeletonData, setting?: SpineRenderSetting) {\n if (!skeletonData) {\n console.error('SkeletonData is undefined');\n }\n this.setting = setting;\n this._skeletonData = skeletonData;\n this._skeleton = new Skeleton(skeletonData);\n const animationData = new AnimationStateData(skeletonData);\n this._state = new AnimationState(animationData);\n this._meshGenerator.initialize(skeletonData, this.setting);\n }\n\n /**\n * Separate slot by slot name. This will add a new sub mesh, and new materials.\n */\n addSeparateSlot(slotName: string) {\n if (!this.skeleton) {\n console.error('Skeleton not found!');\n }\n const meshRenderer = this.entity.getComponent(MeshRenderer);\n if (!meshRenderer) {\n console.warn('You need add MeshRenderer component to entity first');\n }\n const slot = this.skeleton.findSlot(slotName);\n if (slot) {\n this._meshGenerator.addSeparateSlot(slotName);\n // add sprite default material for new sub mesh\n const mtl1 = SpineAnimation._defaultMaterial.clone();\n const mtl2 = SpineAnimation._defaultMaterial.clone();\n const { materialCount } = meshRenderer;\n // one split will generate two sub mesh, thus two materials required\n // if no sub mesh generated, redundant material will ignored by renderer\n meshRenderer.setMaterial(materialCount, mtl1);\n meshRenderer.setMaterial(materialCount + 1, mtl2);\n } else {\n console.warn(`Slot: ${slotName} not find.`);\n }\n }\n\n /**\n * Change texture of a separated slot by name.\n */\n hackSeparateSlotTexture(slotName: string, texture: Texture2D) {\n this._meshGenerator.buildMesh(this._skeleton);\n const { separateSlots, subMeshItems } = this._meshGenerator;\n if (separateSlots.length === 0) {\n console.warn('You need add separate slot');\n return;\n }\n if (separateSlots.includes(slotName)) {\n const meshRenderer = this.entity.getComponent(MeshRenderer);\n const subMeshIndex = subMeshItems.findIndex(item => item.name === slotName);\n const mtl = meshRenderer.getMaterial(subMeshIndex);\n mtl.shaderData.setTexture('material_SpineTexture', texture);\n } else {\n console.warn(`Slot ${slotName} is not separated. You should use addSeparateSlot to separate it`);\n }\n }\n\n onUpdate(delta: number) {\n if (this.autoUpdate) {\n this.updateState(delta);\n }\n }\n\n updateState(deltaTime: number) {\n if (!this._skeleton || !this.state) return;\n const state = this._state;\n const skeleton = this._skeleton;\n\n state.update(deltaTime);\n state.apply(skeleton);\n skeleton.updateWorldTransform();\n\n this.updateGeometry();\n }\n\n updateGeometry() {\n if (!this._skeleton) return;\n this._meshGenerator.buildMesh(this._skeleton);\n if (this.autoUpdateBounds) {\n this.updateBounds();\n }\n }\n\n updateBounds() {\n const meshRenderer = this.entity.getComponent(MeshRenderer);\n const bounds = meshRenderer.bounds;\n const offset = this._tempOffset;\n const size = this._tempSize;\n const temp = this._tempArray;\n const zSpacing = this.setting?.zSpacing || 0.01;\n const skeleton = this._skeleton;\n skeleton.getBounds(offset, size, temp);\n const drawOrder = skeleton.drawOrder;\n bounds.min.set(offset.x, offset.y, 0);\n bounds.max.set(offset.x + size.x, offset.y + size.y, drawOrder.length * zSpacing);\n }\n\n /**\n * Spine animation custom clone.\n */\n _cloneTo(target: SpineAnimation) {\n target.setSkeletonData(this.skeletonData);\n const _cloneSetting = {...this.setting};\n target.setting = _cloneSetting;\n }\n\n private _disposeCurrentSkeleton() {\n this._skeletonData = null;\n this._skeleton = null;\n this._state = null;\n }\n\n onDestroy() {\n this._disposeCurrentSkeleton();\n this._meshGenerator = null;\n this.setting = null;\n }\n\n}","export function _array_like_to_array(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n}\nexport { _array_like_to_array as _ };\n","import { _unsupported_iterable_to_array } from \"./_unsupported_iterable_to_array.js\";\n\nexport function _create_for_of_iterator_helper_loose(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n\n if (it) return (it = it.call(o)).next.bind(it);\n // Fallback for engines without symbol support\n if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n\n var i = 0;\n\n return function() {\n if (i >= o.length) return { done: true };\n\n return { done: false, value: o[i++] };\n };\n }\n\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nexport { _create_for_of_iterator_helper_loose as _ };\n","import { _array_like_to_array } from \"./_array_like_to_array.js\";\n\nexport function _unsupported_iterable_to_array(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _array_like_to_array(o, minLen);\n\n var n = Object.prototype.toString.call(o).slice(8, -1);\n\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(n);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);\n}\nexport { _unsupported_iterable_to_array as _ };\n","import { Disposable, Map } from \"./Utils\";\r\nimport { TextureAtlas } from \"./TextureAtlas\";\r\nimport { FakeTexture } from \"./Texture\";\r\nimport { AdaptiveTexture } from \"../SpineLoader\";\r\nimport { request } from \"@galacean/engine\";\r\n\r\nexport class AssetManager implements Disposable {\r\n\t// todo: enhance asset manager: load image data\r\n\tprotected pathPrefix: string;\r\n\tprotected textureLoader: (image: HTMLImageElement) => AdaptiveTexture;\r\n\tprotected assets: Map<any> = {};\r\n\tprotected errors: Map<string> = {};\r\n\tprotected toLoad = 0;\r\n\tprotected loaded = 0;\r\n\tprotected rawDataUris: Map<string> = {};\r\n\tonLoadComplete: any;\r\n\r\n\tconstructor (pathPrefix?: string, textureLoader?: (image: HTMLImageElement) => AdaptiveTexture) {\r\n\t\tthis.pathPrefix = pathPrefix || '';\r\n\t\tthis.textureLoader = textureLoader;\r\n\t}\r\n\r\n\tprivate downloadText (url: string, success: (data: any) => void, error: (error: any) => void) {\r\n\t\trequest(url, { type: 'text' }).then((res) => {\r\n\t\t\tsuccess(res);\r\n\t\t}).catch((err) => {\r\n\t\t\terror(err);\r\n\t\t});\r\n\t}\r\n\r\n\tprotected downloadBinary (url: string, success: (data: Uint8Array) => void, error: (status: number, responseText: string) => void) {\r\n\t\tlet request = new XMLHttpRequest();\r\n\t\tif (this.rawDataUris[url]) url = this.rawDataUris[url];\r\n\t\trequest.open(\"GET\", url, true);\r\n\t\trequest.responseType = \"arraybuffer\";\r\n\t\trequest.onload = () => {\r\n\t\t\tif (request.status == 200) {\r\n\t\t\t\tsuccess(new Uint8Array(request.response as ArrayBuffer));\r\n\t\t\t} else {\r\n\t\t\t\terror(request.status, request.responseText);\r\n\t\t\t}\r\n\t\t}\r\n\t\trequest.onerror = () => {\r\n\t\t\terror(request.status, request.responseText);\r\n\t\t}\r\n\t\trequest.send();\r\n\t}\r\n\r\n\tsetRawDataURI(path: string, data: string) {\r\n\t\tthis.rawDataUris[this.pathPrefix + path] = data;\r\n\t}\r\n\r\n\tloadBinary(path: string,\r\n\t\tsuccess: (path: string, binary: Uint8Array) => void = null,\r\n\t\terror: (error: string) => void = null) {\r\n\t\tpath = this.pathPrefix + path;\r\n\t\tthis.toLoad++;\r\n\r\n\t\tthis.downloadBinary(path, (data: Uint8Array): void => {\r\n\t\t\tthis.assets[path] = data;\r\n\t\t\tif (success) success(path, data);\r\n\t\t\tthis.onLoad();\r\n\t\t\tthis.loaded++;\r\n\t\t}, (state: number, responseText: string): void => {\r\n\t\t\tthis.errors[path] = `Couldn't load binary ${path}: status ${status}, ${responseText}`;\r\n\t\t\tif (error) error(`Couldn't load binary ${path}: status ${status}, ${responseText}`);\r\n\t\t\tthis.onLoad();\r\n\t\t\tthis.loaded++;\r\n\t\t});\r\n\t}\r\n\r\n\tloadText(path: string,\r\n\t\tsuccess: (path: string, text: string) => void = null,\r\n\t\terror: (error: string) => void = null) {\r\n\t\tpath = this.pathPrefix + path;\r\n\t\tthis.toLoad++;\r\n\r\n\t\tthis.downloadText(path, (data: string): void => {\r\n\t\t\tthis.assets[path] = data;\r\n\t\t\tif (success) success(path, data);\r\n\t\t\tthis.onLoad();\r\n\t\t\tthis.loaded++;\r\n\t\t}, (err: any): void => {\r\n\t\t\tthis.errors[path] = `Couldn't load text ${path}: ${JSON.stringify(err)}`;\r\n\t\t\tif (error) error(`Couldn't load text ${path}: ${JSON.stringify(err)}`);\r\n\t\t\tthis.onLoad();\r\n\t\t\tthis.loaded++;\r\n\t\t});\r\n\t}\r\n\r\n\tloadImage (path: string,\r\n\t\tsuccess: (path: string, image: HTMLImageElement) => void = null,\r\n\t\terror: (error: string) => void = null) {\r\n\t\tpath = this.pathPrefix + path;\r\n\t\tlet storagePath = path;\r\n\t\tthis.toLoad++;\r\n\t\tlet img = new Image();\r\n\t\timg.crossOrigin = \"anonymous\";\r\n\t\timg.onload = (ev) => {\r\n\t\t\tthis.assets[storagePath] = img;\r\n\t\t\tthis.onLoad();\r\n\t\t\tthis.loaded++;\r\n\t\t\tif (success) success(path, img);\r\n\t\t}\r\n\t\timg.onerror = (ev) => {\r\n\t\t\tthis.errors[path] = `Couldn't load image ${path}`;\r\n\t\t\tthis.onLoad();\r\n\t\t\tthis.loaded++;\r\n\t\t\tif (error) error(`Couldn't load image ${path}`);\r\n\t\t}\r\n\t\tif (this.rawDataUris[path]) path = this.rawDataUris[path];\r\n\t\timg.src = path;\r\n\t}\r\n\r\n\tloadTexture (path: string,\r\n\t\tsuccess: (path: string, texture: AdaptiveTexture) => void = null,\r\n\t\terror: (error: string) => void = null) {\r\n\t\tpath = this.pathPrefix + path;\r\n\t\tlet storagePath = path;\r\n\t\tthis.toLoad++;\r\n\t\tif (this.rawDataUris[path]) path = this.rawDataUris[path];\r\n\t\trequest(path, { type: 'image' }).then((res: any) => {\r\n\t\t\tlet texture = this.textureLoader(res);\r\n\t\t\tthis.assets[storagePath] = texture;\r\n\t\t\tthis.onLoad();\r\n\t\t\tthis.loaded++;\r\n\t\t\tif (success) success(path, texture);\r\n\t\t}).catch((err) => {\r\n\t\t\terror(err);\r\n\t\t});\r\n\r\n\t}\r\n\r\n\tloadTextureAtlas (path: string,\r\n\t\tsuccess: (path: string, atlas: TextureAtlas) => void = null,\r\n\t\terror: (error: string) => void = null\r\n\t) {\r\n\t\tlet parent = path.lastIndexOf(\"/\") >= 0 ? path.substring(0, path.lastIndexOf(\"/\")) : \"\";\r\n\t\tpath = this.pathPrefix + path;\r\n\t\tthis.toLoad++;\r\n\r\n\t\tthis.downloadText(path, (atlasData: string): void => {\r\n\t\t\tlet pagesLoaded: any = { count: 0 };\r\n\t\t\tlet atlasPages = new Array<string>();\r\n\t\t\ttry {\r\n\t\t\t\tlet atlas = new TextureAtlas(atlasData, (path: string) => {\r\n\t\t\t\t\tatlasPages.push(parent == \"\" ? path : parent + \"/\" + path);\r\n\t\t\t\t\tlet image = document.createElement(\"img\") as HTMLImageElement;\r\n\t\t\t\t\timage.width = 16;\r\n\t\t\t\t\timage.height = 16;\r\n\t\t\t\t\treturn new FakeTexture(image);\r\n\t\t\t\t});\r\n\t\t\t} catch (e) {\r\n\t\t\t\tlet ex = e as Error;\r\n\t\t\t\tthis.errors[path] = `Couldn't load texture atlas ${path}: ${ex.message}`;\r\n\t\t\t\tif (error) error(`Couldn't load texture atlas ${path}: ${ex.message}`);\r\n\t\t\t\tthis.onLoad();\r\n\t\t\t\tthis.loaded++;\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tfor (let atlasPage of atlasPages) {\r\n\t\t\t\tlet pageLoadError = false;\r\n\r\n\t\t\t\tthis.loadTexture(atlasPage, (imagePath: string, texture: AdaptiveTexture) => {\r\n\t\t\t\t\tpagesLoaded.count++;\r\n\t\t\t\t\tif (pagesLoaded.count == atlasPages.length) {\r\n\t\t\t\t\t\tif (!pageLoadError) {\r\n\t\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\t\tlet atlas = new TextureAtlas(atlasData, (path: string) => {\r\n\t\t\t\t\t\t\t\t\treturn this.get(parent == \"\" ? path : parent + \"/\" + path);\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\tthis.assets[path] = atlas;\r\n\t\t\t\t\t\t\t\tif (success) success(path, atlas);\r\n\t\t\t\t\t\t\t\tthis.onLoad();\r\n\t\t\t\t\t\t\t\tthis.loaded++;\r\n\t\t\t\t\t\t\t} catch (e) {\r\n\t\t\t\t\t\t\t\tlet ex = e as Error;\r\n\t\t\t\t\t\t\t\tthis.errors[path] = `Couldn't load texture atlas ${path}: ${ex.message}`;\r\n\t\t\t\t\t\t\t\tif (error) error(`Couldn't load texture atlas ${path}: ${ex.message}`);\r\n\t\t\t\t\t\t\t\tthis.onLoad();\r\n\t\t\t\t\t\t\t\tthis.loaded++;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tthis.errors[path] = `Couldn't load texture atlas page ${imagePath}} of atlas ${path}`;\r\n\t\t\t\t\t\t\tif (error) error(`Couldn't load texture atlas page ${imagePath} of atlas ${path}`);\r\n\t\t\t\t\t\t\tthis.onLoad();\r\n\t\t\t\t\t\t\tthis.loaded++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}, (imagePath: string) => {\r\n\t\t\t\t\tpageLoadError = true;\r\n\t\t\t\t\tpagesLoaded.count++;\r\n\r\n\t\t\t\t\tif (pagesLoaded.count == atlasPages.length) {\r\n\t\t\t\t\t\tthis.errors[path] = `Couldn't load texture atlas page ${imagePath}} of atlas ${path}`;\r\n\t\t\t\t\t\tif (error) error(`Couldn't load texture atlas page ${imagePath} of atlas ${path}`);\r\n\t\t\t\t\t\tthis.onLoad();\r\n\t\t\t\t\t\tthis.loaded++;\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}, (err: any): void => {\r\n\t\t\tthis.errors[path] = `Couldn't load texture atlas ${path}: ${JSON.stringify(err)}`;\r\n\t\t\tif (error) error(`Couldn't load texture atlas ${path}: ${JSON.stringify(err)}`);\r\n\t\t\tthis.onLoad();\r\n\t\t\tthis.loaded++;\r\n\t\t});\r\n\t}\r\n\r\n\tget (path: string) {\r\n\t\tpath = this.pathPrefix + path;\r\n\t\treturn this.assets[path];\r\n\t}\r\n\r\n\tremove (path: string) {\r\n\t\tpath = this.pathPrefix + path;\r\n\t\tlet asset = this.assets[path];\r\n\t\tif ((<any>asset).dispose) (<any>asset).dispose();\r\n\t\tthis.assets[path] = null;\r\n\t}\r\n\r\n\tremoveAll () {\r\n\t\tfor (let key in this.assets) {\r\n\t\t\tlet asset = this.assets[key];\r\n\t\t\tif ((<any>asset).dispose) (<any>asset).dispose();\r\n\t\t}\r\n\t\tthis.assets = {};\r\n\t}\r\n\r\n\tisLoadingComplete (): boolean {\r\n\t\treturn this.toLoad == 0;\r\n\t}\r\n\r\n\tonLoad() {\r\n\t\tthis.toLoad--;\r\n\t\tif (this.toLoad === 0) {\r\n\t\t\tthis.onLoadComplete();\r\n\t\t}\r\n\t}\r\n\r\n\tgetToLoad (): number {\r\n\t\treturn this.toLoad;\r\n\t}\r\n\r\n\tgetLoaded (): number {\r\n\t\treturn this.loaded;\r\n\t}\r\n\r\n\tdispose () {\r\n\t\tthis.removeAll();\r\n\t}\r\n\r\n\thasErrors() {\r\n\t\treturn Object.keys(this.errors).length > 0;\r\n\t}\r\n\r\n\tgetErrors() {\r\n\t\treturn this.errors;\r\n\t}\r\n}\r\n","\r\n\r\n\r\n\r\n\t/** Determines how images are blended with existing pixels when drawn. */\r\n\texport enum BlendMode {\r\n\t\tNormal,\r\n\t\tAdditive,\r\n\t\tMultiply,\r\n\t\tScreen\r\n\t}\r\n","\r\n\r\nimport { VertexAttachment, Attachment } from \"./Attachment\";\r\nimport { Color } from \"../Utils\";\r\n\r\n\r\n\r\n/** An attachment with vertices that make up a polygon. Can be used for hit detection, creating physics bodies, spawning particle\r\n * effects, and more.\r\n *\r\n * See {@link SkeletonBounds} and [Bounding Boxes](http://esotericsoftware.com/spine-bounding-boxes) in the Spine User\r\n * Guide. */\r\nexport class BoundingBoxAttachment extends VertexAttachment {\r\ncolor = new Color(1, 1, 1, 1);\r\n\r\nconstructor (name: string) {\r\n\tsuper(name);\r\n}\r\n\r\ncopy (): Attachment {\r\n\tlet copy = new BoundingBoxAttachment(this.name);\r\n\tthis.copyTo(copy);\r\n\tcopy.color.setFromColor(this.color);\r\n\treturn copy;\r\n}\r\n}\r\n","\n\nimport { VertexAttachment, Attachment } from \"./Attachment\";\nimport { Color, MathUtils, Vector2 } from \"../Utils\";\nimport { Bone } from \"../Bone\";\n\n\n/** An attachment which is a single point and a rotation. This can be used to spawn projectiles, particles, etc. A bone can be\n * used in similar ways, but a PointAttachment is slightly less expensive to compute and can be hidden, shown, and placed in a\n * skin.\n *\n * See [Point Attachments](http://esotericsoftware.com/spine-point-attachments) in the Spine User Guide. */\nexport class PointAttachment extends VertexAttachment {\n\tx: number; y: number; rotation: number;\n\n\t/** The color of the point attachment as it was in Spine. Available only when nonessential data was exported. Point attachments\n\t * are not usually rendered at runtime. */\n\tcolor = new Color(0.38, 0.94, 0, 1);\n\n\tconstructor (name: string) {\n\t\tsuper(name);\n\t\tthis.name = name;\n\t}\n\n\tcomputeWorldPosition (bone: Bone, point: Vector2) {\n\t\tpoint.x = this.x * bone.a + this.y * bone.b + bone.worldX;\n\t\tpoint.y = this.x * bone.c + this.y * bone.d + bone.worldY;\n\t\treturn point;\n\t}\n\n\tcomputeWorldRotation (bone: Bone) {\n\t\tlet cos = MathUtils.cosDeg(this.rotation), sin = MathUtils.sinDeg(this.rotation);\n\t\tlet x = cos * bone.a + sin * bone.b;\n\t\tlet y = cos * bone.c + sin * bone.d;\n\t\treturn Math.atan2(y, x) * MathUtils.radDeg;\n\t}\n\n\tcopy (): Attachment {\n\t\tlet copy = new PointAttachment(this.name);\n\t\tcopy.x = this.x;\n\t\tcopy.y = this.y;\n\t\tcopy.rotation = this.rotation;\n\t\tcopy.color.setFromColor(this.color);\n\t\treturn copy;\n\t}\n}\n","\n\nimport { AttachmentLoader } from \"./attachments/AttachmentLoader\";\nimport { TextureAtlas } from \"./TextureAtlas\";\nimport { Skin } from \"./Skin\";\nimport { RegionAttachment } from \"./attachments/RegionAttachment\";\nimport { MeshAttachment } from \"./attachments/MeshAttachment\";\nimport { BoundingBoxAttachment } from \"./attachments/BoundingBoxAttachment\";\nimport { PathAttachment } from \"./attachments/PathAttachment\";\nimport { PointAttachment } from \"./attachments/PointAttachment\";\nimport { ClippingAttachment } from \"./attachments/ClippingAttachment\";\n\n/** An {@link AttachmentLoader} that configures attachments using texture regions from an {@link TextureAtlas}.\n *\n * See [Loading skeleton data](http://esotericsoftware.com/spine-loading-skeleton-data#JSON-and-binary-data) in the\n * Spine Runtimes Guide. */\nexport class AtlasAttachmentLoader implements AttachmentLoader {\n\tatlas: TextureAtlas;\n\n\tconstructor (atlas: TextureAtlas) {\n\t\tthis.atlas = atlas;\n\t}\n\n\tnewRegionAttachment (skin: Skin, name: string, path: string): RegionAttachment {\n\t\tlet region = this.atlas.findRegion(path);\n\t\tif (region == null) throw new Error(\"Region not found in atlas: \" + path + \" (region attachment: \" + name + \")\");\n\t\tregion.renderObject = region;\n\t\tlet attachment = new RegionAttachment(name);\n\t\tattachment.setRegion(region);\n\t\treturn attachment;\n\t}\n\n\tnewMeshAttachment (skin: Skin, name: string, path: string) : MeshAttachment {\n\t\tlet region = this.atlas.findRegion(path);\n\t\tif (region == null) throw new Error(\"Region not found in atlas: \" + path + \" (mesh attachment: \" + name + \")\");\n\t\tregion.renderObject = region;\n\t\tlet attachment = new MeshAttachment(name);\n\t\tattachment.region = region;\n\t\treturn attachment;\n\t}\n\n\tnewBoundingBoxAttachment (skin: Skin, name: string) : BoundingBoxAttachment {\n\t\treturn new BoundingBoxAttachment(name);\n\t}\n\n\tnewPathAttachment (skin: Skin, name: string): PathAttachment {\n\t\treturn new PathAttachment(name);\n\t}\n\n\tnewPointAttachment(skin: Skin, name: string): PointAttachment {\n\t\treturn new PointAttachment(name);\n\t}\n\n\tnewClippingAttachment(skin: Skin, name: string): ClippingAttachment {\n\t\treturn new ClippingAttachment(name);\n\t}\n}\n","\r\n\r\nimport { BoneData } from \"./BoneData\";\r\nimport { SlotData } from \"./SlotData\";\r\nimport { Skin } from \"./Skin\";\r\nimport { EventData } from \"./EventData\";\r\nimport { IkConstraintData } from \"./IkConstraintData\";\r\nimport { TransformConstraintData } from \"./TransformConstraintData\";\r\nimport { PathConstraintData } from \"./PathConstraintData\";\r\nimport { Animation} from \"./Animation\";\r\n\r\n\r\n/** Stores the setup pose and all of the stateless data for a skeleton.\r\n *\r\n * See [Data objects](http://esotericsoftware.com/spine-runtime-architecture#Data-objects) in the Spine Runtimes\r\n * Guide. */\r\nexport class SkeletonData {\r\n\r\n\t/** The skeleton's name, which by default is the name of the skeleton data file, if possible. May be null. */\r\n\tname: string;\r\n\r\n\t/** The skeleton's bones, sorted parent first. The root bone is always the first bone. */\r\n\tbones = new Array<BoneData>(); // Ordered parents first.\r\n\r\n\t/** The skeleton's slots. */\r\n\tslots = new Array<SlotData>(); // Setup pose draw order.\r\n\tskins = new Array<Skin>();\r\n\r\n\t/** The skeleton's default skin. By default this skin contains all attachments that were not in a skin in Spine.\r\n\t *\r\n\t * See {@link Skeleton#getAttachmentByName()}.\r\n\t * May be null. */\r\n\tdefaultSkin: Skin;\r\n\r\n\t/** The skeleton's events. */\r\n\tevents = new Array<EventData>();\r\n\r\n\t/** The skeleton's animations. */\r\n\tanimations = new Array<Animation>();\r\n\r\n\t/** The skeleton's IK constraints. */\r\n\tikConstraints = new Array<IkConstraintData>();\r\n\r\n\t/** The skeleton's transform constraints. */\r\n\ttransformConstraints = new Array<TransformConstraintData>();\r\n\r\n\t/** The skeleton's path constraints. */\r\n\tpathConstraints = new Array<PathConstraintData>();\r\n\r\n\t/** The X coordinate of the skeleton's axis aligned bounding box in the setup pose. */\r\n\tx: number;\r\n\r\n\t/** The Y coordinate of the skeleton's axis aligned bounding box in the setup pose. */\r\n\ty: number;\r\n\r\n\t/** The width of the skeleton's axis aligned bounding box in the setup pose. */\r\n\twidth: number;\r\n\r\n\t/** The height of the skeleton's axis aligned bounding box in the setup pose. */\r\n\theight: number;\r\n\r\n\t/** The Spine version used to export the skeleton data, or null. */\r\n\tversion: string;\r\n\r\n\t/** The skeleton data hash. This value will change if any of the skeleton data has changed. May be null. */\r\n\thash: string;\r\n\r\n\t// Nonessential\r\n\t/** The dopesheet FPS in Spine. Available only when nonessential data was exported. */\r\n\tfps = 0;\r\n\r\n\t/** The path to the images directory as defined in Spine. Available only when nonessential data was exported. May be null. */\r\n\timagesPath: string;\r\n\r\n\t/** The path to the audio directory as defined in Spine. Available only when nonessential data was exported. May be null. */\r\n\taudioPath: string;\r\n\r\n\t/** Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it\r\n\t * multiple times.\r\n\t * @returns May be null. */\r\n\tfindBone (boneName: string) {\r\n\t\tif (boneName == null) throw new Error(\"boneName cannot be null.\");\r\n\t\tlet bones = this.bones;\r\n\t\tfor (let i = 0, n = bones.length; i < n; i++) {\r\n\t\t\tlet bone = bones[i];\r\n\t\t\tif (bone.name == boneName) return bone;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\tfindBoneIndex (boneName: string) {\r\n\t\tif (boneName == null) throw new Error(\"boneName cannot be null.\");\r\n\t\tlet bones = this.bones;\r\n\t\tfor (let i = 0, n = bones.length; i < n; i++)\r\n\t\t\tif (bones[i].name == boneName) return i;\r\n\t\treturn -1;\r\n\t}\r\n\r\n\t/** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it\r\n\t * multiple times.\r\n\t * @returns May be null. */\r\n\tfindSlot (slotName: string) {\r\n\t\tif (slotName == null) throw new Error(\"slotName cannot be null.\");\r\n\t\tlet slots = this.slots;\r\n\t\tfor (let i = 0, n = slots.length; i < n; i++) {\r\n\t\t\tlet slot = slots[i];\r\n\t\t\tif (slot.name == slotName) return slot;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\tfindSlotIndex (slotName: string) {\r\n\t\tif (slotName == null) throw new Error(\"slotName cannot be null.\");\r\n\t\tlet slots = this.slots;\r\n\t\tfor (let i = 0, n = slots.length; i < n; i++)\r\n\t\t\tif (slots[i].name == slotName) return i;\r\n\t\treturn -1;\r\n\t}\r\n\r\n\t/** Finds a skin by comparing each skin's name. It is more efficient to cache the results of this method than to call it\r\n\t * multiple times.\r\n\t * @returns May be null. */\r\n\tfindSkin (skinName: string) {\r\n\t\tif (skinName == null) throw new Error(\"skinName cannot be null.\");\r\n\t\tlet skins = this.skins;\r\n\t\tfor (let i = 0, n = skins.length; i < n; i++) {\r\n\t\t\tlet skin = skins[i];\r\n\t\t\tif (skin.name == skinName) return skin;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/** Finds an event by comparing each events's name. It is more efficient to cache the results of this method than to call it\r\n\t * multiple times.\r\n\t * @returns May be null. */\r\n\tfindEvent (eventDataName: string) {\r\n\t\tif (eventDataName == null) throw new Error(\"eventDataName cannot be null.\");\r\n\t\tlet events = this.events;\r\n\t\tfor (let i = 0, n = events.length; i < n; i++) {\r\n\t\t\tlet event = events[i];\r\n\t\t\tif (event.name == eventDataName) return event;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/** Finds an animation by comparing each animation's name. It is more efficient to cache the results of this method than to\r\n\t * call it multiple times.\r\n\t * @returns May be null. */\r\n\tfindAnimation (animationName: string) {\r\n\t\tif (animationName == null) throw new Error(\"animationName cannot be null.\");\r\n\t\tlet animations = this.animations;\r\n\t\tfor (let i = 0, n = animations.length; i < n; i++) {\r\n\t\t\tlet animation = animations[i];\r\n\t\t\tif (animation.name == animationName) return animation;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method\r\n\t * than to call it multiple times.\r\n\t * @return May be null. */\r\n\tfindIkConstraint (constraintName: string) {\r\n\t\tif (constraintName == null) throw new Error(\"constraintName cannot be null.\");\r\n\t\tlet ikConstraints = this.ikConstraints;\r\n\t\tfor (let i = 0, n = ikConstraints.length; i < n; i++) {\r\n\t\t\tlet constraint = ikConstraints[i];\r\n\t\t\tif (constraint.name == constraintName) return constraint;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of\r\n\t * this method than to call it multiple times.\r\n\t * @return May be null. */\r\n\tfindTransformConstraint (constraintName: string) {\r\n\t\tif (constraintName == null) throw new Error(\"constraintName cannot be null.\");\r\n\t\tlet transformConstraints = this.transformConstraints;\r\n\t\tfor (let i = 0, n = transformConstraints.length; i < n; i++) {\r\n\t\t\tlet constraint = transformConstraints[i];\r\n\t\t\tif (constraint.name == constraintName) return constraint;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method\r\n\t * than to call it multiple times.\r\n\t * @return May be null. */\r\n\tfindPathConstraint (constraintName: string) {\r\n\t\tif (constraintName == null) throw new Error(\"constraintName cannot be null.\");\r\n\t\tlet pathConstraints = this.pathConstraints;\r\n\t\tfor (let i = 0, n = pathConstraints.length; i < n; i++) {\r\n\t\t\tlet constraint = pathConstraints[i];\r\n\t\t\tif (constraint.name == constraintName) return constraint;\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\tfindPathConstraintIndex (pathConstraintName: string) {\r\n\t\tif (pathConstraintName == null) throw new Error(\"pathConstraintName cannot be null.\");\r\n\t\tlet pathConstraints = this.pathConstraints;\r\n\t\tfor (let i = 0, n = pathConstraints.length; i < n; i++)\r\n\t\t\tif (pathConstraints[i].name == pathConstraintName) return i;\r\n\t\treturn -1;\r\n\t}\r\n}\r\n","\r\n\r\nimport { BoneData } from \"./BoneData\";\r\nimport { Color } from \"./Utils\";\r\nimport { BlendMode } from \"./BlendMode\";\r\n\r\n\r\n\r\n/** Stores the setup pose for a {@link Slot}. */\r\nexport class SlotData {\r\n\r\n\t/** The index of the slot in {@link Skeleton#getSlots()}. */\r\n\tindex: number;\r\n\r\n\t/** The name of the slot, which is unique across all slots in the skeleton. */\r\n\tname: string;\r\n\r\n\t/** The bone this slot belongs to. */\r\n\tboneData: BoneData;\r\n\r\n\t/** The color used to tint the slot's attachment. If {@link #getDarkColor()} is set, this is used as the light color for two\r\n\t * color tinting. */\r\n\tcolor = new Color(1, 1, 1, 1);\r\n\r\n\t/** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark\r\n\t * color's alpha is not used. */\r\n\tdarkColor: Color;\r\n\r\n\t/** The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible. */\r\n\tattachmentName: string;\r\n\r\n\t/** The blend mode for drawing the slot's attachment. */\r\n\tblendMode: BlendMode;\r\n\r\n\tconstructor (index: number, name: string, boneData: BoneData) {\r\n\t\tif (index < 0) throw new Error(\"index must be >= 0.\");\r\n\t\tif (name == null) throw new Error(\"name cannot be null.\");\r\n\t\tif (boneData == null) throw new Error(\"boneData cannot be null.\");\r\n\t\tthis.index = index;\r\n\t\tthis.name = name;\r\n\t\tthis.boneData = boneData;\r\n\t}\r\n}\r\n","\r\n\r\nimport { ConstraintData } from \"./ConstraintData\";\r\nimport { BoneData } from \"./BoneData\";\r\n\r\n\r\n\r\n/** Stores the setup pose for an {@link IkConstraint}.\r\n * <p>\r\n * See [IK constraints](http://esotericsoftware.com/spine-ik-constraints) in the Spine User Guide. */\r\nexport class IkConstraintData extends ConstraintData {\r\n\t/** The bones that are constrained by this IK constraint. */\r\n\tbones = new Array<BoneData>();\r\n\r\n\t/** The bone that is the IK target. */\r\n\ttarget: BoneData;\r\n\r\n\t/** Controls the bend direction of the IK bones, either 1 or -1. */\r\n\tbendDirection = 1;\r\n\r\n\t/** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */\r\n\tcompress = false;\r\n\r\n\t/** When true, if the target is out of range, the parent bone is scaled to reach it. If more than one bone is being constrained\r\n\t * and the parent bone has local nonuniform scale, stretch is not applied. */\r\n\tstretch = false;\r\n\r\n\t/** When true, only a single bone is being constrained, and {@link #getCompress()} or {@link #getStretch()} is used, the bone\r\n\t * is scaled on both the X and Y axes. */\r\n\tuniform = false;\r\n\r\n\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */\r\n\tmix = 1;\r\n\r\n\t/** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */\r\n\tsoftness = 0;\r\n\r\n\tconstructor (name: string) {\r\n\t\tsuper(name, 0, false);\r\n\t}\r\n}\r\n","\r\n\r\nimport { ConstraintData } from \"./ConstraintData\";\r\nimport { BoneData } from \"./BoneData\";\r\n\r\n\r\n/** Stores the setup pose for a {@link TransformConstraint}.\r\n *\r\n * See [Transform constraints](http://esotericsoftware.com/spine-transform-constraints) in the Spine User Guide. */\r\nexport class TransformConstraintData extends ConstraintData {\r\n\r\n\t/** The bones that will be modified by this transform constraint. */\r\n\tbones = new Array<BoneData>();\r\n\r\n\t/** The target bone whose world transform will be copied to the constrained bones. */\r\n\ttarget: BoneData;\r\n\r\n\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */\r\n\trotateMix = 0;\r\n\r\n\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained translations. */\r\n\ttranslateMix = 0;\r\n\r\n\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained scales. */\r\n\tscaleMix = 0;\r\n\r\n\t/** A percentage (0-1) that controls the mix between the constrained and unconstrained shears. */\r\n\tshearMix = 0;\r\n\r\n\t/** An offset added to the constrained bone rotation. */\r\n\toffsetRotation = 0;\r\n\r\n\t/** An offset added to the constrained bone X translation. */\r\n\toffsetX = 0;\r\n\r\n\t/** An offset added to the constrained bone Y translation. */\r\n\toffsetY = 0;\r\n\r\n\t/** An offset added to the constrained bone scaleX. */\r\n\toffsetScaleX = 0;\r\n\r\n\t/** An offset added to the constrained bone scaleY. */\r\n\toffsetScaleY = 0;\r\n\r\n\t/** An offset added to the constrained bone shearY. */\r\n\toffsetShearY = 0;\r\n\r\n\trelative = false;\r\n\tlocal = false;\r\n\r\n\tconstructor (name: string) {\r\n\t\tsuper(name, 0, false);\r\n\t}\r\n}\r\n","\r\n\r\nimport { Attachment } from \"./attachments/Attachment\";\r\nimport { BoneData } from \"./BoneData\";\r\nimport { ConstraintData } from \"./ConstraintData\";\r\nimport { Skeleton } from \"./Skeleton\";\r\nimport { MeshAttachment } from \"./attachments/MeshAttachment\";\r\nimport { Map } from './Utils'\r\n\r\n/** Stores an entry in the skin consisting of the slot index, name, and attachment **/\r\nexport class SkinEntry {\r\n\tconstructor(public slotIndex: number, public name: string, public attachment: Attachment) { }\r\n}\r\n\r\n/** Stores attachments by slot index and attachment name.\r\n *\r\n * See SkeletonData {@link SkeletonData#defaultSkin}, Skeleton {@link Skeleton#skin}, and\r\n * [Runtime skins](http://esotericsoftware.com/spine-runtime-skins) in the Spine Runtimes Guide. */\r\nexport class Skin {\r\n\t/** The skin's name, which is unique across all skins in the skeleton. */\r\n\tname: string;\r\n\r\n\tattachments = new Array<Map<Attachment>>();\r\n\tbones = Array<BoneData>();\r\n\tconstraints = new Array<ConstraintData>();\r\n\r\n\tconstructor (name: string) {\r\n\t\tif (name == null) throw new Error(\"name cannot be null.\");\r\n\t\tthis.name = name;\r\n\t}\r\n\r\n\t/** Adds an attachment to the skin for the specified slot index and name. */\r\n\tsetAttachment (slotIndex: number, name: string, attachment: Attachment) {\r\n\t\tif (attachment == null) throw new Error(\"attachment cannot be null.\");\r\n\t\tlet attachments = this.attachments;\r\n\t\tif (slotIndex >= attachments.length) attachments.length = slotIndex + 1;\r\n\t\tif (!attachments[slotIndex]) attachments[slotIndex] = { };\r\n\t\tattachments[slotIndex][name] = attachment;\r\n\t}\r\n\r\n\t/** Adds all attachments, bones, and constraints from the specified skin to this skin. */\r\n\taddSkin (skin: Skin) {\r\n\t\tfor(let i = 0; i < skin.bones.length; i++) {\r\n\t\t\tlet bone = skin.bones[i];\r\n\t\t\tlet contained = false;\r\n\t\t\tfor (let j = 0; j < this.bones.length; j++) {\r\n\t\t\t\tif (this.bones[j] == bone) {\r\n\t\t\t\t\tcontained = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (!contained) this.bones.push(bone);\r\n\t\t}\r\n\r\n\t\tfor(let i = 0; i < skin.constraints.length; i++) {\r\n\t\t\tlet constraint = skin.constraints[i];\r\n\t\t\tlet contained = false;\r\n\t\t\tfor (let j = 0; j < this.constraints.length; j++) {\r\n\t\t\t\tif (this.constraints[j] == constraint) {\r\n\t\t\t\t\tcontained = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (!contained) this.constraints.push(constraint);\r\n\t\t}\r\n\r\n\t\tlet attachments = skin.getAttachments();\r\n\t\tfor (let i = 0; i < attachments.length; i++) {\r\n\t\t\tvar attachment = attachments[i];\r\n\t\t\tthis.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);\r\n\t\t}\r\n\t}\r\n\r\n\t/** Adds all bones and constraints and copies of all attachments from the specified skin to this skin. Mesh attachments are not\r\n\t * copied, instead a new linked mesh is created. The attachment copies can be modified without affecting the originals. */\r\n\tcopySkin (skin: Skin) {\r\n\t\tfor(let i = 0; i < skin.bones.length; i++) {\r\n\t\t\tlet bone = skin.bones[i];\r\n\t\t\tlet contained = false;\r\n\t\t\tfor (let j = 0; j < this.bones.length; j++) {\r\n\t\t\t\tif (this.bones[j] == bone) {\r\n\t\t\t\t\tcontained = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (!contained) this.bones.push(bone);\r\n\t\t}\r\n\r\n\t\tfor(let i = 0; i < skin.constraints.length; i++) {\r\n\t\t\tlet constraint = skin.constraints[i];\r\n\t\t\tlet contained = false;\r\n\t\t\tfor (let j = 0; j < this.constraints.length; j++) {\r\n\t\t\t\tif (this.constraints[j] == constraint) {\r\n\t\t\t\t\tcontained = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (!contained) this.constraints.push(constraint);\r\n\t\t}\r\n\r\n\t\tlet attachments = skin.getAttachments();\r\n\t\tfor (let i = 0; i < attachments.length; i++) {\r\n\t\t\tvar attachment = attachments[i];\r\n\t\t\tif (attachment.attachment == null) continue;\r\n\t\t\tif (attachment.attachment instanceof MeshAttachment) {\r\n\t\t\t\tattachment.attachment = attachment.attachment.newLinkedMesh();\r\n\t\t\t\tthis.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);\r\n\t\t\t} else {\r\n\t\t\t\tattachment.attachment = attachment.attachment.copy();\r\n\t\t\t\tthis.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/** Returns the attachment for the specified slot index and name, or null. */\r\n\tgetAttachment (slotIndex: number, name: string): Attachment {\r\n\t\tlet dictionary = this.attachments[slotIndex];\r\n\t\treturn dictionary ? dictionary[name] : null;\r\n\t}\r\n\r\n\t/** Removes the attachment in the skin for the specified slot index and name, if any. */\r\n\tremoveAttachment (slotIndex: number, name: string) {\r\n\t\tlet dictionary = this.attachments[slotIndex];\r\n\t\tif (dictionary) dictionary[name] = null;\r\n\t}\r\n\r\n\t/** Returns all attachments in this skin. */\r\n\tgetAttachments (): Array<SkinEntry> {\r\n\t\tlet entries = new Array<SkinEntry>();\r\n\t\tfor (var i = 0; i < this.attachments.length; i++) {\r\n\t\t\tlet slotAttachments = this.attachments[i];\r\n\t\t\tif (slotAttachments) {\r\n\t\t\t\tfor (let name in slotAttachments) {\r\n\t\t\t\t\tlet attachment = slotAttachments[name];\r\n\t\t\t\t\tif (attachment) entries.push(new SkinEntry(i, name, attachment));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn entries;\r\n\t}\r\n\r\n\t/** Returns all attachments in this skin for the specified slot index. */\r\n\tgetAttachmentsForSlot (slotIndex: number, attachments: Array<SkinEntry>) {\r\n\t\tlet slotAttachments = this.attachments[slotIndex];\r\n\t\tif (slotAttachments) {\r\n\t\t\tfor (let name in slotAttachments) {\r\n\t\t\t\tlet attachment = slotAttachments[name];\r\n\t\t\t\tif (attachment) attachments.push(new SkinEntry(slotIndex, name, attachment));\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/** Clears all attachments, bones, and constraints. */\r\n\tclear () {\r\n\t\tthis.attachments.length = 0;\r\n\t\tthis.bones.length = 0;\r\n\t\tthis.constraints.length = 0;\r\n\t}\r\n\r\n\t/** Attach each attachment in this skin if the corresponding attachment in the old skin is currently attached. */\r\n\tattachAll (skeleton: Skeleton, oldSkin: Skin) {\r\n\t\tlet slotIndex = 0;\r\n\t\tfor (let i = 0; i < skeleton.slots.length; i++) {\r\n\t\t\tlet slot = skeleton.slots[i];\r\n\t\t\tlet slotAttachment = slot.getAttachment();\r\n\t\t\tif (slotAttachment && slotIndex < oldSkin.attachments.length) {\r\n\t\t\t\tlet dictionary = oldSkin.attachments[slotIndex];\r\n\t\t\t\tfor (let key in dictionary) {\r\n\t\t\t\t\tlet skinAttachment:Attachment = dictionary[key];\r\n\t\t\t\t\tif (slotAttachment == skinAttachment) {\r\n\t\t\t\t\t\tlet attachment = this.getAttachment(slotIndex, key);\r\n\t\t\t\t\t\tif (attachment != null) slot.setAttachment(attachment);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tslotIndex++;\r\n\t\t}\r\n\t}\r\n}\r\n","\r\n\r\n\r\n\t/** Stores the setup pose values for an {@link Event}.\r\n\t *\r\n\t * See [Events](http://esotericsoftware.com/spine-events) in the Spine User Guide. */\r\n\texport class EventData {\r\n\t\tname: string;\r\n\t\tintValue: number;\r\n\t\tfloatValue: number;\r\n\t\tstringValue: string;\r\n\t\taudioPath: string;\r\n\t\tvolume: number;\r\n\t\tbalance: number;\r\n\r\n\t\tconstructor (name: string) {\r\n\t\t\tthis.name = name;\r\n\t\t}\r\n\t}\r\n","\r\n\r\nimport { EventData } from \"./EventData\";\r\n\r\n\r\n\r\n/** Stores the current pose values for an {@link Event}.\r\n *\r\n * See Timeline {@link Timeline#apply()},\r\n * AnimationStateListener {@link AnimationStateListener#event()}, and\r\n * [Events](http://esotericsoftware.com/spine-events) in the Spine User Guide. */\r\nexport class Event {\r\n\tdata: EventData;\r\n\tintValue: number;\r\n\tfloatValue: number;\r\n\tstringValue: string;\r\n\ttime: number;\r\n\tvolume: number;\r\n\tbalance: number;\r\n\r\n\tconstructor (time: number, data: EventData) {\r\n\t\tif (data == null) throw new Error(\"data cannot be null.\");\r\n\t\tthis.time = time;\r\n\t\tthis.data = data;\r\n\t}\r\n}\r\n","\r\n\r\n\r\nexport enum AttachmentType {\r\n\tRegion, BoundingBox, Mesh, LinkedMesh, Path, Point, Clipping\r\n}\r\n","\r\n\r\nimport { AttachmentLoader } from \"./attachments/AttachmentLoader\";\r\nimport { SkeletonData } from \"./SkeletonData\";\r\nimport { BoneData, TransformMode } from \"./BoneData\";\r\nimport { SlotData } from \"./SlotData\";\r\nimport { Color, Utils, ArrayLike } from \"./Utils\";\r\nimport { IkConstraintData } from \"./IkConstraintData\";\r\nimport { TransformConstraintData } from \"./TransformConstraintData\";\r\nimport { PathConstraintData, PositionMode, SpacingMode, RotateMode } from \"./PathConstraintData\";\r\nimport { Skin } from \"./Skin\";\r\nimport { VertexAttachment, Attachment } from \"./attachments/Attachment\";\r\nimport { MeshAttachment } from \"./attachments/MeshAttachment\";\r\nimport { EventData } from \"./EventData\";\r\nimport { Timeline, AttachmentTimeline, ColorTimeline, TwoColorTimeline, RotateTimeline, TranslateTimeline, ScaleTimeline, ShearTimeline, IkConstraintTimeline, TransformConstraintTimeline, PathConstraintPositionTimeline, PathConstraintSpacingTimeline, PathConstraintMixTimeline, DeformTimeline, DrawOrderTimeline, EventTimeline, CurveTimeline } from \"./Animation\";\r\nimport { BlendMode } from \"./BlendMode\";\r\nimport { Event } from \"./Event\";\r\nimport { Animation } from \"./Animation\";\r\n\r\n/** Loads skeleton data in the Spine JSON format.\r\n *\r\n * See [Spine JSON format](http://esotericsoftware.com/spine-json-format) and\r\n * [JSON and binary data](http://esotericsoftware.com/spine-loading-skeleton-data#JSON-and-binary-data) in the Spine\r\n * Runtimes Guide. */\r\nexport class SkeletonJson {\r\n\tattachmentLoader: AttachmentLoader;\r\n\r\n\t/** Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at\r\n\t * runtime than were used in Spine.\r\n\t *\r\n\t * See [Scaling](http://esotericsoftware.com/spine-loading-skeleton-data#Scaling) in the Spine Runtimes Guide. */\r\n\tscale = 1;\r\n\tprivate linkedMeshes = new Array<LinkedMesh>();\r\n\r\n\tconstructor (attachmentLoader: AttachmentLoader) {\r\n\t\tthis.attachmentLoader = attachmentLoader;\r\n\t}\r\n\r\n\treadSkeletonData (json: string | any): SkeletonData {\r\n\t\tlet scale = this.scale;\r\n\t\tlet skeletonData = new SkeletonData();\r\n\t\tlet root = typeof(json) === \"string\" ? JSON.parse(json) : json;\r\n\r\n\t\t// Skeleton\r\n\t\tlet skeletonMap = root.skeleton;\r\n\t\tif (skeletonMap != null) {\r\n\t\t\tskeletonData.hash = skeletonMap.hash;\r\n\t\t\tskeletonData.version = skeletonMap.spine;\r\n\t\t\tif (\"3.8.75\" == skeletonData.version)\r\n\t\t\t\tthrow new Error(\"Unsupported skeleton data, please export with a newer version of Spine.\");\r\n\t\t\tskeletonData.x = skeletonMap.x;\r\n\t\t\tskeletonData.y = skeletonMap.y;\r\n\t\t\tskeletonData.width = skeletonMap.width;\r\n\t\t\tskeletonData.height = skeletonMap.height;\r\n\t\t\tskeletonData.fps = skeletonMap.fps;\r\n\t\t\tskeletonData.imagesPath = skeletonMap.images;\r\n\t\t}\r\n\r\n\t\t// Bones\r\n\t\tif (root.bones) {\r\n\t\t\tfor (let i = 0; i < root.bones.length; i++) {\r\n\t\t\t\tlet boneMap = root.bones[i];\r\n\r\n\t\t\t\tlet parent: BoneData = null;\r\n\t\t\t\tlet parentName: string = this.getValue(boneMap, \"parent\", null);\r\n\t\t\t\tif (parentName != null) {\r\n\t\t\t\t\tparent = skeletonData.findBone(parentName);\r\n\t\t\t\t\tif (parent == null) throw new Error(\"Parent bone not found: \" + parentName);\r\n\t\t\t\t}\r\n\t\t\t\tlet data = new BoneData(skeletonData.bones.length, boneMap.name, parent);\r\n\t\t\t\tdata.length = this.getValue(boneMap, \"length\", 0) * scale;\r\n\t\t\t\tdata.x = this.getValue(boneMap, \"x\", 0) * scale;\r\n\t\t\t\tdata.y = this.getValue(boneMap, \"y\", 0) * scale;\r\n\t\t\t\tdata.rotation = this.getValue(boneMap, \"rotation\", 0);\r\n\t\t\t\tdata.scaleX = this.getValue(boneMap, \"scaleX\", 1);\r\n\t\t\t\tdata.scaleY = this.getValue(boneMap, \"scaleY\", 1);\r\n\t\t\t\tdata.shearX = this.getValue(boneMap, \"shearX\", 0);\r\n\t\t\t\tdata.shearY = this.getValue(boneMap, \"shearY\", 0);\r\n\t\t\t\tdata.transformMode = SkeletonJson.transformModeFromString(this.getValue(boneMap, \"transform\", \"normal\"));\r\n\t\t\t\tdata.skinRequired = this.getValue(boneMap, \"skin\", false);\r\n\r\n\t\t\t\tskeletonData.bones.push(data);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Slots.\r\n\t\tif (root.slots) {\r\n\t\t\tfor (let i = 0; i < root.slots.length; i++) {\r\n\t\t\t\tlet slotMap = root.slots[i];\r\n\t\t\t\tlet slotName: string = slotMap.name;\r\n\t\t\t\tlet boneName: string = slotMap.bone;\r\n\t\t\t\tlet boneData = skeletonData.findBone(boneName);\r\n\t\t\t\tif (boneData == null) throw new Error(\"Slot bone not found: \" + boneName);\r\n\t\t\t\tlet data = new SlotData(skeletonData.slots.length, slotName, boneData);\r\n\r\n\t\t\t\tlet color: string = this.getValue(slotMap, \"color\", null);\r\n\t\t\t\tif (color != null) data.color.setFromString(color);\r\n\r\n\t\t\t\tlet dark: string = this.getValue(slotMap, \"dark\", null);\r\n\t\t\t\tif (dark != null) {\r\n\t\t\t\t\tdata.darkColor = new Color(1, 1, 1, 1);\r\n\t\t\t\t\tdata.darkColor.setFromString(dark);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tdata.attachmentName = this.getValue(slotMap, \"attachment\", null);\r\n\t\t\t\tdata.blendMode = SkeletonJson.blendModeFromString(this.getValue(slotMap, \"blend\", \"normal\"));\r\n\t\t\t\tskeletonData.slots.push(data);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// IK constraints\r\n\t\tif (root.ik) {\r\n\t\t\tfor (let i = 0; i < root.ik.length; i++) {\r\n\t\t\t\tlet constraintMap = root.ik[i];\r\n\t\t\t\tlet data = new IkConstraintData(constraintMap.name);\r\n\t\t\t\tdata.order = this.getValue(constraintMap, \"order\", 0);\r\n\t\t\t\tdata.skinRequired = this.getValue(constraintMap, \"skin\", false);\r\n\r\n\t\t\t\tfor (let j = 0; j < constraintMap.bones.length; j++) {\r\n\t\t\t\t\tlet boneName = constraintMap.bones[j];\r\n\t\t\t\t\tlet bone = skeletonData.findBone(boneName);\r\n\t\t\t\t\tif (bone == null) throw new Error(\"IK bone not found: \" + boneName);\r\n\t\t\t\t\tdata.bones.push(bone);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlet targetName: string = constraintMap.target;\r\n\t\t\t\tdata.target = skeletonData.findBone(targetName);\r\n\t\t\t\tif (data.target == null) throw new Error(\"IK target bone not found: \" + targetName);\r\n\r\n\t\t\t\tdata.mix = this.getValue(constraintMap, \"mix\", 1);\r\n\t\t\t\tdata.softness = this.getValue(constraintMap, \"softness\", 0) * scale;\r\n\t\t\t\tdata.bendDirection = this.getValue(constraintMap, \"bendPositive\", true) ? 1 : -1;\r\n\t\t\t\tdata.compress = this.getValue(constraintMap, \"compress\", false);\r\n\t\t\t\tdata.stretch = this.getValue(constraintMap, \"stretch\", false);\r\n\t\t\t\tdata.uniform = this.getValue(constraintMap, \"uniform\", false);\r\n\r\n\t\t\t\tskeletonData.ikConstraints.push(data);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Transform constraints.\r\n\t\tif (root.transform) {\r\n\t\t\tfor (let i = 0; i < root.transform.length; i++) {\r\n\t\t\t\tlet constraintMap = root.transform[i];\r\n\t\t\t\tlet data = new TransformConstraintData(constraintMap.name);\r\n\t\t\t\tdata.order = this.getValue(constraintMap, \"order\", 0);\r\n\t\t\t\tdata.skinRequired = this.getValue(constraintMap, \"skin\", false);\r\n\r\n\t\t\t\tfor (let j = 0; j < constraintMap.bones.length; j++) {\r\n\t\t\t\t\tlet boneName = constraintMap.bones[j];\r\n\t\t\t\t\tlet bone = skeletonData.findBone(boneName);\r\n\t\t\t\t\tif (bone == null) throw new Error(\"Transform constraint bone not found: \" + boneName);\r\n\t\t\t\t\tdata.bones.push(bone);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlet targetName: string = constraintMap.target;\r\n\t\t\t\tdata.target = skeletonData.findBone(targetName);\r\n\t\t\t\tif (data.target == null) throw new Error(\"Transform constraint target bone not found: \" + targetName);\r\n\r\n\t\t\t\tdata.local = this.getValue(constraintMap, \"local\", false);\r\n\t\t\t\tdata.relative = this.getValue(constraintMap, \"relative\", false);\r\n\t\t\t\tdata.offsetRotation = this.getValue(constraintMap, \"rotation\", 0);\r\n\t\t\t\tdata.offsetX = this.getValue(constraintMap, \"x\", 0) * scale;\r\n\t\t\t\tdata.offsetY = this.getValue(constraintMap, \"y\", 0) * scale;\r\n\t\t\t\tdata.offsetScaleX = this.getValue(constraintMap, \"scaleX\", 0);\r\n\t\t\t\tdata.offsetScaleY = this.getValue(constraintMap, \"scaleY\", 0);\r\n\t\t\t\tdata.offsetShearY = this.getValue(constraintMap, \"shearY\", 0);\r\n\r\n\t\t\t\tdata.rotateMix = this.getValue(constraintMap, \"rotateMix\", 1);\r\n\t\t\t\tdata.translateMix = this.getValue(constraintMap, \"translateMix\", 1);\r\n\t\t\t\tdata.scaleMix = this.getValue(constraintMap, \"scaleMix\", 1);\r\n\t\t\t\tdata.shearMix = this.getValue(constraintMap, \"shearMix\", 1);\r\n\r\n\t\t\t\tskeletonData.transformConstraints.push(data);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Path constraints.\r\n\t\tif (root.path) {\r\n\t\t\tfor (let i = 0; i < root.path.length; i++) {\r\n\t\t\t\tlet constraintMap = root.path[i];\r\n\t\t\t\tlet data = new PathConstraintData(constraintMap.name);\r\n\t\t\t\tdata.order = this.getValue(constraintMap, \"order\", 0);\r\n\t\t\t\tdata.skinRequired = this.getValue(constraintMap, \"skin\", false);\r\n\r\n\t\t\t\tfor (let j = 0; j < constraintMap.bones.length; j++) {\r\n\t\t\t\t\tlet boneName = constraintMap.bones[j];\r\n\t\t\t\t\tlet bone = skeletonData.findBone(boneName);\r\n\t\t\t\t\tif (bone == null) throw new Error(\"Transform constraint bone not found: \" + boneName);\r\n\t\t\t\t\tdata.bones.push(bone);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlet targetName: string = constraintMap.target;\r\n\t\t\t\tdata.target = skeletonData.findSlot(targetName);\r\n\t\t\t\tif (data.target == null) throw new Error(\"Path target slot not found: \" + targetName);\r\n\r\n\t\t\t\tdata.positionMode = SkeletonJson.positionModeFromString(this.getValue(constraintMap, \"positionMode\", \"percent\"));\r\n\t\t\t\tdata.spacingMode = SkeletonJson.spacingModeFromString(this.getValue(constraintMap, \"spacingMode\", \"length\"));\r\n\t\t\t\tdata.rotateMode = SkeletonJson.rotateModeFromString(this.getValue(constraintMap, \"rotateMode\", \"tangent\"));\r\n\t\t\t\tdata.offsetRotation = this.getValue(constraintMap, \"rotation\", 0);\r\n\t\t\t\tdata.position = this.getValue(constraintMap, \"position\", 0);\r\n\t\t\t\tif (data.positionMode == PositionMode.Fixed) data.position *= scale;\r\n\t\t\t\tdata.spacing = this.getValue(constraintMap, \"spacing\", 0);\r\n\t\t\t\tif (data.spacingMode == SpacingMode.Length || data.spacingMode == SpacingMode.Fixed) data.spacing *= scale;\r\n\t\t\t\tdata.rotateMix = this.getValue(constraintMap, \"rotateMix\", 1);\r\n\t\t\t\tdata.translateMix = this.getValue(constraintMap, \"translateMix\", 1);\r\n\r\n\t\t\t\tskeletonData.pathConstraints.push(data);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Skins.\r\n\t\tif (root.skins) {\r\n\t\t\tfor (let i = 0; i < root.skins.length; i++) {\r\n\t\t\t\tlet skinMap = root.skins[i]\r\n\t\t\t\tlet skin = new Skin(skinMap.name);\r\n\r\n\t\t\t\tif (skinMap.bones) {\r\n\t\t\t\t\tfor (let ii = 0; ii < skinMap.bones.length; ii++) {\r\n\t\t\t\t\t\tlet bone = skeletonData.findBone(skinMap.bones[ii]);\r\n\t\t\t\t\t\tif (bone == null) throw new Error(\"Skin bone not found: \" + skinMap.bones[i]);\r\n\t\t\t\t\t\tskin.bones.push(bone);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (skinMap.ik) {\r\n\t\t\t\t\tfor (let ii = 0; ii < skinMap.ik.length; ii++) {\r\n\t\t\t\t\t\tlet constraint = skeletonData.findIkConstraint(skinMap.ik[ii]);\r\n\t\t\t\t\t\tif (constraint == null) throw new Error(\"Skin IK constraint not found: \" + skinMap.ik[i]);\r\n\t\t\t\t\t\tskin.constraints.push(constraint);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (skinMap.transform) {\r\n\t\t\t\t\tfor (let ii = 0; ii < skinMap.transform.length; ii++) {\r\n\t\t\t\t\t\tlet constraint = skeletonData.findTransformConstraint(skinMap.transform[ii]);\r\n\t\t\t\t\t\tif (constraint == null) throw new Error(\"Skin transform constraint not found: \" + skinMap.transform[i]);\r\n\t\t\t\t\t\tskin.constraints.push(constraint);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (skinMap.path) {\r\n\t\t\t\t\tfor (let ii = 0; ii < skinMap.path.length; ii++) {\r\n\t\t\t\t\t\tlet constraint = skeletonData.findPathConstraint(skinMap.path[ii]);\r\n\t\t\t\t\t\tif (constraint == null) throw new Error(\"Skin path constraint not found: \" + skinMap.path[i]);\r\n\t\t\t\t\t\tskin.constraints.push(constraint);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor (let slotName in skinMap.attachments) {\r\n\t\t\t\t\tlet slot = skeletonData.findSlot(slotName);\r\n\t\t\t\t\tif (slot == null) throw new Error(\"Slot not found: \" + slotName);\r\n\t\t\t\t\tlet slotMap = skinMap.attachments[slotName];\r\n\t\t\t\t\tfor (let entryName in slotMap) {\r\n\t\t\t\t\t\tlet attachment = this.readAttachment(slotMap[entryName], skin, slot.index, entryName, skeletonData);\r\n\t\t\t\t\t\tif (attachment != null) skin.setAttachment(slot.index, entryName, attachment);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tskeletonData.skins.push(skin);\r\n\t\t\t\tif (skin.name == \"default\") skeletonData.defaultSkin = skin;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Linked meshes.\r\n\t\tfor (let i = 0, n = this.linkedMeshes.length; i < n; i++) {\r\n\t\t\tlet linkedMesh = this.linkedMeshes[i];\r\n\t\t\tlet skin = linkedMesh.skin == null ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);\r\n\t\t\tif (skin == null) throw new Error(\"Skin not found: \" + linkedMesh.skin);\r\n\t\t\tlet parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);\r\n\t\t\tif (parent == null) throw new Error(\"Parent mesh not found: \" + linkedMesh.parent);\r\n\t\t\tlinkedMesh.mesh.deformAttachment = linkedMesh.inheritDeform ? <VertexAttachment>parent : <VertexAttachment>linkedMesh.mesh;\r\n\t\t\tlinkedMesh.mesh.setParentMesh(<MeshAttachment> parent);\r\n\t\t\tlinkedMesh.mesh.updateUVs();\r\n\t\t}\r\n\t\tthis.linkedMeshes.length = 0;\r\n\r\n\t\t// Events.\r\n\t\tif (root.events) {\r\n\t\t\tfor (let eventName in root.events) {\r\n\t\t\t\tlet eventMap = root.events[eventName];\r\n\t\t\t\tlet data = new EventData(eventName);\r\n\t\t\t\tdata.intValue = this.getValue(eventMap, \"int\", 0);\r\n\t\t\t\tdata.floatValue = this.getValue(eventMap, \"float\", 0);\r\n\t\t\t\tdata.stringValue = this.getValue(eventMap, \"string\", \"\");\r\n\t\t\t\tdata.audioPath = this.getValue(eventMap, \"audio\", null);\r\n\t\t\t\tif (data.audioPath != null) {\r\n\t\t\t\t\tdata.volume = this.getValue(eventMap, \"volume\", 1);\r\n\t\t\t\t\tdata.balance = this.getValue(eventMap, \"balance\", 0);\r\n\t\t\t\t}\r\n\t\t\t\tskeletonData.events.push(data);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Animations.\r\n\t\tif (root.animations) {\r\n\t\t\tfor (let animationName in root.animations) {\r\n\t\t\t\tlet animationMap = root.animations[animationName];\r\n\t\t\t\tthis.readAnimation(animationMap, animationName, skeletonData);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn skeletonData;\r\n\t}\r\n\r\n\treadAttachment (map: any, skin: Skin, slotIndex: number, name: string, skeletonData: SkeletonData): Attachment {\r\n\t\tlet scale = this.scale;\r\n\t\tname = this.getValue(map, \"name\", name);\r\n\r\n\t\tlet type = this.getValue(map, \"type\", \"region\");\r\n\r\n\t\tswitch (type) {\r\n\t\t\tcase \"region\": {\r\n\t\t\t\tlet path = this.getValue(map, \"path\", name);\r\n\t\t\t\tlet region = this.attachmentLoader.newRegionAttachment(skin, name, path);\r\n\t\t\t\tif (region == null) return null;\r\n\t\t\t\tregion.path = path;\r\n\t\t\t\tregion.x = this.getValue(map, \"x\", 0) * scale;\r\n\t\t\t\tregion.y = this.getValue(map, \"y\", 0) * scale;\r\n\t\t\t\tregion.scaleX = this.getValue(map, \"scaleX\", 1);\r\n\t\t\t\tregion.scaleY = this.getValue(map, \"scaleY\", 1);\r\n\t\t\t\tregion.rotation = this.getValue(map, \"rotation\", 0);\r\n\t\t\t\tregion.width = map.width * scale;\r\n\t\t\t\tregion.height = map.height * scale;\r\n\r\n\t\t\t\tlet color: string = this.getValue(map, \"color\", null);\r\n\t\t\t\tif (color != null) region.color.setFromString(color);\r\n\r\n\t\t\t\tregion.updateOffset();\r\n\t\t\t\treturn region;\r\n\t\t\t}\r\n\t\t\tcase \"boundingbox\": {\r\n\t\t\t\tlet box = this.attachmentLoader.newBoundingBoxAttachment(skin, name);\r\n\t\t\t\tif (box == null) return null;\r\n\t\t\t\tthis.readVertices(map, box, map.vertexCount << 1);\r\n\t\t\t\tlet color: string = this.getValue(map, \"color\", null);\r\n\t\t\t\tif (color != null) box.color.setFromString(color);\r\n\t\t\t\treturn box;\r\n\t\t\t}\r\n\t\t\tcase \"mesh\":\r\n\t\t\tcase \"linkedmesh\": {\r\n\t\t\t\tlet path = this.getValue(map, \"path\", name);\r\n\t\t\t\tlet mesh = this.attachmentLoader.newMeshAttachment(skin, name, path);\r\n\t\t\t\tif (mesh == null) return null;\r\n\t\t\t\tmesh.path = path;\r\n\r\n\t\t\t\tlet color = this.getValue(map, \"color\", null);\r\n\t\t\t\tif (color != null) mesh.color.setFromString(color);\r\n\r\n\t\t\t\tmesh.width = this.getValue(map, \"width\", 0) * scale;\r\n\t\t\t\tmesh.height = this.getValue(map, \"height\", 0) * scale;\r\n\r\n\t\t\t\tlet parent: string = this.getValue(map, \"parent\", null);\r\n\t\t\t\tif (parent != null) {\r\n\t\t\t\t\tthis.linkedMeshes.push(new LinkedMesh(mesh, <string> this.getValue(map, \"skin\", null), slotIndex, parent, this.getValue(map, \"deform\", true)));\r\n\t\t\t\t\treturn mesh;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlet uvs: Array<number> = map.uvs;\r\n\t\t\t\tthis.readVertices(map, mesh, uvs.length);\r\n\t\t\t\tmesh.triangles = map.triangles;\r\n\t\t\t\tmesh.regionUVs = uvs;\r\n\t\t\t\tmesh.updateUVs();\r\n\r\n\t\t\t\tmesh.edges = this.getValue(map, \"edges\", null);\r\n\t\t\t\tmesh.hullLength = this.getValue(map, \"hull\", 0) * 2;\r\n\t\t\t\treturn mesh;\r\n\t\t\t}\r\n\t\t\tcase \"path\": {\r\n\t\t\t\tlet path = this.attachmentLoader.newPathAttachment(skin, name);\r\n\t\t\t\tif (path == null) return null;\r\n\t\t\t\tpath.closed = this.getValue(map, \"closed\", false);\r\n\t\t\t\tpath.constantSpeed = this.getValue(map, \"constantSpeed\", true);\r\n\r\n\t\t\t\tlet vertexCount = map.vertexCount;\r\n\t\t\t\tthis.readVertices(map, path, vertexCount << 1);\r\n\r\n\t\t\t\tlet lengths: Array<number> = Utils.newArray(vertexCount / 3, 0);\r\n\t\t\t\tfor (let i = 0; i < map.lengths.length; i++)\r\n\t\t\t\t\tlengths[i] = map.lengths[i] * scale;\r\n\t\t\t\tpath.lengths = lengths;\r\n\r\n\t\t\t\tlet color: string = this.getValue(map, \"color\", null);\r\n\t\t\t\tif (color != null) path.color.setFromString(color);\r\n\t\t\t\treturn path;\r\n\t\t\t}\r\n\t\t\tcase \"point\": {\r\n\t\t\t\tlet point = this.attachmentLoader.newPointAttachment(skin, name);\r\n\t\t\t\tif (point == null) return null;\r\n\t\t\t\tpoint.x = this.getValue(map, \"x\", 0) * scale;\r\n\t\t\t\tpoint.y = this.getValue(map, \"y\", 0) * scale;\r\n\t\t\t\tpoint.rotation = this.getValue(map, \"rotation\", 0);\r\n\r\n\t\t\t\tlet color = this.getValue(map, \"color\", null);\r\n\t\t\t\tif (color != null) point.color.setFromString(color);\r\n\t\t\t\treturn point;\r\n\t\t\t}\r\n\t\t\tcase \"clipping\": {\r\n\t\t\t\tlet clip = this.attachmentLoader.newClippingAttachment(skin, name);\r\n\t\t\t\tif (clip == null) return null;\r\n\r\n\t\t\t\tlet end = this.getValue(map, \"end\", null);\r\n\t\t\t\tif (end != null) {\r\n\t\t\t\t\tlet slot = skeletonData.findSlot(end);\r\n\t\t\t\t\tif (slot == null) throw new Error(\"Clipping end slot not found: \" + end);\r\n\t\t\t\t\tclip.endSlot = slot;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlet vertexCount = map.vertexCount;\r\n\t\t\t\tthis.readVertices(map, clip, vertexCount << 1);\r\n\r\n\t\t\t\tlet color: string = this.getValue(map, \"color\", null);\r\n\t\t\t\tif (color != null) clip.color.setFromString(color);\r\n\t\t\t\treturn clip;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\treadVertices (map: any, attachment: VertexAttachment, verticesLength: number) {\r\n\t\tlet scale = this.scale;\r\n\t\tattachment.worldVerticesLength = verticesLength;\r\n\t\tlet vertices: Array<number> = map.vertices;\r\n\t\tif (verticesLength == vertices.length) {\r\n\t\t\tlet scaledVertices = Utils.toFloatArray(vertices);\r\n\t\t\tif (scale != 1) {\r\n\t\t\t\tfor (let i = 0, n = vertices.length; i < n; i++)\r\n\t\t\t\t\tscaledVertices[i] *= scale;\r\n\t\t\t}\r\n\t\t\tattachment.vertices = scaledVertices;\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tlet weights = new Array<number>();\r\n\t\tlet bones = new Array<number>();\r\n\t\tfor (let i = 0, n = vertices.length; i < n;) {\r\n\t\t\tlet boneCount = vertices[i++];\r\n\t\t\tbones.push(boneCount);\r\n\t\t\tfor (let nn = i + boneCount * 4; i < nn; i += 4) {\r\n\t\t\t\tbones.push(vertices[i]);\r\n\t\t\t\tweights.push(vertices[i + 1] * scale);\r\n\t\t\t\tweights.push(vertices[i + 2] * scale);\r\n\t\t\t\tweights.push(vertices[i + 3]);\r\n\t\t\t}\r\n\t\t}\r\n\t\tattachment.bones = bones;\r\n\t\tattachment.vertices = Utils.toFloatArray(weights);\r\n\t}\r\n\r\n\treadAnimation (map: any, name: string, skeletonData: SkeletonData) {\r\n\t\tlet scale = this.scale;\r\n\t\tlet timelines = new Array<Timeline>();\r\n\t\tlet duration = 0;\r\n\r\n\t\t// Slot timelines.\r\n\t\tif (map.slots) {\r\n\t\t\tfor (let slotName in map.slots) {\r\n\t\t\t\tlet slotMap = map.slots[slotName];\r\n\t\t\t\tlet slotIndex = skeletonData.findSlotIndex(slotName);\r\n\t\t\t\tif (slotIndex == -1) throw new Error(\"Slot not found: \" + slotName);\r\n\t\t\t\tfor (let timelineName in slotMap) {\r\n\t\t\t\t\tlet timelineMap = slotMap[timelineName];\r\n\t\t\t\t\tif (timelineName == \"attachment\") {\r\n\t\t\t\t\t\tlet timeline = new AttachmentTimeline(timelineMap.length);\r\n\t\t\t\t\t\ttimeline.slotIndex = slotIndex;\r\n\r\n\t\t\t\t\t\tlet frameIndex = 0;\r\n\t\t\t\t\t\tfor (let i = 0; i < timelineMap.length; i++) {\r\n\t\t\t\t\t\t\tlet valueMap = timelineMap[i];\r\n\t\t\t\t\t\t\ttimeline.setFrame(frameIndex++, this.getValue(valueMap, \"time\", 0), valueMap.name);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttimelines.push(timeline);\r\n\t\t\t\t\t\tduration = Math.max(duration, timeline.frames[timeline.getFrameCount() - 1]);\r\n\t\t\t\t\t} else if (timelineName == \"color\") {\r\n\t\t\t\t\t\tlet timeline = new ColorTimeline(timelineMap.length);\r\n\t\t\t\t\t\ttimeline.slotIndex = slotIndex;\r\n\r\n\t\t\t\t\t\tlet frameIndex = 0;\r\n\t\t\t\t\t\tfor (let i = 0; i < timelineMap.length; i++) {\r\n\t\t\t\t\t\t\tlet valueMap = timelineMap[i];\r\n\t\t\t\t\t\t\tlet color = new Color();\r\n\t\t\t\t\t\t\tcolor.setFromString(valueMap.color);\r\n\t\t\t\t\t\t\ttimeline.setFrame(frameIndex, this.getValue(valueMap, \"time\", 0), color.r, color.g, color.b, color.a);\r\n\t\t\t\t\t\t\tthis.readCurve(valueMap, timeline, frameIndex);\r\n\t\t\t\t\t\t\tframeIndex++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttimelines.push(timeline);\r\n\t\t\t\t\t\tduration = Math.max(duration, timeline.frames[(timeline.getFrameCount() - 1) * ColorTimeline.ENTRIES]);\r\n\r\n\t\t\t\t\t} else if (timelineName == \"twoColor\") {\r\n\t\t\t\t\t\tlet timeline = new TwoColorTimeline(timelineMap.length);\r\n\t\t\t\t\t\ttimeline.slotIndex = slotIndex;\r\n\r\n\t\t\t\t\t\tlet frameIndex = 0;\r\n\t\t\t\t\t\tfor (let i = 0; i < timelineMap.length; i++) {\r\n\t\t\t\t\t\t\tlet valueMap = timelineMap[i];\r\n\t\t\t\t\t\t\tlet light = new Color();\r\n\t\t\t\t\t\t\tlet dark = new Color();\r\n\t\t\t\t\t\t\tlight.setFromString(valueMap.light);\r\n\t\t\t\t\t\t\tdark.setFromString(valueMap.dark);\r\n\t\t\t\t\t\t\ttimeline.setFrame(frameIndex, this.getValue(valueMap, \"time\", 0), light.r, light.g, light.b, light.a, dark.r, dark.g, dark.b);\r\n\t\t\t\t\t\t\tthis.readCurve(valueMap, timeline, frameIndex);\r\n\t\t\t\t\t\t\tframeIndex++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttimelines.push(timeline);\r\n\t\t\t\t\t\tduration = Math.max(duration, timeline.frames[(timeline.getFrameCount() - 1) * TwoColorTimeline.ENTRIES]);\r\n\r\n\t\t\t\t\t} else\r\n\t\t\t\t\t\tthrow new Error(\"Invalid timeline type for a slot: \" + timelineName + \" (\" + slotName + \")\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Bone timelines.\r\n\t\tif (map.bones) {\r\n\t\t\tfor (let boneName in map.bones) {\r\n\t\t\t\tlet boneMap = map.bones[boneName];\r\n\t\t\t\tlet boneIndex = skeletonData.findBoneIndex(boneName);\r\n\t\t\t\tif (boneIndex == -1) throw new Error(\"Bone not found: \" + boneName);\r\n\t\t\t\tfor (let timelineName in boneMap) {\r\n\t\t\t\t\tlet timelineMap = boneMap[timelineName];\r\n\t\t\t\t\tif (timelineName === \"rotate\") {\r\n\t\t\t\t\t\tlet timeline = new RotateTimeline(timelineMap.length);\r\n\t\t\t\t\t\ttimeline.boneIndex = boneIndex;\r\n\r\n\t\t\t\t\t\tlet frameIndex = 0;\r\n\t\t\t\t\t\tfor (let i = 0; i < timelineMap.length; i++) {\r\n\t\t\t\t\t\t\tlet valueMap = timelineMap[i];\r\n\t\t\t\t\t\t\ttimeline.setFrame(frameIndex, this.getValue(valueMap, \"time\", 0), this.getValue(valueMap, \"angle\", 0));\r\n\t\t\t\t\t\t\tthis.readCurve(valueMap, timeline, frameIndex);\r\n\t\t\t\t\t\t\tframeIndex++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttimelines.push(timeline);\r\n\t\t\t\t\t\tduration = Math.max(duration, timeline.frames[(timeline.getFrameCount() - 1) * RotateTimeline.ENTRIES]);\r\n\r\n\t\t\t\t\t} else if (timelineName === \"translate\" || timelineName === \"scale\" || timelineName === \"shear\") {\r\n\t\t\t\t\t\tlet timeline: TranslateTimeline = null;\r\n\t\t\t\t\t\tlet timelineScale = 1, defaultValue = 0;\r\n\t\t\t\t\t\tif (timelineName === \"scale\") {\r\n\t\t\t\t\t\t\ttimeline = new ScaleTimeline(timelineMap.length);\r\n\t\t\t\t\t\t\tdefaultValue = 1;\r\n\t\t\t\t\t\t} else if (timelineName === \"shear\")\r\n\t\t\t\t\t\t\ttimeline = new ShearTimeline(timelineMap.length);\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\ttimeline = new TranslateTimeline(timelineMap.length);\r\n\t\t\t\t\t\t\ttimelineScale = scale;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttimeline.boneIndex = boneIndex;\r\n\r\n\t\t\t\t\t\tlet frameIndex = 0;\r\n\t\t\t\t\t\tfor (let i = 0; i < timelineMap.length; i++) {\r\n\t\t\t\t\t\t\tlet valueMap = timelineMap[i];\r\n\t\t\t\t\t\t\tlet x = this.getValue(valueMap, \"x\", defaultValue), y = this.getValue(valueMap, \"y\", defaultValue);\r\n\t\t\t\t\t\t\ttimeline.setFrame(frameIndex, this.getValue(valueMap, \"time\", 0), x * timelineScale, y * timelineScale);\r\n\t\t\t\t\t\t\tthis.readCurve(valueMap, timeline, frameIndex);\r\n\t\t\t\t\t\t\tframeIndex++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttimelines.push(timeline);\r\n\t\t\t\t\t\tduration = Math.max(duration, timeline.frames[(timeline.getFrameCount() - 1) * TranslateTimeline.ENTRIES]);\r\n\r\n\t\t\t\t\t} else\r\n\t\t\t\t\t\tthrow new Error(\"Invalid timeline type for a bone: \" + timelineName + \" (\" + boneName + \")\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// IK constraint timelines.\r\n\t\tif (map.ik) {\r\n\t\t\tfor (let constraintName in map.ik) {\r\n\t\t\t\tlet constraintMap = map.ik[constraintName];\r\n\t\t\t\tlet constraint = skeletonData.findIkConstraint(constraintName);\r\n\t\t\t\tlet timeline = new IkConstraintTimeline(constraintMap.length);\r\n\t\t\t\ttimeline.ikConstraintIndex = skeletonData.ikConstraints.indexOf(constraint);\r\n\t\t\t\tlet frameIndex = 0;\r\n\t\t\t\tfor (let i = 0; i < constraintMap.length; i++) {\r\n\t\t\t\t\tlet valueMap = constraintMap[i];\r\n\t\t\t\t\ttimeline.setFrame(frameIndex, this.getValue(valueMap, \"time\", 0), this.getValue(valueMap, \"mix\", 1), this.getValue(valueMap, \"softness\", 0) * scale,\r\n\t\t\t\t\t\tthis.getValue(valueMap, \"bendPositive\", true) ? 1 : -1, this.getValue(valueMap, \"compress\", false), this.getValue(valueMap, \"stretch\", false));\r\n\t\t\t\t\tthis.readCurve(valueMap, timeline, frameIndex);\r\n\t\t\t\t\tframeIndex++;\r\n\t\t\t\t}\r\n\t\t\t\ttimelines.push(timeline);\r\n\t\t\t\tduration = Math.max(duration, timeline.frames[(timeline.getFrameCount() - 1) * IkConstraintTimeline.ENTRIES]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Transform constraint timelines.\r\n\t\tif (map.transform) {\r\n\t\t\tfor (let constraintName in map.transform) {\r\n\t\t\t\tlet constraintMap = map.transform[constraintName];\r\n\t\t\t\tlet constraint = skeletonData.findTransformConstraint(constraintName);\r\n\t\t\t\tlet timeline = new TransformConstraintTimeline(constraintMap.length);\r\n\t\t\t\ttimeline.transformConstraintIndex = skeletonData.transformConstraints.indexOf(constraint);\r\n\t\t\t\tlet frameIndex = 0;\r\n\t\t\t\tfor (let i = 0; i < constraintMap.length; i++) {\r\n\t\t\t\t\tlet valueMap = constraintMap[i];\r\n\t\t\t\t\ttimeline.setFrame(frameIndex, this.getValue(valueMap, \"time\", 0), this.getValue(valueMap, \"rotateMix\", 1),\r\n\t\t\t\t\t\tthis.getValue(valueMap, \"translateMix\", 1), this.getValue(valueMap, \"scaleMix\", 1), this.getValue(valueMap, \"shearMix\", 1));\r\n\t\t\t\t\tthis.readCurve(valueMap, timeline, frameIndex);\r\n\t\t\t\t\tframeIndex++;\r\n\t\t\t\t}\r\n\t\t\t\ttimelines.push(timeline);\r\n\t\t\t\tduration = Math.max(duration,\r\n\t\t\t\t\ttimeline.frames[(timeline.getFrameCount() - 1) * TransformConstraintTimeline.ENTRIES]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Path constraint timelines.\r\n\t\tif (map.path) {\r\n\t\t\tfor (let constraintName in map.path) {\r\n\t\t\t\tlet constraintMap = map.path[constraintName];\r\n\t\t\t\tlet index = skeletonData.findPathConstraintIndex(constraintName);\r\n\t\t\t\tif (index == -1) throw new Error(\"Path constraint not found: \" + constraintName);\r\n\t\t\t\tlet data = skeletonData.pathConstraints[index];\r\n\t\t\t\tfor (let timelineName in constraintMap) {\r\n\t\t\t\t\tlet timelineMap = constraintMap[timelineName];\r\n\t\t\t\t\tif (timelineName === \"position\" || timelineName === \"spacing\") {\r\n\t\t\t\t\t\tlet timeline: PathConstraintPositionTimeline = null;\r\n\t\t\t\t\t\tlet timelineScale = 1;\r\n\t\t\t\t\t\tif (timelineName === \"spacing\") {\r\n\t\t\t\t\t\t\ttimeline = new PathConstraintSpacingTimeline(timelineMap.length);\r\n\t\t\t\t\t\t\tif (data.spacingMode == SpacingMode.Length || data.spacingMode == SpacingMode.Fixed) timelineScale = scale;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\ttimeline = new PathConstraintPositionTimeline(timelineMap.length);\r\n\t\t\t\t\t\t\tif (data.positionMode == PositionMode.Fixed) timelineScale = scale;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttimeline.pathConstraintIndex = index;\r\n\t\t\t\t\t\tlet frameIndex = 0;\r\n\t\t\t\t\t\tfor (let i = 0; i < timelineMap.length; i++) {\r\n\t\t\t\t\t\t\tlet valueMap = timelineMap[i];\r\n\t\t\t\t\t\t\ttimeline.setFrame(frameIndex, this.getValue(valueMap, \"time\", 0), this.getValue(valueMap, timelineName, 0) * timelineScale);\r\n\t\t\t\t\t\t\tthis.readCurve(valueMap, timeline, frameIndex);\r\n\t\t\t\t\t\t\tframeIndex++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttimelines.push(timeline);\r\n\t\t\t\t\t\tduration = Math.max(duration,\r\n\t\t\t\t\t\t\ttimeline.frames[(timeline.getFrameCount() - 1) * PathConstraintPositionTimeline.ENTRIES]);\r\n\t\t\t\t\t} else if (timelineName === \"mix\") {\r\n\t\t\t\t\t\tlet timeline = new PathConstraintMixTimeline(timelineMap.length);\r\n\t\t\t\t\t\ttimeline.pathConstraintIndex = index;\r\n\t\t\t\t\t\tlet frameIndex = 0;\r\n\t\t\t\t\t\tfor (let i = 0; i < timelineMap.length; i++) {\r\n\t\t\t\t\t\t\tlet valueMap = timelineMap[i];\r\n\t\t\t\t\t\t\ttimeline.setFrame(frameIndex, this.getValue(valueMap, \"time\", 0), this.getValue(valueMap, \"rotateMix\", 1),\r\n\t\t\t\t\t\t\t\tthis.getValue(valueMap, \"translateMix\", 1));\r\n\t\t\t\t\t\t\tthis.readCurve(valueMap, timeline, frameIndex);\r\n\t\t\t\t\t\t\tframeIndex++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttimelines.push(timeline);\r\n\t\t\t\t\t\tduration = Math.max(duration,\r\n\t\t\t\t\t\t\ttimeline.frames[(timeline.getFrameCount() - 1) * PathConstraintMixTimeline.ENTRIES]);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Deform timelines.\r\n\t\tif (map.deform) {\r\n\t\t\tfor (let deformName in map.deform) {\r\n\t\t\t\tlet deformMap = map.deform[deformName];\r\n\t\t\t\tlet skin = skeletonData.findSkin(deformName);\r\n\t\t\t\tif (skin == null) throw new Error(\"Skin not found: \" + deformName);\r\n\t\t\t\tfor (let slotName in deformMap) {\r\n\t\t\t\t\tlet slotMap = deformMap[slotName];\r\n\t\t\t\t\tlet slotIndex = skeletonData.findSlotIndex(slotName);\r\n\t\t\t\t\tif (slotIndex == -1) throw new Error(\"Slot not found: \" + slotMap.name);\r\n\t\t\t\t\tfor (let timelineName in slotMap) {\r\n\t\t\t\t\t\tlet timelineMap = slotMap[timelineName];\r\n\t\t\t\t\t\tlet attachment = <VertexAttachment>skin.getAttachment(slotIndex, timelineName);\r\n\t\t\t\t\t\tif (attachment == null) throw new Error(\"Deform attachment not found: \" + timelineMap.name);\r\n\t\t\t\t\t\tlet weighted = attachment.bones != null;\r\n\t\t\t\t\t\tlet vertices = attachment.vertices;\r\n\t\t\t\t\t\tlet deformLength = weighted ? vertices.length / 3 * 2 : vertices.length;\r\n\r\n\t\t\t\t\t\tlet timeline = new DeformTimeline(timelineMap.length);\r\n\t\t\t\t\t\ttimeline.slotIndex = slotIndex;\r\n\t\t\t\t\t\ttimeline.attachment = attachment;\r\n\r\n\t\t\t\t\t\tlet frameIndex = 0;\r\n\t\t\t\t\t\tfor (let j = 0; j < timelineMap.length; j++) {\r\n\t\t\t\t\t\t\tlet valueMap = timelineMap[j];\r\n\t\t\t\t\t\t\tlet deform: ArrayLike<number>;\r\n\t\t\t\t\t\t\tlet verticesValue: Array<Number> = this.getValue(valueMap, \"vertices\", null);\r\n\t\t\t\t\t\t\tif (verticesValue == null)\r\n\t\t\t\t\t\t\t\tdeform = weighted ? Utils.newFloatArray(deformLength) : vertices;\r\n\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\tdeform = Utils.newFloatArray(deformLength);\r\n\t\t\t\t\t\t\t\tlet start = <number>this.getValue(valueMap, \"offset\", 0);\r\n\t\t\t\t\t\t\t\tUtils.arrayCopy(verticesValue, 0, deform, start, verticesValue.length);\r\n\t\t\t\t\t\t\t\tif (scale != 1) {\r\n\t\t\t\t\t\t\t\t\tfor (let i = start, n = i + verticesValue.length; i < n; i++)\r\n\t\t\t\t\t\t\t\t\t\tdeform[i] *= scale;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tif (!weighted) {\r\n\t\t\t\t\t\t\t\t\tfor (let i = 0; i < deformLength; i++)\r\n\t\t\t\t\t\t\t\t\t\tdeform[i] += vertices[i];\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\ttimeline.setFrame(frameIndex, this.getValue(valueMap, \"time\", 0), deform);\r\n\t\t\t\t\t\t\tthis.readCurve(valueMap, timeline, frameIndex);\r\n\t\t\t\t\t\t\tframeIndex++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttimelines.push(timeline);\r\n\t\t\t\t\t\tduration = Math.max(duration, timeline.frames[timeline.getFrameCount() - 1]);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Draw order timeline.\r\n\t\tlet drawOrderNode = map.drawOrder;\r\n\t\tif (drawOrderNode == null) drawOrderNode = map.draworder;\r\n\t\tif (drawOrderNode != null) {\r\n\t\t\tlet timeline = new DrawOrderTimeline(drawOrderNode.length);\r\n\t\t\tlet slotCount = skeletonData.slots.length;\r\n\t\t\tlet frameIndex = 0;\r\n\t\t\tfor (let j = 0; j < drawOrderNode.length; j++) {\r\n\t\t\t\tlet drawOrderMap = drawOrderNode[j];\r\n\t\t\t\tlet drawOrder: Array<number> = null;\r\n\t\t\t\tlet offsets = this.getValue(drawOrderMap, \"offsets\", null);\r\n\t\t\t\tif (offsets != null) {\r\n\t\t\t\t\tdrawOrder = Utils.newArray<number>(slotCount, -1);\r\n\t\t\t\t\tlet unchanged = Utils.newArray<number>(slotCount - offsets.length, 0);\r\n\t\t\t\t\tlet originalIndex = 0, unchangedIndex = 0;\r\n\t\t\t\t\tfor (let i = 0; i < offsets.length; i++) {\r\n\t\t\t\t\t\tlet offsetMap = offsets[i];\r\n\t\t\t\t\t\tlet slotIndex = skeletonData.findSlotIndex(offsetMap.slot);\r\n\t\t\t\t\t\tif (slotIndex == -1) throw new Error(\"Slot not found: \" + offsetMap.slot);\r\n\t\t\t\t\t\t// Collect unchanged items.\r\n\t\t\t\t\t\twhile (originalIndex != slotIndex)\r\n\t\t\t\t\t\t\tunchanged[unchangedIndex++] = originalIndex++;\r\n\t\t\t\t\t\t// Set changed items.\r\n\t\t\t\t\t\tdrawOrder[originalIndex + offsetMap.offset] = originalIndex++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// Collect remaining unchanged items.\r\n\t\t\t\t\twhile (originalIndex < slotCount)\r\n\t\t\t\t\t\tunchanged[unchangedIndex++] = originalIndex++;\r\n\t\t\t\t\t// Fill in unchanged items.\r\n\t\t\t\t\tfor (let i = slotCount - 1; i >= 0; i--)\r\n\t\t\t\t\t\tif (drawOrder[i] == -1) drawOrder[i] = unchanged[--unchangedIndex];\r\n\t\t\t\t}\r\n\t\t\t\ttimeline.setFrame(frameIndex++, this.getValue(drawOrderMap, \"time\", 0), drawOrder);\r\n\t\t\t}\r\n\t\t\ttimelines.push(timeline);\r\n\t\t\tduration = Math.max(duration, timeline.frames[timeline.getFrameCount() - 1]);\r\n\t\t}\r\n\r\n\t\t// Event timeline.\r\n\t\tif (map.events) {\r\n\t\t\tlet timeline = new EventTimeline(map.events.length);\r\n\t\t\tlet frameIndex = 0;\r\n\t\t\tfor (let i = 0; i < map.events.length; i++) {\r\n\t\t\t\tlet eventMap = map.events[i];\r\n\t\t\t\tlet eventData = skeletonData.findEvent(eventMap.name);\r\n\t\t\t\tif (eventData == null) throw new Error(\"Event not found: \" + eventMap.name);\r\n\t\t\t\tlet event = new Event(Utils.toSinglePrecision(this.getValue(eventMap, \"time\", 0)), eventData);\r\n\t\t\t\tevent.intValue = this.getValue(eventMap, \"int\", eventData.intValue);\r\n\t\t\t\tevent.floatValue = this.getValue(eventMap, \"float\", eventData.floatValue);\r\n\t\t\t\tevent.stringValue = this.getValue(eventMap, \"string\", eventData.stringValue);\r\n\t\t\t\tif (event.data.audioPath != null) {\r\n\t\t\t\t\tevent.volume = this.getValue(eventMap, \"volume\", 1);\r\n\t\t\t\t\tevent.balance = this.getValue(eventMap, \"balance\", 0);\r\n\t\t\t\t}\r\n\t\t\t\ttimeline.setFrame(frameIndex++, event);\r\n\t\t\t}\r\n\t\t\ttimelines.push(timeline);\r\n\t\t\tduration = Math.max(duration, timeline.frames[timeline.getFrameCount() - 1]);\r\n\t\t}\r\n\r\n\t\tif (isNaN(duration)) {\r\n\t\t\tthrow new Error(\"Error while parsing animation, duration is NaN\");\r\n\t\t}\r\n\r\n\t\tskeletonData.animations.push(new Animation(name, timelines, duration));\r\n\t}\r\n\r\n\treadCurve (map: any, timeline: CurveTimeline, frameIndex: number) {\r\n\t\tif (!map.hasOwnProperty(\"curve\")) return;\r\n\t\tif (map.curve == \"stepped\")\r\n\t\t\ttimeline.setStepped(frameIndex);\r\n\t\telse {\r\n\t\t\tlet curve: number = map.curve;\r\n\t\t\ttimeline.setCurve(frameIndex, curve, this.getValue(map, \"c2\", 0), this.getValue(map, \"c3\", 1), this.getValue(map, \"c4\", 1));\r\n\t\t}\r\n\t}\r\n\r\n\tgetValue (map: any, prop: string, defaultValue: any) {\r\n\t\treturn map[prop] !== undefined ? map[prop] : defaultValue;\r\n\t}\r\n\r\n\tstatic blendModeFromString (str: string) {\r\n\t\tstr = str.toLowerCase();\r\n\t\tif (str == \"normal\") return BlendMode.Normal;\r\n\t\tif (str == \"additive\") return BlendMode.Additive;\r\n\t\tif (str == \"multiply\") return BlendMode.Multiply;\r\n\t\tif (str == \"screen\") return BlendMode.Screen;\r\n\t\tthrow new Error(`Unknown blend mode: ${str}`);\r\n\t}\r\n\r\n\tstatic positionModeFromString (str: string) {\r\n\t\tstr = str.toLowerCase();\r\n\t\tif (str == \"fixed\") return PositionMode.Fixed;\r\n\t\tif (str == \"percent\") return PositionMode.Percent;\r\n\t\tthrow new Error(`Unknown position mode: ${str}`);\r\n\t}\r\n\r\n\tstatic spacingModeFromString (str: string) {\r\n\t\tstr = str.toLowerCase();\r\n\t\tif (str == \"length\") return SpacingMode.Length;\r\n\t\tif (str == \"fixed\") return SpacingMode.Fixed;\r\n\t\tif (str == \"percent\") return SpacingMode.Percent;\r\n\t\tthrow new Error(`Unknown position mode: ${str}`);\r\n\t}\r\n\r\n\tstatic rotateModeFromString (str: string) {\r\n\t\tstr = str.toLowerCase();\r\n\t\tif (str == \"tangent\") return RotateMode.Tangent;\r\n\t\tif (str == \"chain\") return RotateMode.Chain;\r\n\t\tif (str == \"chainscale\") return RotateMode.ChainScale;\r\n\t\tthrow new Error(`Unknown rotate mode: ${str}`);\r\n\t}\r\n\r\n\tstatic transformModeFromString(str: string) {\r\n\t\tstr = str.toLowerCase();\r\n\t\tif (str == \"normal\") return TransformMode.Normal;\r\n\t\tif (str == \"onlytranslation\") return TransformMode.OnlyTranslation;\r\n\t\tif (str == \"norotationorreflection\") return TransformMode.NoRotationOrReflection;\r\n\t\tif (str == \"noscale\") return TransformMode.NoScale;\r\n\t\tif (str == \"noscaleorreflection\") return TransformMode.NoScaleOrReflection;\r\n\t\tthrow new Error(`Unknown transform mode: ${str}`);\r\n\t}\r\n}\r\n\r\nclass LinkedMesh {\r\n\tparent: string; skin: string;\r\n\tslotIndex: number;\r\n\tmesh: MeshAttachment;\r\n\tinheritDeform: boolean;\r\n\r\n\tconstructor (mesh: MeshAttachment, skin: string, slotIndex: number, parent: string, inheritDeform: boolean) {\r\n\t\tthis.mesh = mesh;\r\n\t\tthis.skin = skin;\r\n\t\tthis.slotIndex = slotIndex;\r\n\t\tthis.parent = parent;\r\n\t\tthis.inheritDeform = inheritDeform;\r\n\t}\r\n}\r\n","\n\nimport { TransformMode, BoneData } from \"./BoneData\";\nimport { PositionMode, SpacingMode, RotateMode, PathConstraintData } from \"./PathConstraintData\";\nimport { BlendMode } from \"./BlendMode\";\nimport { AttachmentLoader } from \"./attachments/AttachmentLoader\";\nimport { SkeletonData } from \"./SkeletonData\";\nimport { Color, Utils } from \"./Utils\";\nimport { SlotData } from \"./SlotData\";\nimport { IkConstraintData } from \"./IkConstraintData\";\nimport { TransformConstraintData } from \"./TransformConstraintData\";\nimport { VertexAttachment, Attachment } from \"./attachments/Attachment\";\nimport { MeshAttachment } from \"./attachments/MeshAttachment\";\nimport { EventData } from \"./EventData\";\nimport { Skin } from \"./Skin\";\nimport { AttachmentType } from \"./attachments/AttachmentType\";\nimport { Timeline, AttachmentTimeline, ColorTimeline, TwoColorTimeline, RotateTimeline, ScaleTimeline, ShearTimeline, TranslateTimeline, IkConstraintTimeline, TransformConstraintTimeline, PathConstraintSpacingTimeline, PathConstraintPositionTimeline, PathConstraintMixTimeline, DeformTimeline, DrawOrderTimeline, EventTimeline, CurveTimeline } from \"./Animation\";\nimport { Animation } from \"./Animation\";\nimport { Event } from \"./Event\";\n\n/** Loads skeleton data in the Spine binary format.\n *\n * See [Spine binary format](http://esotericsoftware.com/spine-binary-format) and\n * [JSON and binary data](http://esotericsoftware.com/spine-loading-skeleton-data#JSON-and-binary-data) in the Spine\n * Runtimes Guide. */\nexport class SkeletonBinary {\n\tstatic AttachmentTypeValues = [ 0 /*AttachmentType.Region*/, 1/*AttachmentType.BoundingBox*/, 2/*AttachmentType.Mesh*/, 3/*AttachmentType.LinkedMesh*/, 4/*AttachmentType.Path*/, 5/*AttachmentType.Point*/, 6/*AttachmentType.Clipping*/ ];\n\tstatic TransformModeValues = [TransformMode.Normal, TransformMode.OnlyTranslation, TransformMode.NoRotationOrReflection, TransformMode.NoScale, TransformMode.NoScaleOrReflection];\n\tstatic PositionModeValues = [ PositionMode.Fixed, PositionMode.Percent ];\n\tstatic SpacingModeValues = [ SpacingMode.Length, SpacingMode.Fixed, SpacingMode.Percent];\n\tstatic RotateModeValues = [ RotateMode.Tangent, RotateMode.Chain, RotateMode.ChainScale ];\n\tstatic BlendModeValues = [ BlendMode.Normal, BlendMode.Additive, BlendMode.Multiply, BlendMode.Screen];\n\n\tstatic BONE_ROTATE = 0;\n\tstatic BONE_TRANSLATE = 1;\n\tstatic BONE_SCALE = 2;\n\tstatic BONE_SHEAR = 3;\n\n\tstatic SLOT_ATTACHMENT = 0;\n\tstatic SLOT_COLOR = 1;\n\tstatic SLOT_TWO_COLOR = 2;\n\n\tstatic PATH_POSITION = 0;\n\tstatic PATH_SPACING = 1;\n\tstatic PATH_MIX = 2;\n\n\tstatic CURVE_LINEAR = 0;\n\tstatic CURVE_STEPPED = 1;\n\tstatic CURVE_BEZIER = 2;\n\n\t/** Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at\n\t * runtime than were used in Spine.\n\t *\n\t * See [Scaling](http://esotericsoftware.com/spine-loading-skeleton-data#Scaling) in the Spine Runtimes Guide. */\n\tscale = 1;\n\n\tattachmentLoader: AttachmentLoader;\n\tprivate linkedMeshes = new Array<LinkedMesh>();\n\n\tconstructor (attachmentLoader: AttachmentLoader) {\n\t\tthis.attachmentLoader = attachmentLoader;\n\t}\n\n\treadSkeletonData (binary: Uint8Array): SkeletonData {\n\t\tlet scale = this.scale;\n\n\t\tlet skeletonData = new SkeletonData();\n\t\tskeletonData.name = \"\"; // BOZO\n\n\t\tlet input = new BinaryInput(binary);\n\n\t\tskeletonData.hash = input.readString();\n\t\tskeletonData.version = input.readString();\n\t\tif (\"3.8.75\" == skeletonData.version)\n\t\t\t\tthrow new Error(\"Unsupported skeleton data, please export with a newer version of Spine.\");\n\t\tskeletonData.x = input.readFloat();\n\t\tskeletonData.y = input.readFloat();\n\t\tskeletonData.width = input.readFloat();\n\t\tskeletonData.height = input.readFloat();\n\n\t\tlet nonessential = input.readBoolean();\n\t\tif (nonessential) {\n\t\t\tskeletonData.fps = input.readFloat();\n\n\t\t\tskeletonData.imagesPath = input.readString();\n\t\t\tskeletonData.audioPath = input.readString();\n\t\t}\n\n\t\tlet n = 0;\n\t\t// Strings.\n\t\tn = input.readInt(true)\n\t\tfor (let i = 0; i < n; i++)\n\t\t\tinput.strings.push(input.readString());\n\n\t\t// Bones.\n\t\tn = input.readInt(true)\n\t\tfor (let i = 0; i < n; i++) {\n\t\t\tlet name = input.readString();\n\t\t\tlet parent = i == 0 ? null : skeletonData.bones[input.readInt(true)];\n\t\t\tlet data = new BoneData(i, name, parent);\n\t\t\tdata.rotation = input.readFloat();\n\t\t\tdata.x = input.readFloat() * scale;\n\t\t\tdata.y = input.readFloat() * scale;\n\t\t\tdata.scaleX = input.readFloat();\n\t\t\tdata.scaleY = input.readFloat();\n\t\t\tdata.shearX = input.readFloat();\n\t\t\tdata.shearY = input.readFloat();\n\t\t\tdata.length = input.readFloat() * scale;\n\t\t\tdata.transformMode = SkeletonBinary.TransformModeValues[input.readInt(true)];\n\t\t\tdata.skinRequired = input.readBoolean();\n\t\t\tif (nonessential) Color.rgba8888ToColor(data.color, input.readInt32());\n\t\t\tskeletonData.bones.push(data);\n\t\t}\n\n\t\t// Slots.\n\t\tn = input.readInt(true);\n\t\tfor (let i = 0; i < n; i++) {\n\t\t\tlet slotName = input.readString();\n\t\t\tlet boneData = skeletonData.bones[input.readInt(true)];\n\t\t\tlet data = new SlotData(i, slotName, boneData);\n\t\t\tColor.rgba8888ToColor(data.color, input.readInt32());\n\n\t\t\tlet darkColor = input.readInt32();\n\t\t\tif (darkColor != -1) Color.rgb888ToColor(data.darkColor = new Color(), darkColor);\n\n\t\t\tdata.attachmentName = input.readStringRef();\n\t\t\tdata.blendMode = SkeletonBinary.BlendModeValues[input.readInt(true)];\n\t\t\tskeletonData.slots.push(data);\n\t\t}\n\n\t\t// IK constraints.\n\t\tn = input.readInt(true);\n\t\tfor (let i = 0, nn; i < n; i++) {\n\t\t\tlet data = new IkConstraintData(input.readString());\n\t\t\tdata.order = input.readInt(true);\n\t\t\tdata.skinRequired = input.readBoolean();\n\t\t\tnn = input.readInt(true);\n\t\t\tfor (let ii = 0; ii < nn; ii++)\n\t\t\t\tdata.bones.push(skeletonData.bones[input.readInt(true)]);\n\t\t\tdata.target = skeletonData.bones[input.readInt(true)];\n\t\t\tdata.mix = input.readFloat();\n\t\t\tdata.softness = input.readFloat() * scale;\n\t\t\tdata.bendDirection = input.readByte();\n\t\t\tdata.compress = input.readBoolean();\n\t\t\tdata.stretch = input.readBoolean();\n\t\t\tdata.uniform = input.readBoolean();\n\t\t\tskeletonData.ikConstraints.push(data);\n\t\t}\n\n\t\t// Transform constraints.\n\t\tn = input.readInt(true);\n\t\tfor (let i = 0, nn; i < n; i++) {\n\t\t\tlet data = new TransformConstraintData(input.readString());\n\t\t\tdata.order = input.readInt(true);\n\t\t\tdata.skinRequired = input.readBoolean();\n\t\t\tnn = input.readInt(true);\n\t\t\tfor (let ii = 0; ii < nn; ii++)\n\t\t\t\tdata.bones.push(skeletonData.bones[input.readInt(true)]);\n\t\t\tdata.target = skeletonData.bones[input.readInt(true)];\n\t\t\tdata.local = input.readBoolean();\n\t\t\tdata.relative = input.readBoolean();\n\t\t\tdata.offsetRotation = input.readFloat();\n\t\t\tdata.offsetX = input.readFloat() * scale;\n\t\t\tdata.offsetY = input.readFloat() * scale;\n\t\t\tdata.offsetScaleX = input.readFloat();\n\t\t\tdata.offsetScaleY = input.readFloat();\n\t\t\tdata.offsetShearY = input.readFloat();\n\t\t\tdata.rotateMix = input.readFloat();\n\t\t\tdata.translateMix = input.readFloat();\n\t\t\tdata.scaleMix = input.readFloat();\n\t\t\tdata.shearMix = input.readFloat();\n\t\t\tskeletonData.transformConstraints.push(data);\n\t\t}\n\n\t\t// Path constraints.\n\t\tn = input.readInt(true);\n\t\tfor (let i = 0, nn; i < n; i++) {\n\t\t\tlet data = new PathConstraintData(input.readString());\n\t\t\tdata.order = input.readInt(true);\n\t\t\tdata.skinRequired = input.readBoolean();\n\t\t\tnn = input.readInt(true);\n\t\t\tfor (let ii = 0; ii < nn; ii++)\n\t\t\t\tdata.bones.push(skeletonData.bones[input.readInt(true)]);\n\t\t\tdata.target = skeletonData.slots[input.readInt(true)];\n\t\t\tdata.positionMode = SkeletonBinary.PositionModeValues[input.readInt(true)];\n\t\t\tdata.spacingMode = SkeletonBinary.SpacingModeValues[input.readInt(true)];\n\t\t\tdata.rotateMode = SkeletonBinary.RotateModeValues[input.readInt(true)];\n\t\t\tdata.offsetRotation = input.readFloat();\n\t\t\tdata.position = input.readFloat();\n\t\t\tif (data.positionMode == PositionMode.Fixed) data.position *= scale;\n\t\t\tdata.spacing = input.readFloat();\n\t\t\tif (data.spacingMode == SpacingMode.Length || data.spacingMode == SpacingMode.Fixed) data.spacing *= scale;\n\t\t\tdata.rotateMix = input.readFloat();\n\t\t\tdata.translateMix = input.readFloat();\n\t\t\tskeletonData.pathConstraints.push(data);\n\t\t}\n\n\t\t// Default skin.\n\t\tlet defaultSkin = this.readSkin(input, skeletonData, true, nonessential);\n\t\tif (defaultSkin != null) {\n\t\t\tskeletonData.defaultSkin = defaultSkin;\n\t\t\tskeletonData.skins.push(defaultSkin);\n\t\t}\n\n\t\t// Skins.\n\t\t{\n\t\t\tlet i = skeletonData.skins.length;\n\t\t\tUtils.setArraySize(skeletonData.skins, n = i + input.readInt(true));\n\t\t\tfor (; i < n; i++)\n\t\t\t\tskeletonData.skins[i] = this.readSkin(input, skeletonData, false, nonessential);\n\t\t}\n\n\t\t// Linked meshes.\n\t\tn = this.linkedMeshes.length;\n\t\tfor (let i = 0; i < n; i++) {\n\t\t\tlet linkedMesh = this.linkedMeshes[i];\n\t\t\tlet skin = linkedMesh.skin == null ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);\n\t\t\tif (skin == null) throw new Error(\"Skin not found: \" + linkedMesh.skin);\n\t\t\tlet parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);\n\t\t\tif (parent == null) throw new Error(\"Parent mesh not found: \" + linkedMesh.parent);\n\t\t\tlinkedMesh.mesh.deformAttachment = linkedMesh.inheritDeform ? parent as VertexAttachment : linkedMesh.mesh;\n\t\t\tlinkedMesh.mesh.setParentMesh(parent as MeshAttachment);\n\t\t\tlinkedMesh.mesh.updateUVs();\n\t\t}\n\t\tthis.linkedMeshes.length = 0;\n\n\t\t// Events.\n\t\tn = input.readInt(true);\n\t\tfor (let i = 0; i < n; i++) {\n\t\t\tlet data = new EventData(input.readStringRef());\n\t\t\tdata.intValue = input.readInt(false);\n\t\t\tdata.floatValue = input.readFloat();\n\t\t\tdata.stringValue = input.readString();\n\t\t\tdata.audioPath = input.readString();\n\t\t\tif (data.audioPath != null) {\n\t\t\t\tdata.volume = input.readFloat();\n\t\t\t\tdata.balance = input.readFloat();\n\t\t\t}\n\t\t\tskeletonData.events.push(data);\n\t\t}\n\n\t\t// Animations.\n\t\tn = input.readInt(true);\n\t\tfor (let i = 0; i < n; i++)\n\t\t\tskeletonData.animations.push(this.readAnimation(input, input.readString(), skeletonData));\n\t\treturn skeletonData;\n\t}\n\n\tprivate readSkin (input: BinaryInput, skeletonData: SkeletonData, defaultSkin: boolean, nonessential: boolean): Skin {\n\t\tlet skin = null;\n\t\tlet slotCount = 0;\n\n\t\tif (defaultSkin) {\n\t\t\tslotCount = input.readInt(true)\n\t\t\tif (slotCount == 0) return null;\n\t\t\tskin = new Skin(\"default\");\n\t\t} else {\n\t\t\tskin = new Skin(input.readStringRef());\n\t\t\tskin.bones.length = input.readInt(true);\n\t\t\tfor (let i = 0, n = skin.bones.length; i < n; i++)\n\t\t\t\tskin.bones[i] = skeletonData.bones[input.readInt(true)];\n\n\t\t\tfor (let i = 0, n = input.readInt(true); i < n; i++)\n\t\t\t\tskin.constraints.push(skeletonData.ikConstraints[input.readInt(true)]);\n\t\t\tfor (let i = 0, n = input.readInt(true); i < n; i++)\n\t\t\t\tskin.constraints.push(skeletonData.transformConstraints[input.readInt(true)]);\n\t\t\tfor (let i = 0, n = input.readInt(true); i < n; i++)\n\t\t\t\tskin.constraints.push(skeletonData.pathConstraints[input.readInt(true)]);\n\n\t\t\tslotCount = input.readInt(true);\n\t\t}\n\n\t\tfor (let i = 0; i < slotCount; i++) {\n\t\t\tlet slotIndex = input.readInt(true);\n\t\t\tfor (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {\n\t\t\t\tlet name = input.readStringRef();\n\t\t\t\tlet attachment = this.readAttachment(input, skeletonData, skin, slotIndex, name, nonessential);\n\t\t\t\tif (attachment != null) skin.setAttachment(slotIndex, name, attachment);\n\t\t\t}\n\t\t}\n\t\treturn skin;\n\t}\n\n\tprivate readAttachment(input: BinaryInput, skeletonData: SkeletonData, skin: Skin, slotIndex: number, attachmentName: string, nonessential: boolean): Attachment {\n\t\tlet scale = this.scale;\n\n\t\tlet name = input.readStringRef();\n\t\tif (name == null) name = attachmentName;\n\n\t\tlet typeIndex = input.readByte();\n\t\tlet type = SkeletonBinary.AttachmentTypeValues[typeIndex];\n\t\tswitch (type) {\n\t\tcase AttachmentType.Region: {\n\t\t\tlet path = input.readStringRef();\n\t\t\tlet rotation = input.readFloat();\n\t\t\tlet x = input.readFloat();\n\t\t\tlet y = input.readFloat();\n\t\t\tlet scaleX = input.readFloat();\n\t\t\tlet scaleY = input.readFloat();\n\t\t\tlet width = input.readFloat();\n\t\t\tlet height = input.readFloat();\n\t\t\tlet color = input.readInt32();\n\n\t\t\tif (path == null) path = name;\n\t\t\tlet region = this.attachmentLoader.newRegionAttachment(skin, name, path);\n\t\t\tif (region == null) return null;\n\t\t\tregion.path = path;\n\t\t\tregion.x = x * scale;\n\t\t\tregion.y = y * scale;\n\t\t\tregion.scaleX = scaleX;\n\t\t\tregion.scaleY = scaleY;\n\t\t\tregion.rotation = rotation;\n\t\t\tregion.width = width * scale;\n\t\t\tregion.height = height * scale;\n\t\t\tColor.rgba8888ToColor(region.color, color);\n\t\t\tregion.updateOffset();\n\t\t\treturn region;\n\t\t}\n\t\tcase AttachmentType.BoundingBox: {\n\t\t\tlet vertexCount = input.readInt(true);\n\t\t\tlet vertices = this.readVertices(input, vertexCount);\n\t\t\tlet color = nonessential ? input.readInt32() : 0;\n\n\t\t\tlet box = this.attachmentLoader.newBoundingBoxAttachment(skin, name);\n\t\t\tif (box == null) return null;\n\t\t\tbox.worldVerticesLength = vertexCount << 1;\n\t\t\tbox.vertices = vertices.vertices;\n\t\t\tbox.bones = vertices.bones;\n\t\t\tif (nonessential) Color.rgba8888ToColor(box.color, color);\n\t\t\treturn box;\n\t\t}\n\t\tcase AttachmentType.Mesh: {\n\t\t\tlet path = input.readStringRef();\n\t\t\tlet color = input.readInt32();\n\t\t\tlet vertexCount = input.readInt(true);\n\t\t\tlet uvs = this.readFloatArray(input, vertexCount << 1, 1);\n\t\t\tlet triangles = this.readShortArray(input);\n\t\t\tlet vertices = this.readVertices(input, vertexCount);\n\t\t\tlet hullLength = input.readInt(true);\n\t\t\tlet edges = null;\n\t\t\tlet width = 0, height = 0;\n\t\t\tif (nonessential) {\n\t\t\t\tedges = this.readShortArray(input);\n\t\t\t\twidth = input.readFloat();\n\t\t\t\theight = input.readFloat();\n\t\t\t}\n\n\t\t\tif (path == null) path = name;\n\t\t\tlet mesh = this.attachmentLoader.newMeshAttachment(skin, name, path);\n\t\t\tif (mesh == null) return null;\n\t\t\tmesh.path = path;\n\t\t\tColor.rgba8888ToColor(mesh.color, color);\n\t\t\tmesh.bones = vertices.bones;\n\t\t\tmesh.vertices = vertices.vertices;\n\t\t\tmesh.worldVerticesLength = vertexCount << 1;\n\t\t\tmesh.triangles = triangles;\n\t\t\tmesh.regionUVs = uvs;\n\t\t\tmesh.updateUVs();\n\t\t\tmesh.hullLength = hullLength << 1;\n\t\t\tif (nonessential) {\n\t\t\t\tmesh.edges = edges;\n\t\t\t\tmesh.width = width * scale;\n\t\t\t\tmesh.height = height * scale;\n\t\t\t}\n\t\t\treturn mesh;\n\t\t}\n\t\tcase AttachmentType.LinkedMesh: {\n\t\t\tlet path = input.readStringRef();\n\t\t\tlet color = input.readInt32();\n\t\t\tlet skinName = input.readStringRef();\n\t\t\tlet parent = input.readStringRef();\n\t\t\tlet inheritDeform = input.readBoolean();\n\t\t\tlet width = 0, height = 0;\n\t\t\tif (nonessential) {\n\t\t\t\twidth = input.readFloat();\n\t\t\t\theight = input.readFloat();\n\t\t\t}\n\n\t\t\tif (path == null) path = name;\n\t\t\tlet mesh = this.attachmentLoader.newMeshAttachment(skin, name, path);\n\t\t\tif (mesh == null) return null;\n\t\t\tmesh.path = path;\n\t\t\tColor.rgba8888ToColor(mesh.color, color);\n\t\t\tif (nonessential) {\n\t\t\t\tmesh.width = width * scale;\n\t\t\t\tmesh.height = height * scale;\n\t\t\t}\n\t\t\tthis.linkedMeshes.push(new LinkedMesh(mesh, skinName, slotIndex, parent, inheritDeform));\n\t\t\treturn mesh;\n\t\t}\n\t\tcase AttachmentType.Path: {\n\t\t\tlet closed = input.readBoolean();\n\t\t\tlet constantSpeed = input.readBoolean();\n\t\t\tlet vertexCount = input.readInt(true);\n\t\t\tlet vertices = this.readVertices(input, vertexCount);\n\t\t\tlet lengths = Utils.newArray(vertexCount / 3, 0);\n\t\t\tfor (let i = 0, n = lengths.length; i < n; i++)\n\t\t\t\tlengths[i] = input.readFloat() * scale;\n\t\t\tlet color = nonessential ? input.readInt32() : 0;\n\n\t\t\tlet path = this.attachmentLoader.newPathAttachment(skin, name);\n\t\t\tif (path == null) return null;\n\t\t\tpath.closed = closed;\n\t\t\tpath.constantSpeed = constantSpeed;\n\t\t\tpath.worldVerticesLength = vertexCount << 1;\n\t\t\tpath.vertices = vertices.vertices;\n\t\t\tpath.bones = vertices.bones;\n\t\t\tpath.lengths = lengths;\n\t\t\tif (nonessential) Color.rgba8888ToColor(path.color, color);\n\t\t\treturn path;\n\t\t}\n\t\tcase AttachmentType.Point: {\n\t\t\tlet rotation = input.readFloat();\n\t\t\tlet x = input.readFloat();\n\t\t\tlet y = input.readFloat();\n\t\t\tlet color = nonessential ? input.readInt32() : 0;\n\n\t\t\tlet point = this.attachmentLoader.newPointAttachment(skin, name);\n\t\t\tif (point == null) return null;\n\t\t\tpoint.x = x * scale;\n\t\t\tpoint.y = y * scale;\n\t\t\tpoint.rotation = rotation;\n\t\t\tif (nonessential) Color.rgba8888ToColor(point.color, color);\n\t\t\treturn point;\n\t\t}\n\t\tcase AttachmentType.Clipping: {\n\t\t\tlet endSlotIndex = input.readInt(true);\n\t\t\tlet vertexCount = input.readInt(true);\n\t\t\tlet vertices = this.readVertices(input, vertexCount);\n\t\t\tlet color = nonessential ? input.readInt32() : 0;\n\n\t\t\tlet clip = this.attachmentLoader.newClippingAttachment(skin, name);\n\t\t\tif (clip == null) return null;\n\t\t\tclip.endSlot = skeletonData.slots[endSlotIndex];\n\t\t\tclip.worldVerticesLength = vertexCount << 1;\n\t\t\tclip.vertices = vertices.vertices;\n\t\t\tclip.bones = vertices.bones;\n\t\t\tif (nonessential) Color.rgba8888ToColor(clip.color, color);\n\t\t\treturn clip;\n\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprivate readVertices (input: BinaryInput, vertexCount: number): Vertices {\n\t\tlet verticesLength = vertexCount << 1;\n\t\tlet vertices = new Vertices();\n\t\tlet scale = this.scale;\n\t\tif (!input.readBoolean()) {\n\t\t\tvertices.vertices = this.readFloatArray(input, verticesLength, scale);\n\t\t\treturn vertices;\n\t\t}\n\t\tlet weights = new Array<number>();\n\t\tlet bonesArray = new Array<number>();\n\t\tfor (let i = 0; i < vertexCount; i++) {\n\t\t\tlet boneCount = input.readInt(true);\n\t\t\tbonesArray.push(boneCount);\n\t\t\tfor (let ii = 0; ii < boneCount; ii++) {\n\t\t\t\tbonesArray.push(input.readInt(true));\n\t\t\t\tweights.push(input.readFloat() * scale);\n\t\t\t\tweights.push(input.readFloat() * scale);\n\t\t\t\tweights.push(input.readFloat());\n\t\t\t}\n\t\t}\n\t\tvertices.vertices = Utils.toFloatArray(weights);\n\t\tvertices.bones = bonesArray;\n\t\treturn vertices;\n\t}\n\n\tprivate readFloatArray (input: BinaryInput, n: number, scale: number): number[] {\n\t\tlet array = new Array<number>(n);\n\t\tif (scale == 1) {\n\t\t\tfor (let i = 0; i < n; i++)\n\t\t\t\tarray[i] = input.readFloat();\n\t\t} else {\n\t\t\tfor (let i = 0; i < n; i++)\n\t\t\t\tarray[i] = input.readFloat() * scale;\n\t\t}\n\t\treturn array;\n\t}\n\n\tprivate readShortArray (input: BinaryInput): number[] {\n\t\tlet n = input.readInt(true);\n\t\tlet array = new Array<number>(n);\n\t\tfor (let i = 0; i < n; i++)\n\t\t\tarray[i] = input.readShort();\n\t\treturn array;\n\t}\n\n\tprivate readAnimation (input: BinaryInput, name: string, skeletonData: SkeletonData): Animation {\n\t\tlet timelines = new Array<Timeline>();\n\t\tlet scale = this.scale;\n\t\tlet duration = 0;\n\t\tlet tempColor1 = new Color();\n\t\tlet tempColor2 = new Color();\n\n\t\t// Slot timelines.\n\t\tfor (let i = 0, n = input.readInt(true); i < n; i++) {\n\t\t\tlet slotIndex = input.readInt(true);\n\t\t\tfor (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {\n\t\t\t\tlet timelineType = input.readByte();\n\t\t\t\tlet frameCount = input.readInt(true);\n\t\t\t\tswitch (timelineType) {\n\t\t\t\tcase SkeletonBinary.SLOT_ATTACHMENT: {\n\t\t\t\t\tlet timeline = new AttachmentTimeline(frameCount);\n\t\t\t\t\ttimeline.slotIndex = slotIndex;\n\t\t\t\t\tfor (let frameIndex = 0; frameIndex < frameCount; frameIndex++)\n\t\t\t\t\t\ttimeline.setFrame(frameIndex, input.readFloat(), input.readStringRef());\n\t\t\t\t\ttimelines.push(timeline);\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[frameCount - 1]);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase SkeletonBinary.SLOT_COLOR: {\n\t\t\t\t\tlet timeline = new ColorTimeline(frameCount);\n\t\t\t\t\ttimeline.slotIndex = slotIndex;\n\t\t\t\t\tfor (let frameIndex = 0; frameIndex < frameCount; frameIndex++) {\n\t\t\t\t\t\tlet time = input.readFloat();\n\t\t\t\t\t\tColor.rgba8888ToColor(tempColor1, input.readInt32());\n\t\t\t\t\t\ttimeline.setFrame(frameIndex, time, tempColor1.r, tempColor1.g, tempColor1.b, tempColor1.a);\n\t\t\t\t\t\tif (frameIndex < frameCount - 1) this.readCurve(input, frameIndex, timeline);\n\t\t\t\t\t}\n\t\t\t\t\ttimelines.push(timeline);\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[(frameCount - 1) * ColorTimeline.ENTRIES]);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase SkeletonBinary.SLOT_TWO_COLOR: {\n\t\t\t\t\tlet timeline = new TwoColorTimeline(frameCount);\n\t\t\t\t\ttimeline.slotIndex = slotIndex;\n\t\t\t\t\tfor (let frameIndex = 0; frameIndex < frameCount; frameIndex++) {\n\t\t\t\t\t\tlet time = input.readFloat();\n\t\t\t\t\t\tColor.rgba8888ToColor(tempColor1, input.readInt32());\n\t\t\t\t\t\tColor.rgb888ToColor(tempColor2, input.readInt32());\n\t\t\t\t\t\ttimeline.setFrame(frameIndex, time, tempColor1.r, tempColor1.g, tempColor1.b, tempColor1.a, tempColor2.r,\n\t\t\t\t\t\t\ttempColor2.g, tempColor2.b);\n\t\t\t\t\t\tif (frameIndex < frameCount - 1) this.readCurve(input, frameIndex, timeline);\n\t\t\t\t\t}\n\t\t\t\t\ttimelines.push(timeline);\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[(frameCount - 1) * TwoColorTimeline.ENTRIES]);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Bone timelines.\n\t\tfor (let i = 0, n = input.readInt(true); i < n; i++) {\n\t\t\tlet boneIndex = input.readInt(true);\n\t\t\tfor (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {\n\t\t\t\tlet timelineType = input.readByte();\n\t\t\t\tlet frameCount = input.readInt(true);\n\t\t\t\tswitch (timelineType) {\n\t\t\t\tcase SkeletonBinary.BONE_ROTATE: {\n\t\t\t\t\tlet timeline = new RotateTimeline(frameCount);\n\t\t\t\t\ttimeline.boneIndex = boneIndex;\n\t\t\t\t\tfor (let frameIndex = 0; frameIndex < frameCount; frameIndex++) {\n\t\t\t\t\t\ttimeline.setFrame(frameIndex, input.readFloat(), input.readFloat());\n\t\t\t\t\t\tif (frameIndex < frameCount - 1) this.readCurve(input, frameIndex, timeline);\n\t\t\t\t\t}\n\t\t\t\t\ttimelines.push(timeline);\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[(frameCount - 1) * RotateTimeline.ENTRIES]);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase SkeletonBinary.BONE_TRANSLATE:\n\t\t\t\tcase SkeletonBinary.BONE_SCALE:\n\t\t\t\tcase SkeletonBinary.BONE_SHEAR: {\n\t\t\t\t\tlet timeline;\n\t\t\t\t\tlet timelineScale = 1;\n\t\t\t\t\tif (timelineType == SkeletonBinary.BONE_SCALE)\n\t\t\t\t\t\ttimeline = new ScaleTimeline(frameCount);\n\t\t\t\t\telse if (timelineType == SkeletonBinary.BONE_SHEAR)\n\t\t\t\t\t\ttimeline = new ShearTimeline(frameCount);\n\t\t\t\t\telse {\n\t\t\t\t\t\ttimeline = new TranslateTimeline(frameCount);\n\t\t\t\t\t\ttimelineScale = scale;\n\t\t\t\t\t}\n\t\t\t\t\ttimeline.boneIndex = boneIndex;\n\t\t\t\t\tfor (let frameIndex = 0; frameIndex < frameCount; frameIndex++) {\n\t\t\t\t\t\ttimeline.setFrame(frameIndex, input.readFloat(), input.readFloat() * timelineScale,\n\t\t\t\t\t\t\tinput.readFloat() * timelineScale);\n\t\t\t\t\t\tif (frameIndex < frameCount - 1) this.readCurve(input, frameIndex, timeline);\n\t\t\t\t\t}\n\t\t\t\t\ttimelines.push(timeline);\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[(frameCount - 1) * TranslateTimeline.ENTRIES]);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// IK constraint timelines.\n\t\tfor (let i = 0, n = input.readInt(true); i < n; i++) {\n\t\t\tlet index = input.readInt(true);\n\t\t\tlet frameCount = input.readInt(true);\n\t\t\tlet timeline = new IkConstraintTimeline(frameCount);\n\t\t\ttimeline.ikConstraintIndex = index;\n\t\t\tfor (let frameIndex = 0; frameIndex < frameCount; frameIndex++) {\n\t\t\t\ttimeline.setFrame(frameIndex, input.readFloat(), input.readFloat(), input.readFloat() * scale, input.readByte(), input.readBoolean(),\n\t\t\t\t\tinput.readBoolean());\n\t\t\t\tif (frameIndex < frameCount - 1) this.readCurve(input, frameIndex, timeline);\n\t\t\t}\n\t\t\ttimelines.push(timeline);\n\t\t\tduration = Math.max(duration, timeline.frames[(frameCount - 1) * IkConstraintTimeline.ENTRIES]);\n\t\t}\n\n\t\t// Transform constraint timelines.\n\t\tfor (let i = 0, n = input.readInt(true); i < n; i++) {\n\t\t\tlet index = input.readInt(true);\n\t\t\tlet frameCount = input.readInt(true);\n\t\t\tlet timeline = new TransformConstraintTimeline(frameCount);\n\t\t\ttimeline.transformConstraintIndex = index;\n\t\t\tfor (let frameIndex = 0; frameIndex < frameCount; frameIndex++) {\n\t\t\t\ttimeline.setFrame(frameIndex, input.readFloat(), input.readFloat(), input.readFloat(), input.readFloat(),\n\t\t\t\t\tinput.readFloat());\n\t\t\t\tif (frameIndex < frameCount - 1) this.readCurve(input, frameIndex, timeline);\n\t\t\t}\n\t\t\ttimelines.push(timeline);\n\t\t\tduration = Math.max(duration, timeline.frames[(frameCount - 1) * TransformConstraintTimeline.ENTRIES]);\n\t\t}\n\n\t\t// Path constraint timelines.\n\t\tfor (let i = 0, n = input.readInt(true); i < n; i++) {\n\t\t\tlet index = input.readInt(true);\n\t\t\tlet data = skeletonData.pathConstraints[index];\n\t\t\tfor (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {\n\t\t\t\tlet timelineType = input.readByte();\n\t\t\t\tlet frameCount = input.readInt(true);\n\t\t\t\tswitch (timelineType) {\n\t\t\t\tcase SkeletonBinary.PATH_POSITION:\n\t\t\t\tcase SkeletonBinary.PATH_SPACING: {\n\t\t\t\t\tlet timeline;\n\t\t\t\t\tlet timelineScale = 1;\n\t\t\t\t\tif (timelineType == SkeletonBinary.PATH_SPACING) {\n\t\t\t\t\t\ttimeline = new PathConstraintSpacingTimeline(frameCount);\n\t\t\t\t\t\tif (data.spacingMode == SpacingMode.Length || data.spacingMode == SpacingMode.Fixed) timelineScale = scale;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttimeline = new PathConstraintPositionTimeline(frameCount);\n\t\t\t\t\t\tif (data.positionMode == PositionMode.Fixed) timelineScale = scale;\n\t\t\t\t\t}\n\t\t\t\t\ttimeline.pathConstraintIndex = index;\n\t\t\t\t\tfor (let frameIndex = 0; frameIndex < frameCount; frameIndex++) {\n\t\t\t\t\t\ttimeline.setFrame(frameIndex, input.readFloat(), input.readFloat() * timelineScale);\n\t\t\t\t\t\tif (frameIndex < frameCount - 1) this.readCurve(input, frameIndex, timeline);\n\t\t\t\t\t}\n\t\t\t\t\ttimelines.push(timeline);\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[(frameCount - 1) * PathConstraintPositionTimeline.ENTRIES]);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase SkeletonBinary.PATH_MIX: {\n\t\t\t\t\tlet timeline = new PathConstraintMixTimeline(frameCount);\n\t\t\t\t\ttimeline.pathConstraintIndex = index;\n\t\t\t\t\tfor (let frameIndex = 0; frameIndex < frameCount; frameIndex++) {\n\t\t\t\t\t\ttimeline.setFrame(frameIndex, input.readFloat(), input.readFloat(), input.readFloat());\n\t\t\t\t\t\tif (frameIndex < frameCount - 1) this.readCurve(input, frameIndex, timeline);\n\t\t\t\t\t}\n\t\t\t\t\ttimelines.push(timeline);\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[(frameCount - 1) * PathConstraintMixTimeline.ENTRIES]);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Deform timelines.\n\t\tfor (let i = 0, n = input.readInt(true); i < n; i++) {\n\t\t\tlet skin = skeletonData.skins[input.readInt(true)];\n\t\t\tfor (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {\n\t\t\t\tlet slotIndex = input.readInt(true);\n\t\t\t\tfor (let iii = 0, nnn = input.readInt(true); iii < nnn; iii++) {\n\t\t\t\t\tlet attachment = skin.getAttachment(slotIndex, input.readStringRef()) as VertexAttachment;\n\t\t\t\t\tlet weighted = attachment.bones != null;\n\t\t\t\t\tlet vertices = attachment.vertices;\n\t\t\t\t\tlet deformLength = weighted ? vertices.length / 3 * 2 : vertices.length;\n\n\t\t\t\t\tlet frameCount = input.readInt(true);\n\t\t\t\t\tlet timeline = new DeformTimeline(frameCount);\n\t\t\t\t\ttimeline.slotIndex = slotIndex;\n\t\t\t\t\ttimeline.attachment = attachment;\n\n\t\t\t\t\tfor (let frameIndex = 0; frameIndex < frameCount; frameIndex++) {\n\t\t\t\t\t\tlet time = input.readFloat();\n\t\t\t\t\t\tlet deform;\n\t\t\t\t\t\tlet end = input.readInt(true);\n\t\t\t\t\t\tif (end == 0)\n\t\t\t\t\t\t\tdeform = weighted ? Utils.newFloatArray(deformLength) : vertices;\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tdeform = Utils.newFloatArray(deformLength);\n\t\t\t\t\t\t\tlet start = input.readInt(true);\n\t\t\t\t\t\t\tend += start;\n\t\t\t\t\t\t\tif (scale == 1) {\n\t\t\t\t\t\t\t\tfor (let v = start; v < end; v++)\n\t\t\t\t\t\t\t\t\tdeform[v] = input.readFloat();\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tfor (let v = start; v < end; v++)\n\t\t\t\t\t\t\t\t\tdeform[v] = input.readFloat() * scale;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!weighted) {\n\t\t\t\t\t\t\t\tfor (let v = 0, vn = deform.length; v < vn; v++)\n\t\t\t\t\t\t\t\t\tdeform[v] += vertices[v];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttimeline.setFrame(frameIndex, time, deform);\n\t\t\t\t\t\tif (frameIndex < frameCount - 1) this.readCurve(input, frameIndex, timeline);\n\t\t\t\t\t}\n\t\t\t\t\ttimelines.push(timeline);\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[frameCount - 1]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Draw order timeline.\n\t\tlet drawOrderCount = input.readInt(true);\n\t\tif (drawOrderCount > 0) {\n\t\t\tlet timeline = new DrawOrderTimeline(drawOrderCount);\n\t\t\tlet slotCount = skeletonData.slots.length;\n\t\t\tfor (let i = 0; i < drawOrderCount; i++) {\n\t\t\t\tlet time = input.readFloat();\n\t\t\t\tlet offsetCount = input.readInt(true);\n\t\t\t\tlet drawOrder = Utils.newArray(slotCount, 0);\n\t\t\t\tfor (let ii = slotCount - 1; ii >= 0; ii--)\n\t\t\t\t\tdrawOrder[ii] = -1;\n\t\t\t\tlet unchanged = Utils.newArray(slotCount - offsetCount, 0);\n\t\t\t\tlet originalIndex = 0, unchangedIndex = 0;\n\t\t\t\tfor (let ii = 0; ii < offsetCount; ii++) {\n\t\t\t\t\tlet slotIndex = input.readInt(true);\n\t\t\t\t\t// Collect unchanged items.\n\t\t\t\t\twhile (originalIndex != slotIndex)\n\t\t\t\t\t\tunchanged[unchangedIndex++] = originalIndex++;\n\t\t\t\t\t// Set changed items.\n\t\t\t\t\tdrawOrder[originalIndex + input.readInt(true)] = originalIndex++;\n\t\t\t\t}\n\t\t\t\t// Collect remaining unchanged items.\n\t\t\t\twhile (originalIndex < slotCount)\n\t\t\t\t\tunchanged[unchangedIndex++] = originalIndex++;\n\t\t\t\t// Fill in unchanged items.\n\t\t\t\tfor (let ii = slotCount - 1; ii >= 0; ii--)\n\t\t\t\t\tif (drawOrder[ii] == -1) drawOrder[ii] = unchanged[--unchangedIndex];\n\t\t\t\ttimeline.setFrame(i, time, drawOrder);\n\t\t\t}\n\t\t\ttimelines.push(timeline);\n\t\t\tduration = Math.max(duration, timeline.frames[drawOrderCount - 1]);\n\t\t}\n\n\t\t// Event timeline.\n\t\tlet eventCount = input.readInt(true);\n\t\tif (eventCount > 0) {\n\t\t\tlet timeline = new EventTimeline(eventCount);\n\t\t\tfor (let i = 0; i < eventCount; i++) {\n\t\t\t\tlet time = input.readFloat();\n\t\t\t\tlet eventData = skeletonData.events[input.readInt(true)];\n\t\t\t\tlet event = new Event(time, eventData);\n\t\t\t\tevent.intValue = input.readInt(false);\n\t\t\t\tevent.floatValue = input.readFloat();\n\t\t\t\tevent.stringValue = input.readBoolean() ? input.readString() : eventData.stringValue;\n\t\t\t\tif (event.data.audioPath != null) {\n\t\t\t\t\tevent.volume = input.readFloat();\n\t\t\t\t\tevent.balance = input.readFloat();\n\t\t\t\t}\n\t\t\t\ttimeline.setFrame(i, event);\n\t\t\t}\n\t\t\ttimelines.push(timeline);\n\t\t\tduration = Math.max(duration, timeline.frames[eventCount - 1]);\n\t\t}\n\n\t\treturn new Animation(name, timelines, duration);\n\t}\n\n\tprivate readCurve (input: BinaryInput, frameIndex: number, timeline: CurveTimeline) {\n\t\tswitch (input.readByte()) {\n\t\tcase SkeletonBinary.CURVE_STEPPED:\n\t\t\ttimeline.setStepped(frameIndex);\n\t\t\tbreak;\n\t\tcase SkeletonBinary.CURVE_BEZIER:\n\t\t\tthis.setCurve(timeline, frameIndex, input.readFloat(), input.readFloat(), input.readFloat(), input.readFloat());\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tsetCurve (timeline: CurveTimeline, frameIndex: number, cx1: number, cy1: number, cx2: number, cy2: number) {\n\t\ttimeline.setCurve(frameIndex, cx1, cy1, cx2, cy2);\n\t}\n}\n\nclass BinaryInput {\n\tconstructor(data: Uint8Array, public strings = new Array<string>(), private index: number = 0, private buffer = new DataView(data.buffer)) { \n\n\t}\n\n\treadByte(): number {\n\t\treturn this.buffer.getInt8(this.index++);\n\t}\n\n\treadShort(): number {\n\t\tlet value = this.buffer.getInt16(this.index);\n\t\tthis.index += 2;\n\t\treturn value;\n\t}\n\n\treadInt32(): number {\n\t\t\tlet value = this.buffer.getInt32(this.index)\n\t\t\tthis.index += 4;\n\t\t\treturn value;\n\t}\n\n\treadInt(optimizePositive: boolean) {\n\t\tlet b = this.readByte();\n\t\tlet result = b & 0x7F;\n\t\tif ((b & 0x80) != 0) {\n\t\t\tb = this.readByte();\n\t\t\tresult |= (b & 0x7F) << 7;\n\t\t\tif ((b & 0x80) != 0) {\n\t\t\t\tb = this.readByte();\n\t\t\t\tresult |= (b & 0x7F) << 14;\n\t\t\t\tif ((b & 0x80) != 0) {\n\t\t\t\t\tb = this.readByte();\n\t\t\t\t\tresult |= (b & 0x7F) << 21;\n\t\t\t\t\tif ((b & 0x80) != 0) {\n\t\t\t\t\t\tb = this.readByte();\n\t\t\t\t\t\tresult |= (b & 0x7F) << 28;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn optimizePositive ? result : ((result >>> 1) ^ -(result & 1));\n\t}\n\n\treadStringRef (): string {\n\t\tlet index = this.readInt(true);\n\t\treturn index == 0 ? null : this.strings[index - 1];\n\t}\n\n\treadString (): string {\n\t\tlet byteCount = this.readInt(true);\n\t\tswitch (byteCount) {\n\t\tcase 0:\n\t\t\treturn null;\n\t\tcase 1:\n\t\t\treturn \"\";\n\t\t}\n\t\tbyteCount--;\n\t\tlet chars = \"\";\n\t\tlet charCount = 0;\n\t\tfor (let i = 0; i < byteCount;) {\n\t\t\tlet b = this.readByte();\n\t\t\tswitch (b >> 4) {\n\t\t\tcase 12:\n\t\t\tcase 13:\n\t\t\t\tchars += String.fromCharCode(((b & 0x1F) << 6 | this.readByte() & 0x3F));\n\t\t\t\ti += 2;\n\t\t\t\tbreak;\n\t\t\tcase 14:\n\t\t\t\tchars += String.fromCharCode(((b & 0x0F) << 12 | (this.readByte() & 0x3F) << 6 | this.readByte() & 0x3F));\n\t\t\t\ti += 3;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tchars += String.fromCharCode(b);\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t\treturn chars;\n\t}\n\n\treadFloat (): number {\n\t\tlet value = this.buffer.getFloat32(this.index);\n\t\tthis.index += 4;\n\t\treturn value;\n\t}\n\n\treadBoolean (): boolean {\n\t\treturn this.readByte() != 0;\n\t}\n}\n\nclass LinkedMesh {\n\tparent: string; skin: string;\n\tslotIndex: number;\n\tmesh: MeshAttachment;\n\tinheritDeform: boolean;\n\n\tconstructor (mesh: MeshAttachment, skin: string, slotIndex: number, parent: string, inheritDeform: boolean) {\n\t\tthis.mesh = mesh;\n\t\tthis.skin = skin;\n\t\tthis.slotIndex = slotIndex;\n\t\tthis.parent = parent;\n\t\tthis.inheritDeform = inheritDeform;\n\t}\n}\n\nclass Vertices {\n\tconstructor(public bones: Array<number> = null, public vertices: Array<number> | Float32Array = null) { }\n}","import {\n AssetPromise,\n Loader,\n LoadItem,\n resourceLoader,\n ResourceManager,\n TextureFilterMode,\n TextureWrapMode,\n Texture2D,\n Engine,\n Entity,\n MeshRenderer,\n} from '@galacean/engine';\nimport { AssetManager } from './spine-core/AssetManager';\nimport { TextureAtlas } from './spine-core/TextureAtlas';\nimport { Texture, TextureFilter } from './spine-core/Texture';\nimport { AtlasAttachmentLoader } from './spine-core/AtlasAttachmentLoader';\nimport { SkeletonJson } from './spine-core/SkeletonJson';\nimport { SkeletonBinary } from './spine-core/SkeletonBinary';\nimport { SpineAnimation } from './SpineAnimation';\n\ntype SpineResouce = {\n skeletonFile: string\n atlasFile: string\n textureFile?: string\n}\n\ntype SpineOpt = {\n scale: number;\n}\n\ntype SpineLoadItem = LoadItem & SpineOpt;\n\n// @ts-ignore\n@resourceLoader('spine', ['json', 'bin'])\nclass SpineLoader extends Loader<Entity> {\n load(item: SpineLoadItem, resourceManager: ResourceManager): AssetPromise<Entity> {\n return new AssetPromise((resolve, reject) => {\n const { engine } = resourceManager;\n // @ts-ignore\n if (item.type !== 'spine') {\n reject('Asset type must be spine.');\n }\n\n let resource: SpineResouce;\n\n if (!item.urls && item.url && this.checkUrl(item.url)) {\n resource = this.getResouceFromUrl(item.url);\n }\n\n if (item.urls && this.checkUrls(item.urls)) {\n resource = this.getResouceFromUrls(item.urls);\n }\n\n let autoLoadTexture: boolean = false;\n let assetManager: AssetManager;\n assetManager = new AssetManager(null, (img) => {\n return this.createAdaptiveTexture(img, engine);\n });\n\n const { skeletonFile, atlasFile, textureFile } = resource;\n\n // create spine entity on load complete\n assetManager.onLoadComplete = () => {\n try {\n let atlas: TextureAtlas;\n if (autoLoadTexture) {\n atlas = assetManager.get(atlasFile);\n } else {\n const atlasText = assetManager.get(atlasFile);\n atlas = new TextureAtlas(atlasText, this.textureAssetPicker.bind(this, assetManager, textureFile));\n }\n const atlasLoader = new AtlasAttachmentLoader(atlas);\n let skeletonLoader: SkeletonJson | SkeletonBinary;\n if (this.isBinFile(skeletonFile)) {\n skeletonLoader = new SkeletonBinary(atlasLoader);\n } else {\n skeletonLoader = new SkeletonJson(atlasLoader);\n }\n const skeletonData = skeletonLoader.readSkeletonData(assetManager.get(skeletonFile));\n const entity = new Entity(engine);\n const meshRenderer = entity.addComponent(MeshRenderer);\n const mtl = SpineAnimation.getDefaultMaterial(engine);\n meshRenderer.setMaterial(mtl);\n const spineAnimation = entity.addComponent(SpineAnimation);\n spineAnimation.setSkeletonData(skeletonData);\n resolve(entity);\n } catch (err) {\n reject(err);\n }\n }\n\n // load asset\n const isBinFile = this.isBinFile(skeletonFile);\n if (skeletonFile && atlasFile && textureFile) {\n if (isBinFile) {\n assetManager.loadBinary(skeletonFile, null, reject);\n } else {\n assetManager.loadText(skeletonFile, null, reject);\n }\n assetManager.loadText(atlasFile, null, reject);\n assetManager.loadTexture(textureFile, null, reject);\n } else if (skeletonFile && atlasFile && !textureFile) {\n autoLoadTexture = true;\n if (isBinFile) {\n assetManager.loadBinary(skeletonFile, null, reject);\n } else {\n assetManager.loadText(skeletonFile, null, reject);\n }\n assetManager.loadTextureAtlas(atlasFile, null, reject);\n } else {\n reject('Resouce param error');\n }\n });\n }\n\n textureAssetPicker(assetManager: AssetManager, textureFile: string) {\n return assetManager.get(textureFile);\n }\n\n createAdaptiveTexture(img, engine) {\n return new AdaptiveTexture(img, engine);\n }\n\n isBinFile(url: string): boolean {\n const ext = this.getExtFromUrl(url);\n return ext === 'bin';\n }\n\n checkUrl(url: string): boolean {\n const ext = this.getExtFromUrl(url);\n if (ext === 'json' || ext === 'bin') {\n return true\n }\n console.error('When use url as params, url must be json or bin file');\n return false;\n }\n\n getResouceFromUrl(url): SpineResouce {\n const skeletonFile = url;\n const atlasSuffix = '.atlas';\n let atlasFile = url;\n let queryStringPos = atlasFile.indexOf('?');\n if (queryStringPos > 0) {\n atlasFile = atlasFile.substr(0, queryStringPos);\n }\n atlasFile = atlasFile.substr(0, atlasFile.lastIndexOf('.')) + atlasSuffix;\n return { skeletonFile, atlasFile };\n }\n\n checkUrls(urls: string[]): boolean {\n if (urls.length < 2) {\n console.error('When use urls as params, urls should at least contain: json/bin and atlas');\n return false;\n }\n if (urls.length > 3) {\n console.error('Spine runtime dont support multiple texture now');\n return false;\n }\n \n const { skeletonFile, atlasFile, textureFile } = this.getResouceFromUrls(urls);\n if (skeletonFile && atlasFile) {\n return true;\n }\n console.error(`Lack ${skeletonFile ? '' : 'skeletonFile'}${!atlasFile ? '' : ' atlasFile'}`);\n return false;\n }\n\n getResouceFromUrls(urls: string[]): SpineResouce {\n let skeletonFile: string;\n let atlasFile: string;\n let textureFile: string;\n for (let i = 0; i < urls.length; i += 1) {\n const url = urls[i];\n const ext = this.getExtFromUrl(url);\n if (ext === 'json' || ext === 'bin') {\n skeletonFile = url;\n }\n if (ext === 'atlas') {\n atlasFile = url;\n }\n const imgMap = ['png', 'jpg', 'webp', 'jpeg'];\n if (imgMap.includes(ext)) {\n textureFile = url;\n }\n }\n return {\n skeletonFile,\n atlasFile,\n textureFile\n };\n }\n\n getExtFromUrl(url: string): string {\n return url.split(/[#?]/)[0].split('.').pop().trim();\n }\n}\n\n\nexport class AdaptiveTexture extends Texture {\n texture: Texture2D;\n\n constructor(data: HTMLImageElement, engine: Engine) {\n super(data);\n this.texture = new Texture2D(engine, data.width, data.height);\n this.texture.setImageSource(data);\n this.texture.generateMipmaps();\n }\n\n setFilters(minFilter: any, magFilter: any) {\n if (minFilter === TextureFilter.Nearest) {\n this.texture.filterMode = TextureFilterMode.Point;\n } else if (magFilter === TextureFilter.MipMapLinearLinear) {\n this.texture.filterMode = TextureFilterMode.Trilinear;\n } else {\n this.texture.filterMode = TextureFilterMode.Bilinear;\n }\n }\n\n // @ts-ignore\n setWraps(uWrap: TextureWrapMode, vWrap: TextureWrapMode) {\n this.texture.wrapModeU = uWrap;\n this.texture.wrapModeV = vWrap;\n }\n\n dispose() {}\n}\n\nexport { SpineLoader };\n","import {\n AssetPromise,\n Loader,\n LoadItem,\n resourceLoader,\n ResourceManager,\n TextureFilterMode,\n TextureWrapMode,\n Texture2D,\n Engine,\n Entity,\n MeshRenderer\n} from '@galacean/engine';\nimport { AssetManager } from './spine-core/AssetManager';\nimport { TextureAtlas } from './spine-core/TextureAtlas';\nimport { Texture, TextureFilter } from './spine-core/Texture';\nimport { AtlasAttachmentLoader } from './spine-core/AtlasAttachmentLoader';\nimport { SkeletonJson } from './spine-core/SkeletonJson';\nimport { SpineAnimation } from './SpineAnimation';\n\ntype SpineOpt = {\n scale: number;\n}\n\ntype SpineLoadItem = LoadItem & SpineOpt;\n\n@resourceLoader('antg_spine', ['json', 'bin'])\nclass SpineLoader extends Loader<Entity> {\n load(item: SpineLoadItem, resourceManager: ResourceManager): AssetPromise<Entity> {\n return new AssetPromise((resolve, reject) => {\n const { engine } = resourceManager;\n\n if (!item.url) {\n reject('AntG asset must be a json url.');\n return;\n }\n\n if (!this.checkUrl(item.url)) {\n reject('AntG asset must be a json url.');\n return;\n }\n\n const skeletonFile = item.url;\n let atlasFile: string;\n let textureFile: string;\n let jsonData: string;\n\n let assetManager: AssetManager;\n assetManager = new AssetManager(null, (img) => {\n return this.createAdaptiveTexture(img, engine);\n });\n\n loadText(skeletonFile).then((json: any) => {\n jsonData = json;\n if (!json._ext) {\n reject('AntG spine json must have ext data');\n } else {\n const { atlas, images } = json._ext;\n const imageKey = Object.keys(images)[0];\n const image = images[imageKey];\n atlasFile = atlas;\n textureFile = image;\n assetManager.loadText(atlas);\n assetManager.loadTexture(image);\n }\n }).catch(() => {\n reject('Resouce json load fail');\n });\n\n assetManager.onLoadComplete = () => {\n let atlas: TextureAtlas;\n const atlasText = assetManager.get(atlasFile);\n atlas = new TextureAtlas(atlasText, this.textureAssetPicker.bind(this, assetManager, textureFile));\n const atlasLoader = new AtlasAttachmentLoader(atlas);\n const skeletonLoader = new SkeletonJson(atlasLoader);\n const skeletonData = skeletonLoader.readSkeletonData(jsonData);\n const entity = new Entity(engine);\n const meshRenderer = entity.addComponent(MeshRenderer);\n meshRenderer.shaderData.enableMacro('USE_MODEL_MATRIX');\n meshRenderer.shaderData.enableMacro('USE_CUSTOM_TEXTURE');\n // @ts-ignore\n const mtl = engine._spriteDefaultMaterial.clone();\n meshRenderer.setMaterial(mtl);\n const spineAnimation = entity.addComponent(SpineAnimation);\n spineAnimation.setSkeletonData(skeletonData);\n resolve(entity);\n }\n });\n }\n\n textureAssetPicker(assetManager: AssetManager, textureFile: string) {\n return assetManager.get(textureFile);\n }\n\n createAdaptiveTexture(img, engine) {\n return new AdaptiveTexture(img, engine);\n }\n\n checkUrl(url: string): boolean {\n const ext = this.getExtFromUrl(url);\n if (ext === 'json') {\n return true\n }\n console.error('When use url as params, url must be a json file');\n return false;\n }\n\n getExtFromUrl(url: string): string {\n return url.split(/[#?]/)[0].split('.').pop().trim();\n }\n}\n\n\nexport class AdaptiveTexture extends Texture {\n texture: Texture2D;\n\n constructor(data: HTMLImageElement, engine: Engine) {\n super(data);\n this.texture = new Texture2D(engine, data.width, data.height);\n this.texture.setImageSource(data);\n this.texture.generateMipmaps();\n }\n\n setFilters(minFilter: any, magFilter: any) {\n if (minFilter === TextureFilter.Nearest) {\n this.texture.filterMode = TextureFilterMode.Point;\n } else if (magFilter === TextureFilter.MipMapLinearLinear) {\n this.texture.filterMode = TextureFilterMode.Trilinear;\n } else {\n this.texture.filterMode = TextureFilterMode.Bilinear;\n }\n }\n\n // @ts-ignore\n setWraps(uWrap: TextureWrapMode, vWrap: TextureWrapMode) {\n this.texture.wrapModeU = uWrap;\n this.texture.wrapModeV = vWrap;\n }\n\n dispose() {}\n}\n\nfunction loadText(url: string) {\n return new Promise((resolve, reject) => {\n let request = new XMLHttpRequest();\n request.responseType = 'json';\n request.open('GET', url, true);\n request.onload = () => {\n if (request.status == 200) {\n resolve(request.response);\n } else {\n reject(`status:${request.status}, ${request.responseText}`);\n }\n }\n request.onerror = () => {\n reject(`status:${request.status}, ${request.responseText}`);\n }\n request.send();\n });\n}\n\n\nexport { SpineLoader };\n","export { SpineAnimation } from './SpineAnimation';\nimport './SpineLoader';\nimport './AntGSpineLoader';\n\nexport { AssetManager } from './spine-core/AssetManager';\nexport { Texture } from './spine-core/Texture';\nexport { TextureAtlas } from './spine-core/TextureAtlas';\nexport { AtlasAttachmentLoader } from './spine-core/AtlasAttachmentLoader';\nexport { SkeletonJson } from './spine-core/SkeletonJson';\nexport { SkeletonBinary } from './spine-core/SkeletonBinary';\n\nexport const version = `__buildVersion`;\n\nconsole.log(`Galacean spine version :${version}`);\n"],"names":["_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","_create_class","Constructor","protoProps","staticProps","prototype","_extends","assign","arguments","source","hasOwnProperty","call","apply","this","_set_prototype_of","o","p","setPrototypeOf","__proto__","_inherits","subClass","superClass","TypeError","create","constructor","value","__decorate","decorators","desc","d","c","r","getOwnPropertyDescriptor","Reflect","decorate","_instanceof","left","right","Symbol","hasInstance","SuppressedError","IntSet","array","Array","add","contains","undefined","remove","clear","Color","g","b","a","set","clamp","setFromColor","setFromString","hex","charAt","substr","parseInt","rgba8888ToColor","color","rgb888ToColor","WHITE","RED","GREEN","BLUE","MAGENTA","MathUtils","min","max","cosDeg","degrees","Math","cos","degRad","sinDeg","sin","signum","toInt","x","floor","ceil","cbrt","y","pow","abs","randomTriangular","randomTriangularWith","mode","u","random","sqrt","PI","PI2","radiansToDegrees","radDeg","degreesToRadians","Utils","arrayCopy","sourceStart","dest","destStart","numElements","j","setArraySize","size","oldSize","ensureArrayCapacity","newArray","defaultValue","newFloatArray","SUPPORTS_TYPED_ARRAYS","Float32Array","newShortArray","Int16Array","toFloatArray","toSinglePrecision","fround","webkit602BugfixHelper","alpha","blend","element","identity","TransformMode","Pool","instantiator","items","obtain","pop","free","item","reset","push","freeAll","Vector2","normalize","len","BoneData","index","name","parent","rotation","scaleX","scaleY","shearX","shearY","transformMode","Normal","skinRequired","Error","OnlyTranslation","NoRotationOrReflection","NoScale","NoScaleOrReflection","PositionMode","SpacingMode","RotateMode","Bone","data","skeleton","children","ax","ay","arotation","ascaleX","ascaleY","ashearX","ashearY","appliedValid","worldY","worldX","sorted","active","setToSetupPose","isActive","update","updateWorldTransformWith","updateWorldTransform","rotationY","sx","sy","pa","pb","pc","pd","la","lb","lc","ld","s","prx","atan2","rx","ry","za","zc","zb","zd","getWorldRotationX","getWorldRotationY","getWorldScaleX","getWorldScaleY","updateAppliedTransform","pid","dx","dy","ia","id","ib","ic","ra","rb","rc","rd","det","worldToLocal","world","invDet","localToWorld","local","worldToLocalRotation","worldRotation","localToWorldRotation","localRotation","rotateWorld","Slot","bone","deform","darkColor","getSkeleton","getAttachment","attachment","setAttachment","attachmentTime","time","setAttachmentTime","getAttachmentTime","attachmentName","IkConstraint","bendDirection","compress","stretch","mix","softness","bones","findBone","apply1","uniform","apply2","targetX","targetY","rotationIK","tx","ty","sa","sc","dd","child","bendDir","px","py","psx","psy","csx","os1","os2","s2","cx","cy","cwx","cwy","pp","a1","a2","l1","l2","td","sd","outer","acos","aa","bb","ta","c1","c2","q","r0","r1","minAngle","minX","minDist","minY","maxAngle","maxX","maxDist","maxY","os","TransformConstraint","rotateMix","translateMix","scaleMix","shearMix","temp","relative","applyRelativeLocal","applyAbsoluteLocal","applyRelativeWorld","applyAbsoluteWorld","tb","tc","degRadReflect","offsetRotation","offsetShearY","n","modified","offsetX","offsetY","ts","offsetScaleX","offsetScaleY","by","ConstraintData","order","PathConstraintData","Fixed","Percent","Length","Tangent","Chain","ChainScale","Attachment","VertexAttachment","nextID","_this","worldVerticesLength","deformAttachment","self","ReferenceError","computeWorldVertices","slot","start","count","worldVertices","offset","stride","deformArray","vertices","v","skip","skeletonBones","w","wx","wy","vx","vy","weight","f","copyTo","PathAttachment","closed","constantSpeed","copy","lengths","PathConstraint","position","spacing","spaces","positions","curves","segments","findSlot","rotate","percentSpacing","spacingMode","rotateMode","tangents","scale","boneCount","spacesCount","lengthSpacing","setupLength","epsilon","computeWorldPositions","positionMode","boneX","boneY","tip","path","percentPosition","out","verticesLength","curveCount","prevCurve","NONE","pathLength","curve","space","BEFORE","addBeforePosition","AFTER","addAfterPosition","prev","addCurvePosition","x1","y1","cx1","cy1","cx2","cy2","x2","y2","tmpx","tmpy","dddfx","dddfy","ddfx","ddfy","dfx","dfy","curveLength","segment","ii","isNaN","tt","ttt","uu","uuu","ut","ut3","uut3","utt3","RegionAttachment","width","height","uvs","tempColor","updateOffset","regionScaleX","region","originalWidth","regionScaleY","originalHeight","localX","localY","localX2","localY2","radians","localXCos","localXSin","localYCos","localYSin","localX2Cos","localX2Sin","localY2Cos","localY2Sin","OX1","OY1","OX2","OY2","OX3","OY3","OX4","OY4","setRegion","v2","u2","vertexOffset","rendererObject","X1","Y1","C1R","C1G","C1B","C1A","U1","V1","X2","Y2","C2R","C2G","C2B","C2A","U2","V2","X3","Y3","C3R","C3G","C3B","C3A","U3","V3","X4","Y4","C4R","C4G","C4B","C4A","U4","V4","TextureFilter","TextureWrap","Texture","image","_image","getImage","filterFromString","text","toLowerCase","wrapFromString","Nearest","Linear","MipMap","MipMapNearestNearest","MipMapLinearNearest","MipMapNearestLinear","MipMapLinearLinear","MirroredRepeat","ClampToEdge","Repeat","MixBlend","MixDirection","TimelineType","TextureRegion","FakeTexture","setFilters","minFilter","magFilter","setWraps","uWrap","vWrap","dispose","TextureAtlas","atlasText","textureLoader","pages","regions","load","_proto","reader","TextureAtlasReader","tuple","page","line","readLine","trim","TextureAtlasRegion","rotateValue","readValue","toLocaleLowerCase","parseFloat","readTuple","texture","TextureAtlasPage","direction","findRegion","lines","split","colon","indexOf","substring","lastMatch","comma","MeshAttachment","updateUVs","regionUVs","textureWidth","textureHeight","getParentMesh","parentMesh","setParentMesh","triangles","hullLength","newLinkedMesh","edges","Skeleton","_updateCache","updateCacheReset","boneData","slots","drawOrder","slotData","ikConstraints","ikConstraintData","transformConstraints","transformConstraintData","pathConstraints","pathConstraintData","updateCache","skin","skinBones","ikCount","transformCount","pathCount","constraintCount","constraint","sortIkConstraint","sortTransformConstraint","sortPathConstraint","sortBone","constraints","constrained","sortReset","slotIndex","slotBone","sortPathConstraintAttachment","defaultSkin","skins","sortPathConstraintAttachmentWith","attachments","pathBones","boneIndex","setBonesToSetupPose","setSlotsToSetupPose","getRootBone","boneName","findBoneIndex","slotName","findSlotIndex","setSkinByName","skinName","findSkin","setSkin","newSkin","attachAll","getAttachmentByName","findIkConstraint","constraintName","ikConstraint","findTransformConstraint","findPathConstraint","getBounds","Number","POSITIVE_INFINITY","NEGATIVE_INFINITY","mesh","nn","delta","Animation","timelines","duration","timelineIds","getPropertyId","hasTimeline","lastTime","loop","events","binarySearch","values","step","low","high","current","linearSearch","last","setup","first","replace","mixIn","mixOut","translate","shear","event","transformConstraint","pathConstraintPosition","pathConstraintSpacing","pathConstraintMix","twoColor","CurveTimeline","frameCount","BEZIER_SIZE","getFrameCount","setLinear","frameIndex","LINEAR","setStepped","STEPPED","getCurveType","type","BEZIER","setCurve","getCurvePercent","percent","prevX","prevY","RotateTimeline","frames","setFrame","ROTATION","ENTRIES","PREV_ROTATION","frame","prevRotation","frameTime","PREV_TIME","TranslateTimeline","X","Y","PREV_X","PREV_Y","ScaleTimeline","bx","ShearTimeline","ColorTimeline","R","G","B","A","PREV_R","PREV_G","PREV_B","PREV_A","TwoColorTimeline","r2","g2","b2","R2","G2","B2","light","dark","setupLight","setupDark","PREV_R2","PREV_G2","PREV_B2","AttachmentTimeline","attachmentNames","zeros","DeformTimeline","frameVertices","firedEvents","slotAttachment","vertexCount","vertexAttachment","setupVertices","lastVertices","prevVertices","nextVertices","EventTimeline","MAX_VALUE","DrawOrderTimeline","drawOrders","drawOrderToSetupIndex","IkConstraintTimeline","ikConstraintIndex","MIX","SOFTNESS","BEND_DIRECTION","COMPRESS","STRETCH","PREV_MIX","PREV_SOFTNESS","PREV_BEND_DIRECTION","PREV_COMPRESS","PREV_STRETCH","TransformConstraintTimeline","transformConstraintIndex","ROTATE","TRANSLATE","SCALE","SHEAR","PREV_ROTATE","PREV_TRANSLATE","PREV_SCALE","PREV_SHEAR","PathConstraintPositionTimeline","pathConstraintIndex","VALUE","PREV_VALUE","PathConstraintSpacingTimeline","PathConstraintMixTimeline","AnimationState","tracks","timeScale","unkeyedState","listeners","queue","EventQueue","propertyIDs","animationsChanged","trackEntryPool","TrackEntry","animationLast","nextAnimationLast","trackLast","nextTrackLast","currentDelta","delay","next","nextTime","trackTime","setCurrent","mixingFrom","mixTime","trackEnd","end","disposeNext","updateMixingFrom","from","mixingTo","drain","to","finished","mixDuration","totalAlpha","interruptAlpha","_animationsChanged","applied","mixBlend","applyMixingFrom","animationTime","getAnimationTime","timelineCount","animation","timeline","applyAttachmentTimeline","timelineMode","firstFrame","timelinesRotation","timelineBlend","SUBSEQUENT","applyRotateTimeline","queueEvents","setupState","SETUP","attachmentState","eventThreshold","attachmentThreshold","drawOrderThreshold","alphaHold","alphaMix","timelineHoldMix","FIRST","HOLD_SUBSEQUENT","HOLD_FIRST","holdMix","CURRENT","rotateTimeline","total","diff","lastTotal","lastDiff","dir","entry","animationStart","animationEnd","trackLastWrapped","complete","clearTracks","oldDrainDisabled","drainDisabled","clearTrack","trackIndex","interrupt","expandToIndex","setAnimation","animationName","skeletonData","findAnimation","setAnimationWith","trackEntry","addAnimation","addAnimationWith","getMix","setEmptyAnimation","emptyAnimation","addEmptyAnimation","setEmptyAnimations","holdPrevious","computeHold","timelinesCount","timelineDipMix","HOLD_MIX","getCurrent","addListener","listener","removeListener","splice","clearListeners","clearListenerNotifications","EventType","setAnimationLast","isComplete","resetRotationDirections","animState","objects","AnimationStateData","animationToMixTime","defaultMix","setMix","fromName","toName","setMixWith","ClippingAttachment","endSlot","Triangulator","convexPolygons","convexPolygonsIndices","indicesArray","isConcaveArray","polygonPool","polygonIndicesPool","triangulate","verticesArray","indices","isConcave","previous","p1","p2","p3","p1x","p1y","p2x","p2y","p3x","p3y","positiveArea","previousIndex","nextIndex","decompose","polygonIndices","polygon","fanBaseIndex","lastWinding","t1","t2","t3","x3","y3","merged","winding1","winding","winding2","firstIndex","lastIndex","prevPrevX","prevPrevY","firstX","firstY","secondX","secondY","otherIndices","otherFirstIndex","otherSecondIndex","otherLastIndex","otherPoly","SkeletonClipping","triangulator","clippingPolygon","clipOutput","clippedVertices","clippedTriangles","scratch","clipStart","clip","clipAttachment","makeClockwise","clippingPolygons","clipEndWithSlot","clipEnd","isClipping","clipTriangles","trianglesLength","polygons","polygonsCount","vertexSize","u1","v1","u3","v3","clippedVerticesItems","clippedTrianglesItems","clipOutputLength","d0","d1","d2","d4","clipOutputCount","clipOutputItems","c0","clippingArea","output","originalOutput","clipped","input","clippingVertices","clippingVerticesLast","edgeX","edgeY","edgeX2","edgeY2","deltaX","deltaY","inputVertices","inputVerticesLength","outputStart","inputX","inputY","inputX2","inputY2","side2","ua","verticeslength","area","lastX","other","SpineMesh","initialize","engine","_mesh","BufferMesh","vertexElements","VertexElement","VertexElementFormat","Vector3","Vector4","vertexStride","MeshGenerator","VERTEX_STRIDE","byteLength","vertexBuffer","Buffer","BufferBindFlag","VertexBuffer","BufferUsage","Dynamic","indexBuffer","IndexBuffer","_indexBuffer","_vertexBuffer","setVertexBufferBinding","setIndexBufferBinding","IndexFormat","UInt16","setVertexElements","addSubMesh","changeBuffer","get","entity","_clipper","_spineMesh","_needResize","_subMeshItems","separateSlots","_engine","_entity","setting","meshRenderer","getComponent","MeshRenderer","_meshRenderer","_setting","QUAD_TRIANGLE_LENGTH","QUAD_TRIANGLES","_vertexCount","_prepareBufferData","console","warn","buildMesh","_ref","_ref_useClipping","useClipping","_ref_zSpacing","zSpacing","indicesLength","maxSlotCount","subMeshItems","_vertices","attachmentColor","z","numFloats","VERTEX_SIZE","regionAttachment","renderObject","meshAttachment","finalVertices","finalVerticesLength","finalIndices","finalIndicesLength","skeletonColor","slotColor","verts","indexStart","verticesWithZ","_verticesWithZ","_indices","includes","subMesh","SubMesh","prevSubMesh","materials","getMaterials","materialLength","mtl","shaderData","getTexture","setTexture","sort","clearSubMesh","subMeshItemLength","resize","setData","addSeparateSlot","Uint16Array","SpineMaterial","Material","shader","Shader","find","_spineVS","_spineFS","renderState","blendState","targetBlendState","enabled","sourceColorBlendFactor","BlendFactor","SourceAlpha","destinationColorBlendFactor","OneMinusSourceAlpha","sourceAlphaBlendFactor","One","destinationAlphaBlendFactor","colorBlendOperation","alphaBlendOperation","BlendOperation","Add","depthState","writeEnabled","rasterState","cullMode","CullMode","Off","renderQueueType","RenderQueueType","Transparent","SpineAnimation","Script","_tempOffset","_tempSize","_tempArray","autoUpdate","autoUpdateBounds","_meshGenerator","setSkeletonData","error","_skeletonData","_skeleton","animationData","_state","mtl1","_defaultMaterial","clone","mtl2","materialCount","setMaterial","hackSeparateSlotTexture","_this__meshGenerator","subMeshIndex","findIndex","getMaterial","onUpdate","updateState","deltaTime","state","updateGeometry","updateBounds","_this_setting","bounds","_cloneTo","_cloneSetting","_disposeCurrentSkeleton","onDestroy","getDefaultMaterial","isGCIgnored","_array_like_to_array","arr","arr2","_create_for_of_iterator_helper_loose","allowArrayLike","it","iterator","bind","isArray","minLen","toString","slice","test","_unsupported_iterable_to_array","done","ignoreClone","BlendMode","AssetManager","pathPrefix","assets","errors","toLoad","loaded","rawDataUris","downloadText","url","success","request","then","res","catch","err","downloadBinary","XMLHttpRequest","open","responseType","onload","status","Uint8Array","response","responseText","onerror","send","setRawDataURI","loadBinary","onLoad","loadText","JSON","stringify","loadImage","storagePath","img","Image","crossOrigin","ev","src","loadTexture","loadTextureAtlas","lastIndexOf","atlasData","atlasPage","pageLoadError","imagePath","pagesLoaded","atlasPages","atlas","e","ex","message","document","createElement","asset","removeAll","isLoadingComplete","onLoadComplete","getToLoad","getLoaded","hasErrors","keys","getErrors","BoundingBoxAttachment","PointAttachment","computeWorldPosition","point","computeWorldRotation","AtlasAttachmentLoader","newRegionAttachment","newMeshAttachment","newBoundingBoxAttachment","newPathAttachment","newPointAttachment","newClippingAttachment","SkeletonData","animations","fps","findEvent","eventDataName","findPathConstraintIndex","pathConstraintName","SlotData","IkConstraintData","TransformConstraintData","SkinEntry","Skin","addSkin","contained","getAttachments","copySkin","dictionary","removeAttachment","entries","slotAttachments","getAttachmentsForSlot","oldSkin","EventData","Additive","Multiply","Screen","AttachmentType","Event","SkeletonJson","attachmentLoader","linkedMeshes","readSkeletonData","json","root","parse","skeletonMap","hash","version","spine","imagesPath","images","boneMap","parentName","getValue","transformModeFromString","slotMap","blendMode","blendModeFromString","ik","constraintMap","targetName","transform","positionModeFromString","spacingModeFromString","rotateModeFromString","skinMap","entryName","readAttachment","linkedMesh","inheritDeform","eventName","eventMap","intValue","floatValue","stringValue","audioPath","volume","balance","animationMap","readAnimation","map","box","readVertices","LinkedMesh","weights","scaledVertices","timelineName","timelineMap","valueMap","readCurve","timelineScale","deformName","deformMap","weighted","deformLength","verticesValue","drawOrderNode","draworder","slotCount","drawOrderMap","offsets","unchanged","originalIndex","unchangedIndex","offsetMap","eventData","prop","str","Region","BoundingBox","Mesh","Path","Point","Clipping","SkeletonBinary","binary","BinaryInput","readString","readFloat","nonessential","readBoolean","readInt","strings","TransformModeValues","readInt32","readStringRef","BlendModeValues","readByte","PositionModeValues","SpacingModeValues","RotateModeValues","readSkin","typeIndex","AttachmentTypeValues","readFloatArray","readShortArray","endSlotIndex","Vertices","bonesArray","readShort","tempColor1","tempColor2","timelineType","SLOT_ATTACHMENT","SLOT_COLOR","SLOT_TWO_COLOR","BONE_ROTATE","BONE_TRANSLATE","BONE_SCALE","BONE_SHEAR","PATH_POSITION","PATH_SPACING","PATH_MIX","iii","nnn","vn","drawOrderCount","offsetCount","eventCount","CURVE_STEPPED","CURVE_BEZIER","CURVE_LINEAR","buffer","DataView","getInt8","getInt16","getInt32","optimizePositive","result","byteCount","chars","String","fromCharCode","getFloat32","SpineLoader","Loader","resourceManager","AssetPromise","resolve","reject","resource","urls","checkUrl","getResouceFromUrl","checkUrls","getResouceFromUrls","assetManager","autoLoadTexture","createAdaptiveTexture","skeletonFile","atlasFile","textureFile","textureAssetPicker","atlasLoader","isBinFile","Entity","addComponent","AdaptiveTexture","getExtFromUrl","ext","queryStringPos","_this_getResouceFromUrls","resourceLoader","Texture2D","setImageSource","generateMipmaps","filterMode","TextureFilterMode","Trilinear","Bilinear","wrapModeU","wrapModeV","jsonData","Promise","_ext","enableMacro","_spriteDefaultMaterial","log"],"mappings":"2aAAA,SAASA,EAAkBC,EAAQC,GAC/B,IAAK,IAAIC,EAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CACnC,IAAIE,EAAaH,EAAMC,GACvBE,EAAWC,WAAaD,EAAWC,aAAc,EACjDD,EAAWE,cAAe,EAEtB,UAAWF,IAAYA,EAAWG,UAAW,GAEjDC,OAAOC,eAAeT,EAAQI,EAAWM,IAAKN,EACjD,CACL,CACO,SAASO,EAAcC,EAAaC,EAAYC,GAInD,OAHID,GAAYd,EAAkBa,EAAYG,UAAWF,GACrDC,GAAaf,EAAkBa,EAAaE,GAEzCF,CACX,CChBO,SAASI,IAUZ,OATAA,EAAWR,OAAOS,QAAU,SAAgBjB,GACxC,IAAK,IAAIE,EAAI,EAAGA,EAAIgB,UAAUf,OAAQD,IAAK,CACvC,IAAIiB,EAASD,UAAUhB,GACvB,IAAK,IAAIQ,KAAOS,EAAYX,OAAOO,UAAUK,eAAeC,KAAKF,EAAQT,KAAMV,EAAOU,GAAOS,EAAOT,GACvG,CAED,OAAOV,CACf,EAEWgB,EAASM,MAAMC,KAAML,UAChC,CCXO,SAASM,EAAkBC,EAAGC,GAOjC,OANAF,EAAoBhB,OAAOmB,gBAAkB,SAAwBF,EAAGC,GAGpE,OAFAD,EAAEG,UAAYF,EAEPD,CACf,EAEWD,EAAkBC,EAAGC,EAChC,CCNO,SAASG,EAAUC,EAAUC,GAChC,GAA0B,mBAAfA,GAA4C,OAAfA,EACpC,MAAM,IAAIC,UAAU,sDAGxBF,EAASf,UAAYP,OAAOyB,OAAOF,GAAcA,EAAWhB,UAAW,CAAEmB,YAAa,CAAEC,MAAOL,EAAUvB,UAAU,EAAMD,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