dragonbones-pixijs
Version:
DragonBones runtime for pixi v8
1,116 lines • 344 kB
JavaScript
var De = Object.defineProperty;
var xe = (u, l, t) => l in u ? De(u, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[l] = t;
var a = (u, l, t) => (xe(u, typeof l != "symbol" ? l + "" : l, t), t);
import * as wt from "pixi.js";
import { Container as Oe, Sprite as Kt, Texture as vt, Graphics as ee, Rectangle as Ut, MeshSimple as de, Ticker as Ie } from "pixi.js";
class Fe {
/**
* - Creating a Worldclock instance. Typically, you do not need to create Worldclock instance.
* When multiple Worldclock instances are running at different speeds, can achieving some specific animation effects, such as bullet time.
* @version DragonBones 3.0
* @language en_US
*/
constructor(l = 0) {
/**
* - Current time. (In seconds)
* @version DragonBones 3.0
* @language en_US
*/
a(this, "time", 0);
/**
* - The play speed, used to control animation speed-shift play.
* [0: Stop play, (0~1): Slow play, 1: Normal play, (1~N): Fast play]
* @default 1.0
* @version DragonBones 3.0
* @language en_US
*/
a(this, "timeScale", 1);
a(this, "_systemTime", 0);
a(this, "_animatebles", []);
a(this, "_clock", null);
this.time = l, this._systemTime = (/* @__PURE__ */ new Date()).getTime() * 1e-3;
}
/**
* - Advance time for all IAnimatable instances.
* @param passedTime - Passed time. [-1: Automatically calculates the time difference between the current frame and the previous frame, [0~N): Passed time] (In seconds)
* @version DragonBones 3.0
* @language en_US
*/
advanceTime(l) {
l !== l && (l = 0);
const t = Date.now() * 1e-3;
if (l < 0 && (l = t - this._systemTime), this._systemTime = t, this.timeScale !== 1 && (l *= this.timeScale), l === 0)
return;
l < 0 ? this.time -= l : this.time += l;
let e = 0, i = 0, s = this._animatebles.length;
for (; e < s; ++e) {
const n = this._animatebles[e];
n !== null ? (i > 0 && (this._animatebles[e - i] = n, this._animatebles[e] = null), n.advanceTime(l)) : i++;
}
if (i > 0) {
for (s = this._animatebles.length; e < s; ++e) {
const n = this._animatebles[e];
n !== null ? this._animatebles[e - i] = n : i++;
}
this._animatebles.length -= i;
}
}
/**
* - Check whether contains a specific instance of IAnimatable.
* @param value - The IAnimatable instance.
* @version DragonBones 3.0
* @language en_US
*/
contains(l) {
if (l === this)
return !1;
let t = l;
for (; t !== this && t !== null; )
t = t.clock;
return t === this;
}
/**
* - Add IAnimatable instance.
* @param value - The IAnimatable instance.
* @version DragonBones 3.0
* @language en_US
*/
add(l) {
this._animatebles.indexOf(l) < 0 && (this._animatebles.push(l), l.clock = this);
}
/**
* - Removes a specified IAnimatable instance.
* @param value - The IAnimatable instance.
* @version DragonBones 3.0
* @language en_US
*/
remove(l) {
const t = this._animatebles.indexOf(l);
t >= 0 && (this._animatebles[t] = null, l.clock = null);
}
/**
* - Clear all IAnimatable instances.
* @version DragonBones 3.0
* @language en_US
*/
clear() {
for (const l of this._animatebles)
l !== null && (l.clock = null);
}
/**
* @inheritDoc
*/
get clock() {
return this._clock;
}
set clock(l) {
this._clock !== l && (this._clock !== null && this._clock.remove(this), this._clock = l, this._clock !== null && this._clock.add(this));
}
}
const H = class H {
constructor() {
/**
* - A unique identification number assigned to the object.
* @version DragonBones 4.5
* @language en_US
*/
a(this, "hashCode", H._hashCode++);
a(this, "_isInPool", !1);
}
static _returnObject(l) {
const t = String(l.constructor), e = t in H._maxCountMap ? H._maxCountMap[t] : H._defaultMaxCount, i = H._poolsMap[t] = H._poolsMap[t] || [];
i.length < e && (l._isInPool ? console.warn("The object is already in the pool.") : (l._isInPool = !0, i.push(l)));
}
static toString() {
throw new Error();
}
/**
* - Set the maximum cache count of the specify object pool.
* @param objectConstructor - The specify class. (Set all object pools max cache count if not set)
* @param maxCount - Max count.
* @version DragonBones 4.5
* @language en_US
*/
static setMaxCount(l, t) {
if ((t < 0 || t !== t) && (t = 0), l !== null) {
const e = String(l), i = e in H._poolsMap ? H._poolsMap[e] : null;
i !== null && i.length > t && (i.length = t), H._maxCountMap[e] = t;
} else {
H._defaultMaxCount = t;
for (let e in H._poolsMap) {
const i = H._poolsMap[e];
i.length > t && (i.length = t), e in H._maxCountMap && (H._maxCountMap[e] = t);
}
}
}
/**
* - Clear the cached instances of a specify object pool.
* @param objectConstructor - Specify class. (Clear all cached instances if not set)
* @version DragonBones 4.5
* @language en_US
*/
static clearPool(l = null) {
if (l !== null) {
const t = String(l), e = t in H._poolsMap ? H._poolsMap[t] : null;
e !== null && e.length > 0 && (e.length = 0);
} else
for (let t in H._poolsMap) {
const e = H._poolsMap[t];
e.length = 0;
}
}
/**
* - Get an instance of the specify class from object pool.
* @param objectConstructor - The specify class.
* @version DragonBones 4.5
* @language en_US
*/
static borrowObject(l) {
const t = String(l), e = t in H._poolsMap ? H._poolsMap[t] : null;
if (e !== null && e.length > 0) {
const s = e.pop();
return s._isInPool = !1, s;
}
const i = new l();
return i._onClear(), i;
}
/**
* - Clear the object and return it back to object pool。
* @version DragonBones 4.5
* @language en_US
*/
returnToPool() {
this._onClear(), H._returnObject(this);
}
};
a(H, "_hashCode", 0), a(H, "_defaultMaxCount", 3e3), a(H, "_maxCountMap", {}), a(H, "_poolsMap", {});
let I = H;
const ft = class ft extends I {
constructor() {
super(...arguments);
/**
* - If is a frame event, the value is used to describe the time that the event was in the animation timeline. (In seconds)
* @version DragonBones 4.5
* @language en_US
*/
a(this, "time");
/**
* - The event type。
* @version DragonBones 4.5
* @language en_US
*/
a(this, "type");
/**
* - The event name. (The frame event name or the frame sound name)
* @version DragonBones 4.5
* @language en_US
*/
a(this, "name");
/**
* - The armature that dispatch the event.
* @see dragonBones.Armature
* @version DragonBones 4.5
* @language en_US
*/
a(this, "armature");
/**
* - The bone that dispatch the event.
* @see dragonBones.Bone
* @version DragonBones 4.5
* @language en_US
*/
a(this, "bone");
/**
* - The slot that dispatch the event.
* @see dragonBones.Slot
* @version DragonBones 4.5
* @language en_US
*/
a(this, "slot");
/**
* - The animation state that dispatch the event.
* @see dragonBones.AnimationState
* @version DragonBones 4.5
* @language en_US
*/
a(this, "animationState");
/**
* @private
*/
a(this, "actionData");
/**
* @private
*/
/**
* - The custom data.
* @see dragonBones.CustomData
* @version DragonBones 5.0
* @language en_US
*/
/**
* - 自定义数据。
* @see dragonBones.CustomData
* @version DragonBones 5.0
* @language zh_CN
*/
a(this, "data");
}
/**
* @internal
* @private
*/
static actionDataToInstance(t, e, i) {
t.type === Z.Play ? e.type = ft.FRAME_EVENT : e.type = t.type === Z.Frame ? ft.FRAME_EVENT : ft.SOUND_EVENT, e.name = t.name, e.armature = i, e.actionData = t, e.data = t.data, t.bone !== null && (e.bone = i.getBone(t.bone.name)), t.slot !== null && (e.slot = i.getSlot(t.slot.name));
}
static toString() {
return "[class dragonBones.EventObject]";
}
_onClear() {
this.time = 0, this.type = "", this.name = "", this.armature = null, this.bone = null, this.slot = null, this.animationState = null, this.actionData = null, this.data = null;
}
};
/**
* - Animation start play.
* @version DragonBones 4.5
* @language en_US
*/
a(ft, "START", "start"), /**
* - Animation loop play complete once.
* @version DragonBones 4.5
* @language en_US
*/
a(ft, "LOOP_COMPLETE", "loopComplete"), /**
* - Animation play complete.
* @version DragonBones 4.5
* @language en_US
*/
a(ft, "COMPLETE", "complete"), /**
* - Animation fade in start.
* @version DragonBones 4.5
* @language en_US
*/
a(ft, "FADE_IN", "fadeIn"), /**
* - Animation fade in complete.
* @version DragonBones 4.5
* @language en_US
*/
a(ft, "FADE_IN_COMPLETE", "fadeInComplete"), /**
* - Animation fade out start.
* @version DragonBones 4.5
* @language en_US
*/
a(ft, "FADE_OUT", "fadeOut"), /**
* - Animation fade out complete.
* @version DragonBones 4.5
* @language en_US
*/
a(ft, "FADE_OUT_COMPLETE", "fadeOutComplete"), /**
* - Animation frame event.
* @version DragonBones 4.5
* @language en_US
*/
a(ft, "FRAME_EVENT", "frameEvent"), /**
* - Animation frame sound event.
* @version DragonBones 4.5
* @language en_US
*/
a(ft, "SOUND_EVENT", "soundEvent");
let W = ft;
var O = /* @__PURE__ */ ((u) => (u[u.WeigthBoneCount = 0] = "WeigthBoneCount", u[u.WeigthFloatOffset = 1] = "WeigthFloatOffset", u[u.WeigthBoneIndices = 2] = "WeigthBoneIndices", u[u.GeometryVertexCount = 0] = "GeometryVertexCount", u[u.GeometryTriangleCount = 1] = "GeometryTriangleCount", u[u.GeometryFloatOffset = 2] = "GeometryFloatOffset", u[u.GeometryWeightOffset = 3] = "GeometryWeightOffset", u[u.GeometryVertexIndices = 4] = "GeometryVertexIndices", u[u.TimelineScale = 0] = "TimelineScale", u[u.TimelineOffset = 1] = "TimelineOffset", u[u.TimelineKeyFrameCount = 2] = "TimelineKeyFrameCount", u[u.TimelineFrameValueCount = 3] = "TimelineFrameValueCount", u[u.TimelineFrameValueOffset = 4] = "TimelineFrameValueOffset", u[u.TimelineFrameOffset = 5] = "TimelineFrameOffset", u[u.FramePosition = 0] = "FramePosition", u[u.FrameTweenType = 1] = "FrameTweenType", u[u.FrameTweenEasingOrCurveSampleCount = 2] = "FrameTweenEasingOrCurveSampleCount", u[u.FrameCurveSamples = 3] = "FrameCurveSamples", u[u.DeformVertexOffset = 0] = "DeformVertexOffset", u[u.DeformCount = 1] = "DeformCount", u[u.DeformValueCount = 2] = "DeformValueCount", u[u.DeformValueOffset = 3] = "DeformValueOffset", u[u.DeformFloatOffset = 4] = "DeformFloatOffset", u))(O || {}), Dt = /* @__PURE__ */ ((u) => (u[u.Armature = 0] = "Armature", u[u.MovieClip = 1] = "MovieClip", u[u.Stage = 2] = "Stage", u))(Dt || {}), st = /* @__PURE__ */ ((u) => (u[u.Bone = 0] = "Bone", u[u.Surface = 1] = "Surface", u))(st || {}), P = /* @__PURE__ */ ((u) => (u[u.Image = 0] = "Image", u[u.Armature = 1] = "Armature", u[u.Mesh = 2] = "Mesh", u[u.BoundingBox = 3] = "BoundingBox", u[u.Path = 4] = "Path", u))(P || {}), at = /* @__PURE__ */ ((u) => (u[u.Rectangle = 0] = "Rectangle", u[u.Ellipse = 1] = "Ellipse", u[u.Polygon = 2] = "Polygon", u))(at || {}), Z = /* @__PURE__ */ ((u) => (u[u.Play = 0] = "Play", u[u.Frame = 10] = "Frame", u[u.Sound = 11] = "Sound", u))(Z || {}), j = /* @__PURE__ */ ((u) => (u[u.Normal = 0] = "Normal", u[u.Add = 1] = "Add", u[u.Alpha = 2] = "Alpha", u[u.Darken = 3] = "Darken", u[u.Difference = 4] = "Difference", u[u.Erase = 5] = "Erase", u[u.HardLight = 6] = "HardLight", u[u.Invert = 7] = "Invert", u[u.Layer = 8] = "Layer", u[u.Lighten = 9] = "Lighten", u[u.Multiply = 10] = "Multiply", u[u.Overlay = 11] = "Overlay", u[u.Screen = 12] = "Screen", u[u.Subtract = 13] = "Subtract", u))(j || {}), q = /* @__PURE__ */ ((u) => (u[u.None = 0] = "None", u[u.Line = 1] = "Line", u[u.Curve = 2] = "Curve", u[u.QuadIn = 3] = "QuadIn", u[u.QuadOut = 4] = "QuadOut", u[u.QuadInOut = 5] = "QuadInOut", u))(q || {}), F = /* @__PURE__ */ ((u) => (u[u.Action = 0] = "Action", u[u.ZOrder = 1] = "ZOrder", u[u.BoneAll = 10] = "BoneAll", u[u.BoneTranslate = 11] = "BoneTranslate", u[u.BoneRotate = 12] = "BoneRotate", u[u.BoneScale = 13] = "BoneScale", u[u.Surface = 50] = "Surface", u[u.BoneAlpha = 60] = "BoneAlpha", u[u.SlotDisplay = 20] = "SlotDisplay", u[u.SlotColor = 21] = "SlotColor", u[u.SlotDeform = 22] = "SlotDeform", u[u.SlotZIndex = 23] = "SlotZIndex", u[u.SlotAlpha = 24] = "SlotAlpha", u[u.IKConstraint = 30] = "IKConstraint", u[u.AnimationProgress = 40] = "AnimationProgress", u[u.AnimationWeight = 41] = "AnimationWeight", u[u.AnimationParameter = 42] = "AnimationParameter", u))(F || {}), Nt = /* @__PURE__ */ ((u) => (u[u.None = 0] = "None", u[u.Additive = 1] = "Additive", u[u.Override = 2] = "Override", u))(Nt || {}), ut = /* @__PURE__ */ ((u) => (u[u.SameLayer = 1] = "SameLayer", u[u.SameGroup = 2] = "SameGroup", u[u.SameLayerAndGroup = 3] = "SameLayerAndGroup", u[u.All = 4] = "All", u[u.Single = 5] = "Single", u))(ut || {}), pt = /* @__PURE__ */ ((u) => (u[u.None = 0] = "None", u[u.E1D = 1] = "E1D", u))(pt || {}), Ee = /* @__PURE__ */ ((u) => (u[u.Additive = 0] = "Additive", u[u.Override = 1] = "Override", u))(Ee || {}), It = /* @__PURE__ */ ((u) => (u[u.IK = 0] = "IK", u[u.Path = 1] = "Path", u))(It || {}), Ot = /* @__PURE__ */ ((u) => (u[u.Fixed = 0] = "Fixed", u[u.Percent = 1] = "Percent", u))(Ot || {}), At = /* @__PURE__ */ ((u) => (u[u.Length = 0] = "Length", u[u.Fixed = 1] = "Fixed", u[u.Percent = 2] = "Percent", u))(At || {}), dt = /* @__PURE__ */ ((u) => (u[u.Tangent = 0] = "Tangent", u[u.Chain = 1] = "Chain", u[u.ChainScale = 2] = "ChainScale", u))(dt || {});
class _t {
constructor(l) {
a(this, "_clock", new Fe());
a(this, "_events", []);
a(this, "_objects", []);
a(this, "_eventManager", null);
this._eventManager = l;
}
advanceTime(l) {
if (this._objects.length > 0) {
for (const t of this._objects)
t.returnToPool();
this._objects.length = 0;
}
if (this._clock.advanceTime(l), this._events.length > 0) {
for (let t = 0; t < this._events.length; ++t) {
const e = this._events[t], i = e.armature;
i._armatureData !== null && (i.eventDispatcher.dispatchDBEvent(
e.type,
e
), e.type === W.SOUND_EVENT && this._eventManager.dispatchDBEvent(e.type, e)), this.bufferObject(e);
}
this._events.length = 0;
}
}
bufferEvent(l) {
this._events.indexOf(l) < 0 && this._events.push(l);
}
bufferObject(l) {
this._objects.indexOf(l) < 0 && this._objects.push(l);
}
get clock() {
return this._clock;
}
get eventManager() {
return this._eventManager;
}
}
a(_t, "VERSION", "5.7.000"), a(_t, "yDown", !0), a(_t, "debug", !1), a(_t, "debugDraw", !1);
class Ce extends I {
constructor() {
super(...arguments);
/**
* @private
*/
a(this, "pauseFadeOut");
/**
* - Fade out the pattern of other animation states when the animation state is fade in.
* This property is typically used to specify the substitution of multiple animation states blend.
* @default dragonBones.AnimationFadeOutMode.All
* @version DragonBones 5.0
* @language en_US
*/
a(this, "fadeOutMode");
/**
* @private
*/
a(this, "fadeOutTweenType");
/**
* @private
*/
a(this, "fadeOutTime");
/**
* @private
*/
a(this, "pauseFadeIn");
/**
* @private
*/
a(this, "actionEnabled");
/**
* @private
*/
a(this, "additive");
/**
* - Whether the animation state has control over the display property of the slots.
* Sometimes blend a animation state does not want it to control the display properties of the slots,
* especially if other animation state are controlling the display properties of the slots.
* @default true
* @version DragonBones 5.0
* @language en_US
*/
a(this, "displayControl");
/**
* - Whether to reset the objects without animation to the armature pose when the animation state is start to play.
* This property should usually be set to false when blend multiple animation states.
* @default true
* @version DragonBones 5.1
* @language en_US
*/
a(this, "resetToPose");
/**
* @private
*/
a(this, "fadeInTweenType");
/**
* - The play times. [0: Loop play, [1~N]: Play N times]
* @version DragonBones 3.0
* @language en_US
*/
a(this, "playTimes");
/**
* - The blend layer.
* High layer animation state will get the blend weight first.
* When the blend weight is assigned more than 1, the remaining animation states will no longer get the weight assigned.
* @readonly
* @version DragonBones 5.0
* @language en_US
*/
a(this, "layer");
/**
* - The start time of play. (In seconds)
* @default 0.0
* @version DragonBones 5.0
* @language en_US
*/
a(this, "position");
/**
* - The duration of play.
* [-1: Use the default value of the animation data, 0: Stop play, (0~N]: The duration] (In seconds)
* @default -1.0
* @version DragonBones 5.0
* @language en_US
*/
a(this, "duration");
/**
* - The play speed.
* The value is an overlay relationship with {@link dragonBones.Animation#timeScale}.
* [(-N~0): Reverse play, 0: Stop play, (0~1): Slow play, 1: Normal play, (1~N): Fast play]
* @default 1.0
* @version DragonBones 3.0
* @language en_US
*/
a(this, "timeScale");
/**
* - The blend weight.
* @default 1.0
* @version DragonBones 5.0
* @language en_US
*/
a(this, "weight");
/**
* - The fade in time.
* [-1: Use the default value of the animation data, [0~N]: The fade in time] (In seconds)
* @default -1.0
* @version DragonBones 5.0
* @language en_US
*/
a(this, "fadeInTime");
/**
* - The auto fade out time when the animation state play completed.
* [-1: Do not fade out automatically, [0~N]: The fade out time] (In seconds)
* @default -1.0
* @version DragonBones 5.0
* @language en_US
*/
a(this, "autoFadeOutTime");
/**
* - The name of the animation state. (Can be different from the name of the animation data)
* @version DragonBones 5.0
* @language en_US
*/
a(this, "name");
/**
* - The animation data name.
* @version DragonBones 5.0
* @language en_US
*/
a(this, "animation");
/**
* - The blend group name of the animation state.
* This property is typically used to specify the substitution of multiple animation states blend.
* @readonly
* @version DragonBones 5.0
* @language en_US
*/
a(this, "group");
/**
* @private
*/
a(this, "boneMask", []);
}
static toString() {
return "[class dragonBones.AnimationConfig]";
}
_onClear() {
this.pauseFadeOut = !0, this.fadeOutMode = ut.All, this.fadeOutTweenType = q.Line, this.fadeOutTime = -1, this.actionEnabled = !0, this.additive = !1, this.displayControl = !0, this.pauseFadeIn = !0, this.resetToPose = !0, this.fadeInTweenType = q.Line, this.playTimes = -1, this.layer = 0, this.position = 0, this.duration = -1, this.timeScale = -100, this.weight = 1, this.fadeInTime = -1, this.autoFadeOutTime = -1, this.name = "", this.animation = "", this.group = "", this.boneMask.length = 0;
}
/**
* @private
*/
clear() {
this._onClear();
}
/**
* @private
*/
copyFrom(t) {
this.pauseFadeOut = t.pauseFadeOut, this.fadeOutMode = t.fadeOutMode, this.autoFadeOutTime = t.autoFadeOutTime, this.fadeOutTweenType = t.fadeOutTweenType, this.actionEnabled = t.actionEnabled, this.additive = t.additive, this.displayControl = t.displayControl, this.pauseFadeIn = t.pauseFadeIn, this.resetToPose = t.resetToPose, this.playTimes = t.playTimes, this.layer = t.layer, this.position = t.position, this.duration = t.duration, this.timeScale = t.timeScale, this.fadeInTime = t.fadeInTime, this.fadeOutTime = t.fadeOutTime, this.fadeInTweenType = t.fadeInTweenType, this.weight = t.weight, this.name = t.name, this.animation = t.animation, this.group = t.group, this.boneMask.length = t.boneMask.length;
for (let e = 0, i = this.boneMask.length; e < i; ++e)
this.boneMask[e] = t.boneMask[e];
}
}
class Pt extends I {
constructor() {
super(...arguments);
a(this, "dirty");
/**
* -1: start, 0: play, 1: complete;
*/
a(this, "playState");
a(this, "currentPlayTimes");
a(this, "currentTime");
a(this, "target");
a(this, "_isTween");
a(this, "_valueOffset");
a(this, "_frameValueOffset");
a(this, "_frameOffset");
a(this, "_frameRate");
a(this, "_frameCount");
a(this, "_frameIndex");
a(this, "_frameRateR");
a(this, "_position");
a(this, "_duration");
a(this, "_timeScale");
a(this, "_timeOffset");
a(this, "_animationData");
a(this, "_timelineData");
a(this, "_armature");
a(this, "_animationState");
a(this, "_actionTimeline");
a(this, "_timelineArray");
a(this, "_frameArray");
a(this, "_valueArray");
a(this, "_frameIndices");
}
_onClear() {
this.dirty = !1, this.playState = -1, this.currentPlayTimes = 0, this.currentTime = -1, this.target = null, this._isTween = !1, this._valueOffset = 0, this._frameValueOffset = 0, this._frameOffset = 0, this._frameRate = 0, this._frameCount = 0, this._frameIndex = -1, this._frameRateR = 0, this._position = 0, this._duration = 0, this._timeScale = 1, this._timeOffset = 0, this._animationData = null, this._timelineData = null, this._armature = null, this._animationState = null, this._actionTimeline = null, this._frameArray = null, this._valueArray = null, this._timelineArray = null, this._frameIndices = null;
}
_setCurrentTime(t) {
const e = this.playState, i = this.currentPlayTimes, s = this.currentTime;
if (this._actionTimeline !== null && this._frameCount <= 1)
this.playState = this._actionTimeline.playState >= 0 ? 1 : -1, this.currentPlayTimes = 1, this.currentTime = this._actionTimeline.currentTime;
else if (this._actionTimeline === null || this._timeScale !== 1 || this._timeOffset !== 0) {
const n = this._animationState.playTimes, r = n * this._duration;
t *= this._timeScale, this._timeOffset !== 0 && (t += this._timeOffset * this._animationData.duration), n > 0 && (t >= r || t <= -r) ? (this.playState <= 0 && this._animationState._playheadState === 3 && (this.playState = 1), this.currentPlayTimes = n, t < 0 ? this.currentTime = 0 : this.currentTime = this.playState === 1 ? this._duration + 1e-6 : this._duration) : (this.playState !== 0 && this._animationState._playheadState === 3 && (this.playState = 0), t < 0 ? (t = -t, this.currentPlayTimes = Math.floor(t / this._duration), this.currentTime = this._duration - t % this._duration) : (this.currentPlayTimes = Math.floor(t / this._duration), this.currentTime = t % this._duration)), this.currentTime += this._position;
} else
this.playState = this._actionTimeline.playState, this.currentPlayTimes = this._actionTimeline.currentPlayTimes, this.currentTime = this._actionTimeline.currentTime;
return this.currentPlayTimes === i && this.currentTime === s ? !1 : ((e < 0 && this.playState !== e || this.playState <= 0 && this.currentPlayTimes !== i) && (this._frameIndex = -1), !0);
}
init(t, e, i) {
if (this._armature = t, this._animationState = e, this._timelineData = i, this._actionTimeline = this._animationState._actionTimeline, this === this._actionTimeline && (this._actionTimeline = null), this._animationData = this._animationState.animationData, this._frameRate = this._animationData.parent.frameRate, this._frameRateR = 1 / this._frameRate, this._position = this._animationState._position, this._duration = this._animationState._duration, this._timelineData !== null) {
const s = this._animationData.parent.parent;
this._frameArray = s.frameArray, this._timelineArray = s.timelineArray, this._frameIndices = s.frameIndices, this._frameCount = this._timelineArray[this._timelineData.offset + O.TimelineKeyFrameCount], this._frameValueOffset = this._timelineArray[this._timelineData.offset + O.TimelineFrameValueOffset], this._timeScale = 100 / this._timelineArray[this._timelineData.offset + O.TimelineScale], this._timeOffset = this._timelineArray[this._timelineData.offset + O.TimelineOffset] * 0.01;
}
}
fadeOut() {
this.dirty = !1;
}
update(t) {
if (this._setCurrentTime(t)) {
if (this._frameCount > 1) {
const e = Math.floor(
this.currentTime * this._frameRate
), i = this._frameIndices[this._timelineData.frameIndicesOffset + e];
this._frameIndex !== i && (this._frameIndex = i, this._frameOffset = this._animationData.frameOffset + this._timelineArray[this._timelineData.offset + O.TimelineFrameOffset + this._frameIndex], this._onArriveAtFrame());
} else
this._frameIndex < 0 && (this._frameIndex = 0, this._timelineData !== null && (this._frameOffset = this._animationData.frameOffset + this._timelineArray[this._timelineData.offset + O.TimelineFrameOffset]), this._onArriveAtFrame());
(this._isTween || this.dirty) && this._onUpdateFrame();
}
}
blend(t) {
}
}
class xt extends Pt {
constructor() {
super(...arguments);
a(this, "_tweenType");
a(this, "_curveCount");
a(this, "_framePosition");
a(this, "_frameDurationR");
a(this, "_tweenEasing");
a(this, "_tweenProgress");
a(this, "_valueScale");
}
static _getEasingValue(t, e, i) {
let s = e;
switch (t) {
case q.QuadIn:
s = Math.pow(e, 2);
break;
case q.QuadOut:
s = 1 - Math.pow(1 - e, 2);
break;
case q.QuadInOut:
s = 0.5 * (1 - Math.cos(e * Math.PI));
break;
}
return (s - e) * i + e;
}
static _getEasingCurveValue(t, e, i, s) {
if (t <= 0)
return 0;
if (t >= 1)
return 1;
const n = i > 0, r = i + 1, o = Math.floor(t * r);
let h = 0, f = 0;
return n ? (h = o === 0 ? 0 : e[s + o - 1], f = o === r - 1 ? 1e4 : e[s + o]) : (h = e[s + o - 1], f = e[s + o]), (h + (f - h) * (t * r - o)) * 1e-4;
}
_onClear() {
super._onClear(), this._tweenType = q.None, this._curveCount = 0, this._framePosition = 0, this._frameDurationR = 0, this._tweenEasing = 0, this._tweenProgress = 0, this._valueScale = 1;
}
_onArriveAtFrame() {
if (this._frameCount > 1 && (this._frameIndex !== this._frameCount - 1 || this._animationState.playTimes === 0 || this._animationState.currentPlayTimes < this._animationState.playTimes - 1))
if (this._tweenType = this._frameArray[this._frameOffset + O.FrameTweenType], this._isTween = this._tweenType !== q.None, this._isTween ? this._tweenType === q.Curve ? this._curveCount = this._frameArray[this._frameOffset + O.FrameTweenEasingOrCurveSampleCount] : this._tweenType !== q.None && this._tweenType !== q.Line && (this._tweenEasing = this._frameArray[this._frameOffset + O.FrameTweenEasingOrCurveSampleCount] * 0.01) : this.dirty = !0, this._framePosition = this._frameArray[this._frameOffset] * this._frameRateR, this._frameIndex === this._frameCount - 1)
this._frameDurationR = 1 / (this._animationData.duration - this._framePosition);
else {
const t = this._animationData.frameOffset + this._timelineArray[this._timelineData.offset + O.TimelineFrameOffset + this._frameIndex + 1], e = this._frameArray[t] * this._frameRateR - this._framePosition;
e > 0 ? this._frameDurationR = 1 / e : this._frameDurationR = 0;
}
else
this.dirty = !0, this._isTween = !1;
}
_onUpdateFrame() {
this._isTween && (this.dirty = !0, this._tweenProgress = (this.currentTime - this._framePosition) * this._frameDurationR, this._tweenType === q.Curve ? this._tweenProgress = xt._getEasingCurveValue(
this._tweenProgress,
this._frameArray,
this._curveCount,
this._frameOffset + O.FrameCurveSamples
) : this._tweenType !== q.Line && (this._tweenProgress = xt._getEasingValue(
this._tweenType,
this._tweenProgress,
this._tweenEasing
)));
}
}
class Lt extends xt {
constructor() {
super(...arguments);
a(this, "_current");
a(this, "_difference");
a(this, "_result");
}
_onClear() {
super._onClear(), this._current = 0, this._difference = 0, this._result = 0;
}
_onArriveAtFrame() {
if (super._onArriveAtFrame(), this._timelineData !== null) {
const t = this._valueScale, e = this._valueArray, i = this._valueOffset + this._frameValueOffset + this._frameIndex;
if (this._isTween) {
const s = this._frameIndex === this._frameCount - 1 ? this._valueOffset + this._frameValueOffset : i + 1;
t === 1 ? (this._current = e[i], this._difference = e[s] - this._current) : (this._current = e[i] * t, this._difference = e[s] * t - this._current);
} else
this._result = e[i] * t;
} else
this._result = 0;
}
_onUpdateFrame() {
super._onUpdateFrame(), this._isTween && (this._result = this._current + this._difference * this._tweenProgress);
}
}
class Mt extends xt {
constructor() {
super(...arguments);
a(this, "_currentA");
a(this, "_currentB");
a(this, "_differenceA");
a(this, "_differenceB");
a(this, "_resultA");
a(this, "_resultB");
}
_onClear() {
super._onClear(), this._currentA = 0, this._currentB = 0, this._differenceA = 0, this._differenceB = 0, this._resultA = 0, this._resultB = 0;
}
_onArriveAtFrame() {
if (super._onArriveAtFrame(), this._timelineData !== null) {
const t = this._valueScale, e = this._valueArray, i = this._valueOffset + this._frameValueOffset + this._frameIndex * 2;
if (this._isTween) {
const s = this._frameIndex === this._frameCount - 1 ? this._valueOffset + this._frameValueOffset : i + 2;
t === 1 ? (this._currentA = e[i], this._currentB = e[i + 1], this._differenceA = e[s] - this._currentA, this._differenceB = e[s + 1] - this._currentB) : (this._currentA = e[i] * t, this._currentB = e[i + 1] * t, this._differenceA = e[s] * t - this._currentA, this._differenceB = e[s + 1] * t - this._currentB);
} else
this._resultA = e[i] * t, this._resultB = e[i + 1] * t;
} else
this._resultA = 0, this._resultB = 0;
}
_onUpdateFrame() {
super._onUpdateFrame(), this._isTween && (this._resultA = this._currentA + this._differenceA * this._tweenProgress, this._resultB = this._currentB + this._differenceB * this._tweenProgress);
}
}
class Zt extends xt {
constructor() {
super(...arguments);
a(this, "_valueCount");
a(this, "_rd", []);
}
_onClear() {
super._onClear(), this._valueCount = 0, this._rd.length = 0;
}
_onArriveAtFrame() {
super._onArriveAtFrame();
const t = this._valueCount, e = this._rd;
if (this._timelineData !== null) {
const i = this._valueScale, s = this._valueArray, n = this._valueOffset + this._frameValueOffset + this._frameIndex * t;
if (this._isTween) {
const r = this._frameIndex === this._frameCount - 1 ? this._valueOffset + this._frameValueOffset : n + t;
if (i === 1)
for (let o = 0; o < t; ++o)
e[t + o] = s[r + o] - s[n + o];
else
for (let o = 0; o < t; ++o)
e[t + o] = (s[r + o] - s[n + o]) * i;
} else if (i === 1)
for (let r = 0; r < t; ++r)
e[r] = s[n + r];
else
for (let r = 0; r < t; ++r)
e[r] = s[n + r] * i;
} else
for (let i = 0; i < t; ++i)
e[i] = 0;
}
_onUpdateFrame() {
if (super._onUpdateFrame(), this._isTween) {
const t = this._valueCount, e = this._valueScale, i = this._tweenProgress, s = this._valueArray, n = this._rd, r = this._valueOffset + this._frameValueOffset + this._frameIndex * t;
if (e === 1)
for (let o = 0; o < t; ++o)
n[o] = s[r + o] + n[t + o] * i;
else
for (let o = 0; o < t; ++o)
n[o] = s[r + o] * e + n[t + o] * i;
}
}
}
const yt = class yt {
/**
* @private
*/
constructor(l = 0, t = 0, e = 0, i = 0, s = 1, n = 1) {
/**
* - Horizontal translate.
* @version DragonBones 3.0
* @language en_US
*/
a(this, "x");
/**
* - Vertical translate.
* @version DragonBones 3.0
* @language en_US
*/
a(this, "y");
/**
* - Skew. (In radians)
* @version DragonBones 3.0
* @language en_US
*/
a(this, "skew");
/**
* - rotation. (In radians)
* @version DragonBones 3.0
* @language en_US
*/
a(this, "rotation");
/**
* - Horizontal Scaling.
* @version DragonBones 3.0
* @language en_US
*/
a(this, "scaleX");
/**
* - Vertical scaling.
* @version DragonBones 3.0
* @language en_US
*/
a(this, "scaleY");
this.x = l, this.y = t, this.skew = e, this.rotation = i, this.scaleX = s, this.scaleY = n;
}
/**
* @private
*/
static normalizeRadian(l) {
return l = (l + Math.PI) % (Math.PI * 2), l += l > 0 ? -Math.PI : Math.PI, l;
}
toString() {
return "[object dragonBones.Transform] x:" + this.x + " y:" + this.y + " skewX:" + this.skew * 180 / Math.PI + " skewY:" + this.rotation * 180 / Math.PI + " scaleX:" + this.scaleX + " scaleY:" + this.scaleY;
}
/**
* @private
*/
copyFrom(l) {
return this.x = l.x, this.y = l.y, this.skew = l.skew, this.rotation = l.rotation, this.scaleX = l.scaleX, this.scaleY = l.scaleY, this;
}
/**
* @private
*/
identity() {
return this.x = this.y = 0, this.skew = this.rotation = 0, this.scaleX = this.scaleY = 1, this;
}
/**
* @private
*/
add(l) {
return this.x += l.x, this.y += l.y, this.skew += l.skew, this.rotation += l.rotation, this.scaleX *= l.scaleX, this.scaleY *= l.scaleY, this;
}
/**
* @private
*/
minus(l) {
return this.x -= l.x, this.y -= l.y, this.skew -= l.skew, this.rotation -= l.rotation, this.scaleX /= l.scaleX, this.scaleY /= l.scaleY, this;
}
/**
* @private
*/
fromMatrix(l) {
const t = this.scaleX, e = this.scaleY, i = yt.PI_Q;
this.x = l.tx, this.y = l.ty, this.rotation = Math.atan(l.b / l.a);
let s = Math.atan(-l.c / l.d);
return this.scaleX = this.rotation > -i && this.rotation < i ? l.a / Math.cos(this.rotation) : l.b / Math.sin(this.rotation), this.scaleY = s > -i && s < i ? l.d / Math.cos(s) : -l.c / Math.sin(s), t >= 0 && this.scaleX < 0 && (this.scaleX = -this.scaleX, this.rotation = this.rotation - Math.PI), e >= 0 && this.scaleY < 0 && (this.scaleY = -this.scaleY, s = s - Math.PI), this.skew = s - this.rotation, this;
}
/**
* @private
*/
toMatrix(l) {
return this.rotation === 0 ? (l.a = 1, l.b = 0) : (l.a = Math.cos(this.rotation), l.b = Math.sin(this.rotation)), this.skew === 0 ? (l.c = -l.b, l.d = l.a) : (l.c = -Math.sin(this.skew + this.rotation), l.d = Math.cos(this.skew + this.rotation)), this.scaleX !== 1 && (l.a *= this.scaleX, l.b *= this.scaleX), this.scaleY !== 1 && (l.c *= this.scaleY, l.d *= this.scaleY), l.tx = this.x, l.ty = this.y, this;
}
};
/**
* @private
*/
a(yt, "PI", Math.PI), /**
* @private
*/
a(yt, "PI_D", Math.PI * 2), /**
* @private
*/
a(yt, "PI_H", Math.PI / 2), /**
* @private
*/
a(yt, "PI_Q", Math.PI / 4), /**
* @private
*/
a(yt, "RAD_DEG", 180 / Math.PI), /**
* @private
*/
a(yt, "DEG_RAD", Math.PI / 180);
let v = yt;
class Me extends Pt {
static toString() {
return "[class dragonBones.ActionTimelineState]";
}
_onCrossFrame(l) {
const t = this._armature.eventDispatcher;
if (this._animationState.actionEnabled) {
const e = this._animationData.frameOffset + this._timelineArray[this._timelineData.offset + O.TimelineFrameOffset + l], i = this._frameArray[e + 1], s = this._animationData.parent.actions;
for (let n = 0; n < i; ++n) {
const r = this._frameArray[e + 2 + n], o = s[r];
if (o.type === Z.Play) {
const h = I.borrowObject(W);
h.time = this._frameArray[e] / this._frameRate, h.animationState = this._animationState, W.actionDataToInstance(o, h, this._armature), this._armature._bufferAction(h, !0);
} else {
const h = o.type === Z.Frame ? W.FRAME_EVENT : W.SOUND_EVENT;
if (o.type === Z.Sound || t.hasDBEventListener(h)) {
const f = I.borrowObject(W);
f.time = this._frameArray[e] / this._frameRate, f.animationState = this._animationState, W.actionDataToInstance(
o,
f,
this._armature
), this._armature._dragonBones.bufferEvent(f);
}
}
}
}
}
_onArriveAtFrame() {
}
_onUpdateFrame() {
}
update(l) {
const t = this.playState;
let e = this.currentPlayTimes, i = this.currentTime;
if (this._setCurrentTime(l)) {
const s = this._animationState._parent === null && this._animationState.actionEnabled, n = this._armature.eventDispatcher;
if (t < 0)
if (this.playState !== t) {
if (this._animationState.displayControl && this._animationState.resetToPose && this._armature._sortZOrder(null, 0), s && n.hasDBEventListener(W.START)) {
const f = I.borrowObject(W);
f.type = W.START, f.armature = this._armature, f.animationState = this._animationState, this._armature._dragonBones.bufferEvent(f);
}
} else
return;
const r = this._animationState.timeScale < 0;
let o = null, h = null;
if (s && this.currentPlayTimes !== e && (n.hasDBEventListener(W.LOOP_COMPLETE) && (o = I.borrowObject(W), o.type = W.LOOP_COMPLETE, o.armature = this._armature, o.animationState = this._animationState), this.playState > 0 && n.hasDBEventListener(W.COMPLETE) && (h = I.borrowObject(W), h.type = W.COMPLETE, h.armature = this._armature, h.animationState = this._animationState)), this._frameCount > 1) {
const f = this._timelineData, m = Math.floor(
this.currentTime * this._frameRate
), d = this._frameIndices[f.frameIndicesOffset + m];
if (this._frameIndex !== d) {
let c = this._frameIndex;
if (this._frameIndex = d, this._timelineArray !== null)
if (this._frameOffset = this._animationData.frameOffset + this._timelineArray[f.offset + O.TimelineFrameOffset + this._frameIndex], r) {
if (c < 0) {
const A = Math.floor(i * this._frameRate);
c = this._frameIndices[f.frameIndicesOffset + A], this.currentPlayTimes === e && c === d && (c = -1);
}
for (; c >= 0; ) {
const A = this._animationData.frameOffset + this._timelineArray[f.offset + O.TimelineFrameOffset + c], p = this._frameArray[A] / this._frameRate;
if (this._position <= p && p <= this._position + this._duration && this._onCrossFrame(c), o !== null && c === 0 && (this._armature._dragonBones.bufferEvent(o), o = null), c > 0 ? c-- : c = this._frameCount - 1, c === d)
break;
}
} else {
if (c < 0) {
const A = Math.floor(i * this._frameRate);
c = this._frameIndices[f.frameIndicesOffset + A];
const p = this._animationData.frameOffset + this._timelineArray[f.offset + O.TimelineFrameOffset + c], S = this._frameArray[p] / this._frameRate;
this.currentPlayTimes === e && (i <= S ? c > 0 ? c-- : c = this._frameCount - 1 : c === d && (c = -1));
}
for (; c >= 0; ) {
c < this._frameCount - 1 ? c++ : c = 0;
const A = this._animationData.frameOffset + this._timelineArray[f.offset + O.TimelineFrameOffset + c], p = this._frameArray[A] / this._frameRate;
if (this._position <= p && p <= this._position + this._duration && this._onCrossFrame(c), o !== null && c === 0 && (this._armature._dragonBones.bufferEvent(o), o = null), c === d)
break;
}
}
}
} else if (this._frameIndex < 0 && (this._frameIndex = 0, this._timelineData !== null)) {
this._frameOffset = this._animationData.frameOffset + this._timelineArray[this._timelineData.offset + O.TimelineFrameOffset];
const f = this._frameArray[this._frameOffset] / this._frameRate;
this.currentPlayTimes === e ? i <= f && this._onCrossFrame(this._frameIndex) : this._position <= f && (!r && o !== null && (this._armature._dragonBones.bufferEvent(o), o = null), this._onCrossFrame(this._frameIndex));
}
o !== null && this._armature._dragonBones.bufferEvent(o), h !== null && this._armature._dragonBones.bufferEvent(h);
}
}
setCurrentTime(l) {
this._setCurrentTime(l), this._frameIndex = -1;
}
}
class Be extends Pt {
static toString() {
return "[class dragonBones.ZOrderTimelineState]";
}
_onArriveAtFrame() {
this.playState >= 0 && (this._frameArray[this._frameOffset + 1] > 0 ? this._armature._sortZOrder(this._frameArray, this._frameOffset + 2) : this._armature._sortZOrder(null, 0));
}
_onUpdateFrame() {
}
}
class ie extends Zt {
static toString() {
return "[class dragonBones.BoneAllTimelineState]";
}
_onArriveAtFrame() {
super._onArriveAtFrame(), this._isTween && this._frameIndex === this._frameCount - 1 && (this._rd[2] = v.normalizeRadian(this._rd[2]), this._rd[3] = v.normalizeRadian(this._rd[3])), this._timelineData === null && (this._rd[4] = 1, this._rd[5] = 1);
}
init(l, t, e) {
super.init(l, t, e), this._valueOffset = this._animationData.frameFloatOffset, this._valueCount = 6, this._valueArray = this._animationData.parent.parent.frameFloatArray;
}
fadeOut() {
this.dirty = !1, this._rd[2] = v.normalizeRadian(this._rd[2]), this._rd[3] = v.normalizeRadian(this._rd[3]);
}
blend(l) {
const t = this._armature.armatureData.scale, e = this._rd, i = this.target, s = i.target, n = i.blendWeight, r = s.animationPose;
i.dirty > 1 ? (r.x += e[0] * n * t, r.y += e[1] * n * t, r.rotation += e[2] * n, r.skew += e[3] * n, r.scaleX += (e[4] - 1) * n, r.scaleY += (e[5] - 1) * n) : (r.x = e[0] * n * t, r.y = e[1] * n * t, r.rotation = e[2] * n, r.skew = e[3] * n, r.scaleX = (e[4] - 1) * n + 1, r.scaleY = (e[5] - 1) * n + 1), (l || this.dirty) && (this.dirty = !1, s._transformDirty = !0);
}
}
class we extends Mt {
static toString() {
return "[class dragonBones.BoneTranslateTimelineState]";
}
init(l, t, e) {
super.init(l, t, e), this._valueOffset = this._animationData.frameFloatOffset, this._valueScale = this._armature.armatureData.scale, this._valueArray = this._animationData.parent.parent.frameFloatArray;
}
blend(l) {
const t = this.target, e = t.target, i = t.blendWeight, s = e.animationPose;
t.dirty > 1 ? (s.x += this._resultA * i, s.y += this._resultB * i) : i !== 1 ? (s.x = this._resultA * i, s.y = this._resultB * i) : (s.x = this._resultA, s.y = this._resultB), (l || this.dirty) && (this.dirty = !1, e._transformDirty = !0);
}
}
class Ne extends Mt {
static toString() {
return "[class dragonBones.BoneRotateTimelineState]";
}
_onArriveAtFrame() {
super._onArriveAtFrame(), this._isTween && this._frameIndex === this._frameCount - 1 && (this._differenceA = v.normalizeRadian(this._differenceA), this._differenceB = v.normalizeRadian(this._differenceB));
}
init(l, t, e) {
super.init(l, t, e), this._valueOffset = this._animationData.frameFloatOffset, this._valueArray = this._animationData.parent.parent.frameFloatArray;
}
fadeOut() {
this.dirty = !1, this._resultA = v.normalizeRadian(this._resultA), this._resultB = v.normalizeRadian(this._resultB);
}
blend(l) {
const t = this.target, e = t.target, i = t.blendWeight, s = e.animationPose;
t.dirty > 1 ? (s.rotation += this._resultA * i, s.skew += this._resultB * i) : i !== 1 ? (s.rotation = this._resultA * i, s.skew = this._resultB * i) : (s.rotation = this._resultA, s.skew = this._resultB), (l || this.dirty) && (this.dirty = !1, e._transformDirty = !0);
}
}
class ke extends Mt {
static toString() {
return "[class dragonBones.BoneScaleTimelineState]";
}
_onArriveAtFrame() {
super._onArriveAtFrame(), this._timelineData === null && (this._resultA = 1, this._resultB = 1);
}
init(l, t, e) {
super.init(l, t, e), this._valueOffset = this._animationData.frameFloatOffset, this._valueArray = this._animationData.parent.parent.frameFloatArray;
}
blend(l) {
const t = this.target, e = t.target, i = t.blendWeight, s = e.animationPose;
t.dirty > 1 ? (s.scaleX += (this._resultA - 1) * i, s.scaleY += (this._resultB - 1) * i) : i !== 1 ? (s.scaleX = (this._resultA - 1) * i + 1, s.scaleY = (this._resultB - 1) * i + 1) : (s.scaleX = this._resultA, s.scaleY = this._resultB), (l || this.dirty) && (this.dirty = !1, e._transformDirty = !0);
}
}
class se extends Zt {
constructor() {
super(...arguments);
a(this, "_deformCount");
a(this, "_deformOffset");
a(this, "_sameValueOffset");
}
static toString() {
return "[class dragonBones.SurfaceTimelineState]";
}
_onClear() {
super._onClear(), this._deformCount = 0, this._deformOffset = 0, this._sameValueOffset = 0;
}
init(t, e, i) {
if (super.init(t, e, i), this._timelineData !== null) {
const s = this._animationData.parent.parent, n = s.frameIntArray, r = this._animationData.frameIntOffset + this._timelineArray[this._timelineData.offset + O.TimelineFrameValueCount];
this._valueOffset = this._animationData.frameFloatOffset, this._valueCount = n[r + O.DeformValueCount], this._deformCount = n[r + O.DeformCount], this._deformOffset = n[r + O.DeformValueOffset], this._sameValueOffset = n[r + O.DeformFloatOffset] + this._animationData.frameFloatOffset, this._valueScale = this._armature.armatureData.scale, this._valueArray = s.frameFloatArray, this._rd.length = this._valueCount * 2;
} else
this._deformCount = this.target.target._deformVertices.length;
}
blend(t) {
const e = this.target, i = e.target, s = e.blendWeight, n = i._deformVertices, r = this._valueArray;
if (r !== null) {
const o = this._valueCount, h = this._deformOffset, f = this._sameValueOffset, m = this._rd;
for (let d = 0; d < this._deformCount; ++d) {
let c = 0;
d < h ? c = r[f + d] : d < h + o ? c = m[d - h] : c = r[f + d - o], e.dirty > 1 ? n[d] += c * s : n[d] = c * s;
}
} else if (e.dirty === 1)
for (let o = 0; o < this._deformCount; ++o)
n[o] = 0;
(t || this.dirty) && (this.dirty = !1, i._transformDirty = !0);
}
}
class ae extends Lt {
static toString() {
return "[class dragonBones.AlphaTimelineState]";
}
_onArriveAtFrame() {
super._onArriveAtFrame(), this._timelineData === null && (this._result = 1);
}
init(l, t, e) {
super.init(l, t, e), this._valueOffset = this._animationData.frameIntOffset, this._valueScale = 0.01, this._valueArray = this._animationData.parent.parent.frameIntArray;
}
blend(l) {
const t = this.target, e = t.target, i = t.blendWeight;
t.dirty > 1 ? (e._alpha += this._result * i, e._alpha > 1 && (e._alpha = 1)) : e._alpha = this._result * i, (l || this.dirty) && (this.dirty = !1, this._armature._alphaDirty = !0);
}
}
class ne extends Pt {
static toString() {
return "[class dragonBones.SlotDisplayTimelineState]";
}
_onArriveAtFrame() {
if (this.playState >= 0) {
const l = this.target, t = this._timelineData !== null ? this._frameArray[this._frameOffset + 1] : l._slotData.displayIndex;
l.displayIndex !== t && l._setDisplayIndex(t, !0);
}
}
_onUpdateFrame() {
}
}
class re extends xt {
constructor() {
super(...arguments);
a(this, "_current", [0, 0, 0, 0, 0, 0, 0, 0]);
a(this, "_difference", [0, 0, 0, 0, 0, 0, 0, 0]);
a(this, "_result", [
0,
0,
0,
0,
0,
0,
0,
0
]);
}
static toString() {
return "[class dragonBones.SlotColorTimelineState]";
}
_onArriveAtFrame() {
if (super._onArriveAtFrame(), this._timelineData !== null) {
const t = this._animationData.parent.parent, e = t.colorArray, i = t.frameIntArray, s = this._animationData.frameIntOffset + this._frameValueOffset + this._frameIndex;
let n = i[s];
n < 0 && (n += 65536), this._isTween ? (this._current[0] = e[n++], this._current[1] = e[n++], this._current[2] = e[n++], this._current[3] = e[n++], this._current[4] = e[n++], this._current[5] = e[n++], this._current[6] = e[n++], this._current[7] = e[n++], this._frameIndex === this._frameCount - 1 ? n = i[this._animationData.frameIntOffset + this._frameValueOffset] : n = i[s + 1], n < 0 && (n += 65536), this._difference[0] = e[n++] - this._current[0], this._difference[1] = e[n++] - this._current[1], this._difference[2] = e[n++] - this._current[2], this._difference[3] = e[n++] - this._current[3], this._difference[4] = e[n++] - this._current[4], this._difference[5] = e[n++] - this._current[5], this._difference[6] = e[n++] - this._current[6], this._difference[7] = e[n++] - this._current[7]) : (this._result[0] = e[n++] * 0.01, this._result[1] = e[n++] * 0.01, this._result[2] = e[n++] * 0.01, this._result[3] = e[n++] * 0.01, this._result[4] = e[n++], this._result[5] = e[n++], this._result[6] = e[n++], this._result[7] = e[n++]);
} else {
const e = this.target.slotData.color;
this._result[0] = e.alphaMultiplier, this._result[1] = e.redMultiplier, this._result[2] = e.greenMultiplier, this._result[3] = e.blueMultiplie