@safe-engine/pixi 8.8.2 → 8.8.3

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.
Files changed (141) hide show
  1. package/dist/app.d.ts +1 -0
  2. package/dist/app.d.ts.map +1 -1
  3. package/dist/app.js +20 -1
  4. package/dist/dragonbones/DragonBonesComponent.d.ts +1 -1
  5. package/dist/dragonbones/DragonBonesComponent.d.ts.map +1 -1
  6. package/dist/dragonbones/DragonBonesComponent.js +1 -1
  7. package/dist/dragonbones/DragonBonesSystem.d.ts.map +1 -1
  8. package/dist/dragonbones/DragonBonesSystem.js +1 -1
  9. package/dist/dragonbones/db-pixi/PixiArmatureDisplay.d.ts +59 -0
  10. package/dist/dragonbones/db-pixi/PixiArmatureDisplay.d.ts.map +1 -0
  11. package/dist/dragonbones/db-pixi/PixiArmatureDisplay.js +180 -0
  12. package/dist/dragonbones/db-pixi/PixiFactory.d.ts +87 -0
  13. package/dist/dragonbones/db-pixi/PixiFactory.d.ts.map +1 -0
  14. package/dist/dragonbones/db-pixi/PixiFactory.js +159 -0
  15. package/dist/dragonbones/db-pixi/PixiSlot.d.ts +31 -0
  16. package/dist/dragonbones/db-pixi/PixiSlot.d.ts.map +1 -0
  17. package/dist/dragonbones/db-pixi/PixiSlot.js +332 -0
  18. package/dist/dragonbones/db-pixi/PixiTextureAtlasData.d.ts +38 -0
  19. package/dist/dragonbones/db-pixi/PixiTextureAtlasData.d.ts.map +1 -0
  20. package/dist/dragonbones/db-pixi/PixiTextureAtlasData.js +85 -0
  21. package/dist/dragonbones/db-pixi/index.d.ts +5 -0
  22. package/dist/dragonbones/db-pixi/index.d.ts.map +1 -0
  23. package/dist/dragonbones/db-pixi/index.js +4 -0
  24. package/dist/dragonbones/dragonBones/animation/Animation.d.ts +241 -0
  25. package/dist/dragonbones/dragonBones/animation/Animation.d.ts.map +1 -0
  26. package/dist/dragonbones/dragonBones/animation/Animation.js +692 -0
  27. package/dist/dragonbones/dragonBones/animation/AnimationState.d.ts +323 -0
  28. package/dist/dragonbones/dragonBones/animation/AnimationState.d.ts.map +1 -0
  29. package/dist/dragonbones/dragonBones/animation/AnimationState.js +1161 -0
  30. package/dist/dragonbones/dragonBones/animation/BaseTimelineState.d.ts +100 -0
  31. package/dist/dragonbones/dragonBones/animation/BaseTimelineState.d.ts.map +1 -0
  32. package/dist/dragonbones/dragonBones/animation/BaseTimelineState.js +479 -0
  33. package/dist/dragonbones/dragonBones/animation/IAnimatable.d.ts +38 -0
  34. package/dist/dragonbones/dragonBones/animation/IAnimatable.d.ts.map +1 -0
  35. package/dist/dragonbones/dragonBones/animation/IAnimatable.js +9 -0
  36. package/dist/dragonbones/dragonBones/animation/TimelineState.d.ts +159 -0
  37. package/dist/dragonbones/dragonBones/animation/TimelineState.d.ts.map +1 -0
  38. package/dist/dragonbones/dragonBones/animation/TimelineState.js +998 -0
  39. package/dist/dragonbones/dragonBones/animation/WorldClock.d.ts +74 -0
  40. package/dist/dragonbones/dragonBones/animation/WorldClock.d.ts.map +1 -0
  41. package/dist/dragonbones/dragonBones/animation/WorldClock.js +162 -0
  42. package/dist/dragonbones/dragonBones/armature/Armature.d.ts +314 -0
  43. package/dist/dragonbones/dragonBones/armature/Armature.d.ts.map +1 -0
  44. package/dist/dragonbones/dragonBones/armature/Armature.js +650 -0
  45. package/dist/dragonbones/dragonBones/armature/Bone.d.ts +123 -0
  46. package/dist/dragonbones/dragonBones/armature/Bone.d.ts.map +1 -0
  47. package/dist/dragonbones/dragonBones/armature/Bone.js +438 -0
  48. package/dist/dragonbones/dragonBones/armature/Constraint.d.ts +99 -0
  49. package/dist/dragonbones/dragonBones/armature/Constraint.d.ts.map +1 -0
  50. package/dist/dragonbones/dragonBones/armature/Constraint.js +672 -0
  51. package/dist/dragonbones/dragonBones/armature/IArmatureProxy.d.ts +47 -0
  52. package/dist/dragonbones/dragonBones/armature/IArmatureProxy.d.ts.map +1 -0
  53. package/dist/dragonbones/dragonBones/armature/IArmatureProxy.js +1 -0
  54. package/dist/dragonbones/dragonBones/armature/Slot.d.ts +357 -0
  55. package/dist/dragonbones/dragonBones/armature/Slot.d.ts.map +1 -0
  56. package/dist/dragonbones/dragonBones/armature/Slot.js +1009 -0
  57. package/dist/dragonbones/dragonBones/armature/Surface.d.ts +41 -0
  58. package/dist/dragonbones/dragonBones/armature/Surface.d.ts.map +1 -0
  59. package/dist/dragonbones/dragonBones/armature/Surface.js +463 -0
  60. package/dist/dragonbones/dragonBones/armature/TransformObject.d.ts +80 -0
  61. package/dist/dragonbones/dragonBones/armature/TransformObject.d.ts.map +1 -0
  62. package/dist/dragonbones/dragonBones/armature/TransformObject.js +77 -0
  63. package/dist/dragonbones/dragonBones/core/BaseObject.d.ts +53 -0
  64. package/dist/dragonbones/dragonBones/core/BaseObject.d.ts.map +1 -0
  65. package/dist/dragonbones/dragonBones/core/BaseObject.js +130 -0
  66. package/dist/dragonbones/dragonBones/core/DragonBones.d.ts +236 -0
  67. package/dist/dragonbones/dragonBones/core/DragonBones.d.ts.map +1 -0
  68. package/dist/dragonbones/dragonBones/core/DragonBones.js +61 -0
  69. package/dist/dragonbones/dragonBones/event/EventObject.d.ts +143 -0
  70. package/dist/dragonbones/dragonBones/event/EventObject.d.ts.map +1 -0
  71. package/dist/dragonbones/dragonBones/event/EventObject.js +99 -0
  72. package/dist/dragonbones/dragonBones/event/IEventDispatcher.d.ts +48 -0
  73. package/dist/dragonbones/dragonBones/event/IEventDispatcher.d.ts.map +1 -0
  74. package/dist/dragonbones/dragonBones/event/IEventDispatcher.js +1 -0
  75. package/dist/dragonbones/dragonBones/factory/BaseFactory.d.ts +292 -0
  76. package/dist/dragonbones/dragonBones/factory/BaseFactory.d.ts.map +1 -0
  77. package/dist/dragonbones/dragonBones/factory/BaseFactory.js +735 -0
  78. package/dist/dragonbones/dragonBones/geom/ColorTransform.d.ts +17 -0
  79. package/dist/dragonbones/dragonBones/geom/ColorTransform.d.ts.map +1 -0
  80. package/dist/dragonbones/dragonBones/geom/ColorTransform.js +33 -0
  81. package/dist/dragonbones/dragonBones/geom/Curve.d.ts +10 -0
  82. package/dist/dragonbones/dragonBones/geom/Curve.d.ts.map +1 -0
  83. package/dist/dragonbones/dragonBones/geom/Curve.js +26 -0
  84. package/dist/dragonbones/dragonBones/geom/Matrix.d.ts +105 -0
  85. package/dist/dragonbones/dragonBones/geom/Matrix.d.ts.map +1 -0
  86. package/dist/dragonbones/dragonBones/geom/Matrix.js +207 -0
  87. package/dist/dragonbones/dragonBones/geom/Point.d.ts +38 -0
  88. package/dist/dragonbones/dragonBones/geom/Point.d.ts.map +1 -0
  89. package/dist/dragonbones/dragonBones/geom/Point.js +31 -0
  90. package/dist/dragonbones/dragonBones/geom/Rectangle.d.ts +53 -0
  91. package/dist/dragonbones/dragonBones/geom/Rectangle.d.ts.map +1 -0
  92. package/dist/dragonbones/dragonBones/geom/Rectangle.js +37 -0
  93. package/dist/dragonbones/dragonBones/geom/Transform.d.ts +102 -0
  94. package/dist/dragonbones/dragonBones/geom/Transform.d.ts.map +1 -0
  95. package/dist/dragonbones/dragonBones/geom/Transform.js +170 -0
  96. package/dist/dragonbones/dragonBones/index.d.ts +37 -0
  97. package/dist/dragonbones/dragonBones/index.d.ts.map +1 -0
  98. package/dist/dragonbones/dragonBones/index.js +36 -0
  99. package/dist/dragonbones/dragonBones/model/AnimationConfig.d.ts +162 -0
  100. package/dist/dragonbones/dragonBones/model/AnimationConfig.d.ts.map +1 -0
  101. package/dist/dragonbones/dragonBones/model/AnimationConfig.js +81 -0
  102. package/dist/dragonbones/dragonBones/model/AnimationData.d.ts +174 -0
  103. package/dist/dragonbones/dragonBones/model/AnimationData.d.ts.map +1 -0
  104. package/dist/dragonbones/dragonBones/model/AnimationData.js +256 -0
  105. package/dist/dragonbones/dragonBones/model/ArmatureData.d.ts +319 -0
  106. package/dist/dragonbones/dragonBones/model/ArmatureData.d.ts.map +1 -0
  107. package/dist/dragonbones/dragonBones/model/ArmatureData.js +450 -0
  108. package/dist/dragonbones/dragonBones/model/BoundingBoxData.d.ts +188 -0
  109. package/dist/dragonbones/dragonBones/model/BoundingBoxData.d.ts.map +1 -0
  110. package/dist/dragonbones/dragonBones/model/BoundingBoxData.js +500 -0
  111. package/dist/dragonbones/dragonBones/model/CanvasData.d.ts +15 -0
  112. package/dist/dragonbones/dragonBones/model/CanvasData.d.ts.map +1 -0
  113. package/dist/dragonbones/dragonBones/model/CanvasData.js +17 -0
  114. package/dist/dragonbones/dragonBones/model/ConstraintData.d.ts +46 -0
  115. package/dist/dragonbones/dragonBones/model/ConstraintData.d.ts.map +1 -0
  116. package/dist/dragonbones/dragonBones/model/ConstraintData.js +57 -0
  117. package/dist/dragonbones/dragonBones/model/DisplayData.d.ts +98 -0
  118. package/dist/dragonbones/dragonBones/model/DisplayData.d.ts.map +1 -0
  119. package/dist/dragonbones/dragonBones/model/DisplayData.js +174 -0
  120. package/dist/dragonbones/dragonBones/model/DragonBonesData.d.ts +108 -0
  121. package/dist/dragonbones/dragonBones/model/DragonBonesData.d.ts.map +1 -0
  122. package/dist/dragonbones/dragonBones/model/DragonBonesData.js +86 -0
  123. package/dist/dragonbones/dragonBones/model/SkinData.d.ts +40 -0
  124. package/dist/dragonbones/dragonBones/model/SkinData.d.ts.map +1 -0
  125. package/dist/dragonbones/dragonBones/model/SkinData.js +68 -0
  126. package/dist/dragonbones/dragonBones/model/TextureAtlasData.d.ts +73 -0
  127. package/dist/dragonbones/dragonBones/model/TextureAtlasData.d.ts.map +1 -0
  128. package/dist/dragonbones/dragonBones/model/TextureAtlasData.js +102 -0
  129. package/dist/dragonbones/dragonBones/model/UserData.d.ts +73 -0
  130. package/dist/dragonbones/dragonBones/model/UserData.d.ts.map +1 -0
  131. package/dist/dragonbones/dragonBones/model/UserData.js +101 -0
  132. package/dist/dragonbones/dragonBones/parser/BinaryDataParser.d.ts +29 -0
  133. package/dist/dragonbones/dragonBones/parser/BinaryDataParser.d.ts.map +1 -0
  134. package/dist/dragonbones/dragonBones/parser/BinaryDataParser.js +356 -0
  135. package/dist/dragonbones/dragonBones/parser/DataParser.d.ts +153 -0
  136. package/dist/dragonbones/dragonBones/parser/DataParser.d.ts.map +1 -0
  137. package/dist/dragonbones/dragonBones/parser/DataParser.js +283 -0
  138. package/dist/dragonbones/dragonBones/parser/ObjectDataParser.d.ts +130 -0
  139. package/dist/dragonbones/dragonBones/parser/ObjectDataParser.d.ts.map +1 -0
  140. package/dist/dragonbones/dragonBones/parser/ObjectDataParser.js +2098 -0
  141. package/package.json +1 -2
@@ -0,0 +1,998 @@
1
+ import { BaseObject } from "../core/BaseObject";
2
+ import { EventObject } from "../event/EventObject";
3
+ import { TimelineState, MutilpleValueTimelineState, DoubleValueTimelineState, SingleValueTimelineState, TweenTimelineState } from "./BaseTimelineState";
4
+ import { Transform } from "../geom/Transform";
5
+ /**
6
+ * @internal
7
+ */
8
+ export class ActionTimelineState extends TimelineState {
9
+ static toString() {
10
+ return "[class dragonBones.ActionTimelineState]";
11
+ }
12
+ _onCrossFrame(frameIndex) {
13
+ const eventDispatcher = this._armature.eventDispatcher;
14
+ if (this._animationState.actionEnabled) {
15
+ const frameOffset = this._animationData.frameOffset +
16
+ this._timelineArray[this._timelineData.offset +
17
+ 5 /* BinaryOffset.TimelineFrameOffset */ +
18
+ frameIndex];
19
+ const actionCount = this._frameArray[frameOffset + 1];
20
+ const actions = this._animationData.parent.actions; // May be the animaton data not belong to this armature data.
21
+ for (let i = 0; i < actionCount; ++i) {
22
+ const actionIndex = this._frameArray[frameOffset + 2 + i];
23
+ const action = actions[actionIndex];
24
+ if (action.type === 0 /* ActionType.Play */) {
25
+ const eventObject = BaseObject.borrowObject(EventObject);
26
+ // eventObject.time = this._frameArray[frameOffset] * this._frameRateR; // Precision problem
27
+ eventObject.time = this._frameArray[frameOffset] / this._frameRate;
28
+ eventObject.animationState = this._animationState;
29
+ EventObject.actionDataToInstance(action, eventObject, this._armature);
30
+ this._armature._bufferAction(eventObject, true);
31
+ }
32
+ else {
33
+ const eventType = action.type === 10 /* ActionType.Frame */
34
+ ? EventObject.FRAME_EVENT
35
+ : EventObject.SOUND_EVENT;
36
+ if (action.type === 11 /* ActionType.Sound */ ||
37
+ eventDispatcher.hasDBEventListener(eventType)) {
38
+ const eventObject = BaseObject.borrowObject(EventObject);
39
+ // eventObject.time = this._frameArray[frameOffset] * this._frameRateR; // Precision problem
40
+ eventObject.time = this._frameArray[frameOffset] / this._frameRate;
41
+ eventObject.animationState = this._animationState;
42
+ EventObject.actionDataToInstance(action, eventObject, this._armature);
43
+ this._armature._dragonBones.bufferEvent(eventObject);
44
+ }
45
+ }
46
+ }
47
+ }
48
+ }
49
+ _onArriveAtFrame() { }
50
+ _onUpdateFrame() { }
51
+ update(passedTime) {
52
+ const prevState = this.playState;
53
+ let prevPlayTimes = this.currentPlayTimes;
54
+ let prevTime = this.currentTime;
55
+ if (this._setCurrentTime(passedTime)) {
56
+ const eventActive = this._animationState._parent === null &&
57
+ this._animationState.actionEnabled;
58
+ const eventDispatcher = this._armature.eventDispatcher;
59
+ if (prevState < 0) {
60
+ if (this.playState !== prevState) {
61
+ if (this._animationState.displayControl &&
62
+ this._animationState.resetToPose) {
63
+ // Reset zorder to pose.
64
+ this._armature._sortZOrder(null, 0);
65
+ }
66
+ // prevPlayTimes = this.currentPlayTimes; // TODO
67
+ if (eventActive &&
68
+ eventDispatcher.hasDBEventListener(EventObject.START)) {
69
+ const eventObject = BaseObject.borrowObject(EventObject);
70
+ eventObject.type = EventObject.START;
71
+ eventObject.armature = this._armature;
72
+ eventObject.animationState = this._animationState;
73
+ this._armature._dragonBones.bufferEvent(eventObject);
74
+ }
75
+ }
76
+ else {
77
+ return;
78
+ }
79
+ }
80
+ const isReverse = this._animationState.timeScale < 0.0;
81
+ let loopCompleteEvent = null;
82
+ let completeEvent = null;
83
+ if (eventActive && this.currentPlayTimes !== prevPlayTimes) {
84
+ if (eventDispatcher.hasDBEventListener(EventObject.LOOP_COMPLETE)) {
85
+ loopCompleteEvent = BaseObject.borrowObject(EventObject);
86
+ loopCompleteEvent.type = EventObject.LOOP_COMPLETE;
87
+ loopCompleteEvent.armature = this._armature;
88
+ loopCompleteEvent.animationState = this._animationState;
89
+ }
90
+ if (this.playState > 0) {
91
+ if (eventDispatcher.hasDBEventListener(EventObject.COMPLETE)) {
92
+ completeEvent = BaseObject.borrowObject(EventObject);
93
+ completeEvent.type = EventObject.COMPLETE;
94
+ completeEvent.armature = this._armature;
95
+ completeEvent.animationState = this._animationState;
96
+ }
97
+ }
98
+ }
99
+ if (this._frameCount > 1) {
100
+ const timelineData = this._timelineData;
101
+ const timelineFrameIndex = Math.floor(this.currentTime * this._frameRate); // uint
102
+ const frameIndex = this._frameIndices[timelineData.frameIndicesOffset + timelineFrameIndex];
103
+ if (this._frameIndex !== frameIndex) {
104
+ // Arrive at frame.
105
+ let crossedFrameIndex = this._frameIndex;
106
+ this._frameIndex = frameIndex;
107
+ if (this._timelineArray !== null) {
108
+ this._frameOffset =
109
+ this._animationData.frameOffset +
110
+ this._timelineArray[timelineData.offset +
111
+ 5 /* BinaryOffset.TimelineFrameOffset */ +
112
+ this._frameIndex];
113
+ if (isReverse) {
114
+ if (crossedFrameIndex < 0) {
115
+ const prevFrameIndex = Math.floor(prevTime * this._frameRate);
116
+ crossedFrameIndex =
117
+ this._frameIndices[timelineData.frameIndicesOffset + prevFrameIndex];
118
+ if (this.currentPlayTimes === prevPlayTimes) {
119
+ // Start.
120
+ if (crossedFrameIndex === frameIndex) {
121
+ // Uncrossed.
122
+ crossedFrameIndex = -1;
123
+ }
124
+ }
125
+ }
126
+ while (crossedFrameIndex >= 0) {
127
+ const frameOffset = this._animationData.frameOffset +
128
+ this._timelineArray[timelineData.offset +
129
+ 5 /* BinaryOffset.TimelineFrameOffset */ +
130
+ crossedFrameIndex];
131
+ // const framePosition = this._frameArray[frameOffset] * this._frameRateR; // Precision problem
132
+ const framePosition = this._frameArray[frameOffset] / this._frameRate;
133
+ if (this._position <= framePosition &&
134
+ framePosition <= this._position + this._duration) {
135
+ // Support interval play.
136
+ this._onCrossFrame(crossedFrameIndex);
137
+ }
138
+ if (loopCompleteEvent !== null && crossedFrameIndex === 0) {
139
+ // Add loop complete event after first frame.
140
+ this._armature._dragonBones.bufferEvent(loopCompleteEvent);
141
+ loopCompleteEvent = null;
142
+ }
143
+ if (crossedFrameIndex > 0) {
144
+ crossedFrameIndex--;
145
+ }
146
+ else {
147
+ crossedFrameIndex = this._frameCount - 1;
148
+ }
149
+ if (crossedFrameIndex === frameIndex) {
150
+ break;
151
+ }
152
+ }
153
+ }
154
+ else {
155
+ if (crossedFrameIndex < 0) {
156
+ const prevFrameIndex = Math.floor(prevTime * this._frameRate);
157
+ crossedFrameIndex =
158
+ this._frameIndices[timelineData.frameIndicesOffset + prevFrameIndex];
159
+ const frameOffset = this._animationData.frameOffset +
160
+ this._timelineArray[timelineData.offset +
161
+ 5 /* BinaryOffset.TimelineFrameOffset */ +
162
+ crossedFrameIndex];
163
+ // const framePosition = this._frameArray[frameOffset] * this._frameRateR; // Precision problem
164
+ const framePosition = this._frameArray[frameOffset] / this._frameRate;
165
+ if (this.currentPlayTimes === prevPlayTimes) {
166
+ // Start.
167
+ if (prevTime <= framePosition) {
168
+ // Crossed.
169
+ if (crossedFrameIndex > 0) {
170
+ crossedFrameIndex--;
171
+ }
172
+ else {
173
+ crossedFrameIndex = this._frameCount - 1;
174
+ }
175
+ }
176
+ else if (crossedFrameIndex === frameIndex) {
177
+ // Uncrossed.
178
+ crossedFrameIndex = -1;
179
+ }
180
+ }
181
+ }
182
+ while (crossedFrameIndex >= 0) {
183
+ if (crossedFrameIndex < this._frameCount - 1) {
184
+ crossedFrameIndex++;
185
+ }
186
+ else {
187
+ crossedFrameIndex = 0;
188
+ }
189
+ const frameOffset = this._animationData.frameOffset +
190
+ this._timelineArray[timelineData.offset +
191
+ 5 /* BinaryOffset.TimelineFrameOffset */ +
192
+ crossedFrameIndex];
193
+ // const framePosition = this._frameArray[frameOffset] * this._frameRateR; // Precision problem
194
+ const framePosition = this._frameArray[frameOffset] / this._frameRate;
195
+ if (this._position <= framePosition &&
196
+ framePosition <= this._position + this._duration //
197
+ ) {
198
+ // Support interval play.
199
+ this._onCrossFrame(crossedFrameIndex);
200
+ }
201
+ if (loopCompleteEvent !== null && crossedFrameIndex === 0) {
202
+ // Add loop complete event before first frame.
203
+ this._armature._dragonBones.bufferEvent(loopCompleteEvent);
204
+ loopCompleteEvent = null;
205
+ }
206
+ if (crossedFrameIndex === frameIndex) {
207
+ break;
208
+ }
209
+ }
210
+ }
211
+ }
212
+ }
213
+ }
214
+ else if (this._frameIndex < 0) {
215
+ this._frameIndex = 0;
216
+ if (this._timelineData !== null) {
217
+ this._frameOffset =
218
+ this._animationData.frameOffset +
219
+ this._timelineArray[this._timelineData.offset + 5 /* BinaryOffset.TimelineFrameOffset */];
220
+ // Arrive at frame.
221
+ const framePosition = this._frameArray[this._frameOffset] / this._frameRate;
222
+ if (this.currentPlayTimes === prevPlayTimes) {
223
+ // Start.
224
+ if (prevTime <= framePosition) {
225
+ this._onCrossFrame(this._frameIndex);
226
+ }
227
+ }
228
+ else if (this._position <= framePosition) {
229
+ // Loop complete.
230
+ if (!isReverse && loopCompleteEvent !== null) {
231
+ // Add loop complete event before first frame.
232
+ this._armature._dragonBones.bufferEvent(loopCompleteEvent);
233
+ loopCompleteEvent = null;
234
+ }
235
+ this._onCrossFrame(this._frameIndex);
236
+ }
237
+ }
238
+ }
239
+ if (loopCompleteEvent !== null) {
240
+ this._armature._dragonBones.bufferEvent(loopCompleteEvent);
241
+ }
242
+ if (completeEvent !== null) {
243
+ this._armature._dragonBones.bufferEvent(completeEvent);
244
+ }
245
+ }
246
+ }
247
+ setCurrentTime(value) {
248
+ this._setCurrentTime(value);
249
+ this._frameIndex = -1;
250
+ }
251
+ }
252
+ /**
253
+ * @internal
254
+ */
255
+ export class ZOrderTimelineState extends TimelineState {
256
+ static toString() {
257
+ return "[class dragonBones.ZOrderTimelineState]";
258
+ }
259
+ _onArriveAtFrame() {
260
+ if (this.playState >= 0) {
261
+ const count = this._frameArray[this._frameOffset + 1];
262
+ if (count > 0) {
263
+ this._armature._sortZOrder(this._frameArray, this._frameOffset + 2);
264
+ }
265
+ else {
266
+ this._armature._sortZOrder(null, 0);
267
+ }
268
+ }
269
+ }
270
+ _onUpdateFrame() { }
271
+ }
272
+ /**
273
+ * @internal
274
+ */
275
+ export class BoneAllTimelineState extends MutilpleValueTimelineState {
276
+ static toString() {
277
+ return "[class dragonBones.BoneAllTimelineState]";
278
+ }
279
+ _onArriveAtFrame() {
280
+ super._onArriveAtFrame();
281
+ if (this._isTween && this._frameIndex === this._frameCount - 1) {
282
+ this._rd[2] = Transform.normalizeRadian(this._rd[2]);
283
+ this._rd[3] = Transform.normalizeRadian(this._rd[3]);
284
+ }
285
+ if (this._timelineData === null) {
286
+ // Pose.
287
+ this._rd[4] = 1.0;
288
+ this._rd[5] = 1.0;
289
+ }
290
+ }
291
+ init(armature, animationState, timelineData) {
292
+ super.init(armature, animationState, timelineData);
293
+ this._valueOffset = this._animationData.frameFloatOffset;
294
+ this._valueCount = 6;
295
+ this._valueArray = this._animationData.parent.parent.frameFloatArray;
296
+ }
297
+ fadeOut() {
298
+ this.dirty = false;
299
+ this._rd[2] = Transform.normalizeRadian(this._rd[2]);
300
+ this._rd[3] = Transform.normalizeRadian(this._rd[3]);
301
+ }
302
+ blend(isDirty) {
303
+ const valueScale = this._armature.armatureData.scale;
304
+ const rd = this._rd;
305
+ //
306
+ const blendState = this.target;
307
+ const bone = blendState.target;
308
+ const blendWeight = blendState.blendWeight;
309
+ const result = bone.animationPose;
310
+ if (blendState.dirty > 1) {
311
+ result.x += rd[0] * blendWeight * valueScale;
312
+ result.y += rd[1] * blendWeight * valueScale;
313
+ result.rotation += rd[2] * blendWeight;
314
+ result.skew += rd[3] * blendWeight;
315
+ result.scaleX += (rd[4] - 1.0) * blendWeight;
316
+ result.scaleY += (rd[5] - 1.0) * blendWeight;
317
+ }
318
+ else {
319
+ result.x = rd[0] * blendWeight * valueScale;
320
+ result.y = rd[1] * blendWeight * valueScale;
321
+ result.rotation = rd[2] * blendWeight;
322
+ result.skew = rd[3] * blendWeight;
323
+ result.scaleX = (rd[4] - 1.0) * blendWeight + 1.0; //
324
+ result.scaleY = (rd[5] - 1.0) * blendWeight + 1.0; //
325
+ }
326
+ if (isDirty || this.dirty) {
327
+ this.dirty = false;
328
+ bone._transformDirty = true;
329
+ }
330
+ }
331
+ }
332
+ /**
333
+ * @internal
334
+ */
335
+ export class BoneTranslateTimelineState extends DoubleValueTimelineState {
336
+ static toString() {
337
+ return "[class dragonBones.BoneTranslateTimelineState]";
338
+ }
339
+ init(armature, animationState, timelineData) {
340
+ super.init(armature, animationState, timelineData);
341
+ this._valueOffset = this._animationData.frameFloatOffset;
342
+ this._valueScale = this._armature.armatureData.scale;
343
+ this._valueArray = this._animationData.parent.parent.frameFloatArray;
344
+ }
345
+ blend(isDirty) {
346
+ const blendState = this.target;
347
+ const bone = blendState.target;
348
+ const blendWeight = blendState.blendWeight;
349
+ const result = bone.animationPose;
350
+ if (blendState.dirty > 1) {
351
+ result.x += this._resultA * blendWeight;
352
+ result.y += this._resultB * blendWeight;
353
+ }
354
+ else if (blendWeight !== 1.0) {
355
+ result.x = this._resultA * blendWeight;
356
+ result.y = this._resultB * blendWeight;
357
+ }
358
+ else {
359
+ result.x = this._resultA;
360
+ result.y = this._resultB;
361
+ }
362
+ if (isDirty || this.dirty) {
363
+ this.dirty = false;
364
+ bone._transformDirty = true;
365
+ }
366
+ }
367
+ }
368
+ /**
369
+ * @internal
370
+ */
371
+ export class BoneRotateTimelineState extends DoubleValueTimelineState {
372
+ static toString() {
373
+ return "[class dragonBones.BoneRotateTimelineState]";
374
+ }
375
+ _onArriveAtFrame() {
376
+ super._onArriveAtFrame();
377
+ if (this._isTween && this._frameIndex === this._frameCount - 1) {
378
+ this._differenceA = Transform.normalizeRadian(this._differenceA);
379
+ this._differenceB = Transform.normalizeRadian(this._differenceB);
380
+ }
381
+ }
382
+ init(armature, animationState, timelineData) {
383
+ super.init(armature, animationState, timelineData);
384
+ this._valueOffset = this._animationData.frameFloatOffset;
385
+ this._valueArray = this._animationData.parent.parent.frameFloatArray;
386
+ }
387
+ fadeOut() {
388
+ this.dirty = false;
389
+ this._resultA = Transform.normalizeRadian(this._resultA);
390
+ this._resultB = Transform.normalizeRadian(this._resultB);
391
+ }
392
+ blend(isDirty) {
393
+ const blendState = this.target;
394
+ const bone = blendState.target;
395
+ const blendWeight = blendState.blendWeight;
396
+ const result = bone.animationPose;
397
+ if (blendState.dirty > 1) {
398
+ result.rotation += this._resultA * blendWeight;
399
+ result.skew += this._resultB * blendWeight;
400
+ }
401
+ else if (blendWeight !== 1.0) {
402
+ result.rotation = this._resultA * blendWeight;
403
+ result.skew = this._resultB * blendWeight;
404
+ }
405
+ else {
406
+ result.rotation = this._resultA;
407
+ result.skew = this._resultB;
408
+ }
409
+ if (isDirty || this.dirty) {
410
+ this.dirty = false;
411
+ bone._transformDirty = true;
412
+ }
413
+ }
414
+ }
415
+ /**
416
+ * @internal
417
+ */
418
+ export class BoneScaleTimelineState extends DoubleValueTimelineState {
419
+ static toString() {
420
+ return "[class dragonBones.BoneScaleTimelineState]";
421
+ }
422
+ _onArriveAtFrame() {
423
+ super._onArriveAtFrame();
424
+ if (this._timelineData === null) {
425
+ // Pose.
426
+ this._resultA = 1.0;
427
+ this._resultB = 1.0;
428
+ }
429
+ }
430
+ init(armature, animationState, timelineData) {
431
+ super.init(armature, animationState, timelineData);
432
+ this._valueOffset = this._animationData.frameFloatOffset;
433
+ this._valueArray = this._animationData.parent.parent.frameFloatArray;
434
+ }
435
+ blend(isDirty) {
436
+ const blendState = this.target;
437
+ const bone = blendState.target;
438
+ const blendWeight = blendState.blendWeight;
439
+ const result = bone.animationPose;
440
+ if (blendState.dirty > 1) {
441
+ result.scaleX += (this._resultA - 1.0) * blendWeight;
442
+ result.scaleY += (this._resultB - 1.0) * blendWeight;
443
+ }
444
+ else if (blendWeight !== 1.0) {
445
+ result.scaleX = (this._resultA - 1.0) * blendWeight + 1.0;
446
+ result.scaleY = (this._resultB - 1.0) * blendWeight + 1.0;
447
+ }
448
+ else {
449
+ result.scaleX = this._resultA;
450
+ result.scaleY = this._resultB;
451
+ }
452
+ if (isDirty || this.dirty) {
453
+ this.dirty = false;
454
+ bone._transformDirty = true;
455
+ }
456
+ }
457
+ }
458
+ /**
459
+ * @internal
460
+ */
461
+ export class SurfaceTimelineState extends MutilpleValueTimelineState {
462
+ static toString() {
463
+ return "[class dragonBones.SurfaceTimelineState]";
464
+ }
465
+ _onClear() {
466
+ super._onClear();
467
+ this._deformCount = 0;
468
+ this._deformOffset = 0;
469
+ this._sameValueOffset = 0;
470
+ }
471
+ init(armature, animationState, timelineData) {
472
+ super.init(armature, animationState, timelineData);
473
+ if (this._timelineData !== null) {
474
+ const dragonBonesData = this._animationData.parent.parent;
475
+ const frameIntArray = dragonBonesData.frameIntArray;
476
+ const frameIntOffset = this._animationData.frameIntOffset +
477
+ this._timelineArray[this._timelineData.offset + 3 /* BinaryOffset.TimelineFrameValueCount */];
478
+ this._valueOffset = this._animationData.frameFloatOffset;
479
+ this._valueCount =
480
+ frameIntArray[frameIntOffset + 2 /* BinaryOffset.DeformValueCount */];
481
+ this._deformCount =
482
+ frameIntArray[frameIntOffset + 1 /* BinaryOffset.DeformCount */];
483
+ this._deformOffset =
484
+ frameIntArray[frameIntOffset + 3 /* BinaryOffset.DeformValueOffset */];
485
+ this._sameValueOffset =
486
+ frameIntArray[frameIntOffset + 4 /* BinaryOffset.DeformFloatOffset */] +
487
+ this._animationData.frameFloatOffset;
488
+ this._valueScale = this._armature.armatureData.scale;
489
+ this._valueArray = dragonBonesData.frameFloatArray;
490
+ this._rd.length = this._valueCount * 2;
491
+ }
492
+ else {
493
+ this._deformCount = this.target.target._deformVertices.length;
494
+ }
495
+ }
496
+ blend(isDirty) {
497
+ const blendState = this.target;
498
+ const surface = blendState.target;
499
+ const blendWeight = blendState.blendWeight;
500
+ const result = surface._deformVertices;
501
+ const valueArray = this._valueArray;
502
+ if (valueArray !== null) {
503
+ const valueCount = this._valueCount;
504
+ const deformOffset = this._deformOffset;
505
+ const sameValueOffset = this._sameValueOffset;
506
+ const rd = this._rd;
507
+ for (let i = 0; i < this._deformCount; ++i) {
508
+ let value = 0.0;
509
+ if (i < deformOffset) {
510
+ value = valueArray[sameValueOffset + i];
511
+ }
512
+ else if (i < deformOffset + valueCount) {
513
+ value = rd[i - deformOffset];
514
+ }
515
+ else {
516
+ value = valueArray[sameValueOffset + i - valueCount];
517
+ }
518
+ if (blendState.dirty > 1) {
519
+ result[i] += value * blendWeight;
520
+ }
521
+ else {
522
+ result[i] = value * blendWeight;
523
+ }
524
+ }
525
+ }
526
+ else if (blendState.dirty === 1) {
527
+ for (let i = 0; i < this._deformCount; ++i) {
528
+ result[i] = 0.0;
529
+ }
530
+ }
531
+ if (isDirty || this.dirty) {
532
+ this.dirty = false;
533
+ surface._transformDirty = true;
534
+ }
535
+ }
536
+ }
537
+ /**
538
+ * @internal
539
+ */
540
+ export class AlphaTimelineState extends SingleValueTimelineState {
541
+ static toString() {
542
+ return "[class dragonBones.AlphaTimelineState]";
543
+ }
544
+ _onArriveAtFrame() {
545
+ super._onArriveAtFrame();
546
+ if (this._timelineData === null) {
547
+ // Pose.
548
+ this._result = 1.0;
549
+ }
550
+ }
551
+ init(armature, animationState, timelineData) {
552
+ super.init(armature, animationState, timelineData);
553
+ this._valueOffset = this._animationData.frameIntOffset;
554
+ this._valueScale = 0.01;
555
+ this._valueArray = this._animationData.parent.parent.frameIntArray;
556
+ }
557
+ blend(isDirty) {
558
+ const blendState = this.target;
559
+ const alphaTarget = blendState.target;
560
+ const blendWeight = blendState.blendWeight;
561
+ if (blendState.dirty > 1) {
562
+ alphaTarget._alpha += this._result * blendWeight;
563
+ if (alphaTarget._alpha > 1.0) {
564
+ alphaTarget._alpha = 1.0;
565
+ }
566
+ }
567
+ else {
568
+ alphaTarget._alpha = this._result * blendWeight;
569
+ }
570
+ if (isDirty || this.dirty) {
571
+ this.dirty = false;
572
+ this._armature._alphaDirty = true;
573
+ }
574
+ }
575
+ }
576
+ /**
577
+ * @internal
578
+ */
579
+ export class SlotDisplayTimelineState extends TimelineState {
580
+ static toString() {
581
+ return "[class dragonBones.SlotDisplayTimelineState]";
582
+ }
583
+ _onArriveAtFrame() {
584
+ if (this.playState >= 0) {
585
+ const slot = this.target;
586
+ const displayIndex = this._timelineData !== null
587
+ ? this._frameArray[this._frameOffset + 1]
588
+ : slot._slotData.displayIndex;
589
+ if (slot.displayIndex !== displayIndex) {
590
+ slot._setDisplayIndex(displayIndex, true);
591
+ }
592
+ }
593
+ }
594
+ _onUpdateFrame() { }
595
+ }
596
+ /**
597
+ * @internal
598
+ */
599
+ export class SlotColorTimelineState extends TweenTimelineState {
600
+ constructor() {
601
+ super(...arguments);
602
+ this._current = [0, 0, 0, 0, 0, 0, 0, 0];
603
+ this._difference = [0, 0, 0, 0, 0, 0, 0, 0];
604
+ this._result = [
605
+ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
606
+ ];
607
+ }
608
+ static toString() {
609
+ return "[class dragonBones.SlotColorTimelineState]";
610
+ }
611
+ _onArriveAtFrame() {
612
+ super._onArriveAtFrame();
613
+ if (this._timelineData !== null) {
614
+ const dragonBonesData = this._animationData.parent.parent;
615
+ const colorArray = dragonBonesData.colorArray;
616
+ const frameIntArray = dragonBonesData.frameIntArray;
617
+ const valueOffset = this._animationData.frameIntOffset +
618
+ this._frameValueOffset +
619
+ this._frameIndex;
620
+ let colorOffset = frameIntArray[valueOffset];
621
+ if (colorOffset < 0) {
622
+ colorOffset += 65536; // Fixed out of bounds bug.
623
+ }
624
+ if (this._isTween) {
625
+ this._current[0] = colorArray[colorOffset++];
626
+ this._current[1] = colorArray[colorOffset++];
627
+ this._current[2] = colorArray[colorOffset++];
628
+ this._current[3] = colorArray[colorOffset++];
629
+ this._current[4] = colorArray[colorOffset++];
630
+ this._current[5] = colorArray[colorOffset++];
631
+ this._current[6] = colorArray[colorOffset++];
632
+ this._current[7] = colorArray[colorOffset++];
633
+ if (this._frameIndex === this._frameCount - 1) {
634
+ colorOffset =
635
+ frameIntArray[this._animationData.frameIntOffset + this._frameValueOffset];
636
+ }
637
+ else {
638
+ colorOffset = frameIntArray[valueOffset + 1];
639
+ }
640
+ if (colorOffset < 0) {
641
+ colorOffset += 65536; // Fixed out of bounds bug.
642
+ }
643
+ this._difference[0] = colorArray[colorOffset++] - this._current[0];
644
+ this._difference[1] = colorArray[colorOffset++] - this._current[1];
645
+ this._difference[2] = colorArray[colorOffset++] - this._current[2];
646
+ this._difference[3] = colorArray[colorOffset++] - this._current[3];
647
+ this._difference[4] = colorArray[colorOffset++] - this._current[4];
648
+ this._difference[5] = colorArray[colorOffset++] - this._current[5];
649
+ this._difference[6] = colorArray[colorOffset++] - this._current[6];
650
+ this._difference[7] = colorArray[colorOffset++] - this._current[7];
651
+ }
652
+ else {
653
+ this._result[0] = colorArray[colorOffset++] * 0.01;
654
+ this._result[1] = colorArray[colorOffset++] * 0.01;
655
+ this._result[2] = colorArray[colorOffset++] * 0.01;
656
+ this._result[3] = colorArray[colorOffset++] * 0.01;
657
+ this._result[4] = colorArray[colorOffset++];
658
+ this._result[5] = colorArray[colorOffset++];
659
+ this._result[6] = colorArray[colorOffset++];
660
+ this._result[7] = colorArray[colorOffset++];
661
+ }
662
+ }
663
+ else {
664
+ // Pose.
665
+ const slot = this.target;
666
+ const color = slot.slotData.color;
667
+ this._result[0] = color.alphaMultiplier;
668
+ this._result[1] = color.redMultiplier;
669
+ this._result[2] = color.greenMultiplier;
670
+ this._result[3] = color.blueMultiplier;
671
+ this._result[4] = color.alphaOffset;
672
+ this._result[5] = color.redOffset;
673
+ this._result[6] = color.greenOffset;
674
+ this._result[7] = color.blueOffset;
675
+ }
676
+ }
677
+ _onUpdateFrame() {
678
+ super._onUpdateFrame();
679
+ if (this._isTween) {
680
+ this._result[0] =
681
+ (this._current[0] + this._difference[0] * this._tweenProgress) * 0.01;
682
+ this._result[1] =
683
+ (this._current[1] + this._difference[1] * this._tweenProgress) * 0.01;
684
+ this._result[2] =
685
+ (this._current[2] + this._difference[2] * this._tweenProgress) * 0.01;
686
+ this._result[3] =
687
+ (this._current[3] + this._difference[3] * this._tweenProgress) * 0.01;
688
+ this._result[4] =
689
+ this._current[4] + this._difference[4] * this._tweenProgress;
690
+ this._result[5] =
691
+ this._current[5] + this._difference[5] * this._tweenProgress;
692
+ this._result[6] =
693
+ this._current[6] + this._difference[6] * this._tweenProgress;
694
+ this._result[7] =
695
+ this._current[7] + this._difference[7] * this._tweenProgress;
696
+ }
697
+ }
698
+ fadeOut() {
699
+ this._isTween = false;
700
+ }
701
+ update(passedTime) {
702
+ super.update(passedTime);
703
+ // Fade animation.
704
+ if (this._isTween || this.dirty) {
705
+ const slot = this.target;
706
+ const result = slot._colorTransform;
707
+ if (this._animationState._fadeState !== 0 ||
708
+ this._animationState._subFadeState !== 0) {
709
+ if (result.alphaMultiplier !== this._result[0] ||
710
+ result.redMultiplier !== this._result[1] ||
711
+ result.greenMultiplier !== this._result[2] ||
712
+ result.blueMultiplier !== this._result[3] ||
713
+ result.alphaOffset !== this._result[4] ||
714
+ result.redOffset !== this._result[5] ||
715
+ result.greenOffset !== this._result[6] ||
716
+ result.blueOffset !== this._result[7]) {
717
+ const fadeProgress = Math.pow(this._animationState._fadeProgress, 4);
718
+ result.alphaMultiplier +=
719
+ (this._result[0] - result.alphaMultiplier) * fadeProgress;
720
+ result.redMultiplier +=
721
+ (this._result[1] - result.redMultiplier) * fadeProgress;
722
+ result.greenMultiplier +=
723
+ (this._result[2] - result.greenMultiplier) * fadeProgress;
724
+ result.blueMultiplier +=
725
+ (this._result[3] - result.blueMultiplier) * fadeProgress;
726
+ result.alphaOffset +=
727
+ (this._result[4] - result.alphaOffset) * fadeProgress;
728
+ result.redOffset +=
729
+ (this._result[5] - result.redOffset) * fadeProgress;
730
+ result.greenOffset +=
731
+ (this._result[6] - result.greenOffset) * fadeProgress;
732
+ result.blueOffset +=
733
+ (this._result[7] - result.blueOffset) * fadeProgress;
734
+ slot._colorDirty = true;
735
+ }
736
+ }
737
+ else if (this.dirty) {
738
+ this.dirty = false;
739
+ if (result.alphaMultiplier !== this._result[0] ||
740
+ result.redMultiplier !== this._result[1] ||
741
+ result.greenMultiplier !== this._result[2] ||
742
+ result.blueMultiplier !== this._result[3] ||
743
+ result.alphaOffset !== this._result[4] ||
744
+ result.redOffset !== this._result[5] ||
745
+ result.greenOffset !== this._result[6] ||
746
+ result.blueOffset !== this._result[7]) {
747
+ result.alphaMultiplier = this._result[0];
748
+ result.redMultiplier = this._result[1];
749
+ result.greenMultiplier = this._result[2];
750
+ result.blueMultiplier = this._result[3];
751
+ result.alphaOffset = this._result[4];
752
+ result.redOffset = this._result[5];
753
+ result.greenOffset = this._result[6];
754
+ result.blueOffset = this._result[7];
755
+ slot._colorDirty = true;
756
+ }
757
+ }
758
+ }
759
+ }
760
+ }
761
+ /**
762
+ * @internal
763
+ */
764
+ export class SlotZIndexTimelineState extends SingleValueTimelineState {
765
+ static toString() {
766
+ return "[class dragonBones.SlotZIndexTimelineState]";
767
+ }
768
+ _onArriveAtFrame() {
769
+ super._onArriveAtFrame();
770
+ if (this._timelineData === null) {
771
+ // Pose.
772
+ const blendState = this.target;
773
+ const slot = blendState.target;
774
+ this._result = slot.slotData.zIndex;
775
+ }
776
+ }
777
+ init(armature, animationState, timelineData) {
778
+ super.init(armature, animationState, timelineData);
779
+ this._valueOffset = this._animationData.frameIntOffset;
780
+ this._valueArray = this._animationData.parent.parent.frameIntArray;
781
+ }
782
+ blend(isDirty) {
783
+ const blendState = this.target;
784
+ const slot = blendState.target;
785
+ const blendWeight = blendState.blendWeight;
786
+ if (blendState.dirty > 1) {
787
+ slot._zIndex += this._result * blendWeight;
788
+ }
789
+ else {
790
+ slot._zIndex = this._result * blendWeight;
791
+ }
792
+ if (isDirty || this.dirty) {
793
+ this.dirty = false;
794
+ this._armature._zIndexDirty = true;
795
+ }
796
+ }
797
+ }
798
+ /**
799
+ * @internal
800
+ */
801
+ export class DeformTimelineState extends MutilpleValueTimelineState {
802
+ static toString() {
803
+ return "[class dragonBones.DeformTimelineState]";
804
+ }
805
+ _onClear() {
806
+ super._onClear();
807
+ this.geometryOffset = 0;
808
+ this.displayFrame = null;
809
+ this._deformCount = 0;
810
+ this._deformOffset = 0;
811
+ this._sameValueOffset = 0;
812
+ }
813
+ init(armature, animationState, timelineData) {
814
+ super.init(armature, animationState, timelineData);
815
+ if (this._timelineData !== null) {
816
+ const frameIntOffset = this._animationData.frameIntOffset +
817
+ this._timelineArray[this._timelineData.offset + 3 /* BinaryOffset.TimelineFrameValueCount */];
818
+ const dragonBonesData = this._animationData.parent.parent;
819
+ const frameIntArray = dragonBonesData.frameIntArray;
820
+ const slot = this.target.target;
821
+ this.geometryOffset =
822
+ frameIntArray[frameIntOffset + 0 /* BinaryOffset.DeformVertexOffset */];
823
+ if (this.geometryOffset < 0) {
824
+ this.geometryOffset += 65536; // Fixed out of bounds bug.
825
+ }
826
+ for (let i = 0, l = slot.displayFrameCount; i < l; ++i) {
827
+ const displayFrame = slot.getDisplayFrameAt(i);
828
+ const geometryData = displayFrame.getGeometryData();
829
+ if (geometryData === null) {
830
+ continue;
831
+ }
832
+ if (geometryData.offset === this.geometryOffset) {
833
+ this.displayFrame = displayFrame;
834
+ this.displayFrame.updateDeformVertices();
835
+ break;
836
+ }
837
+ }
838
+ if (this.displayFrame === null) {
839
+ this.returnToPool(); //
840
+ return;
841
+ }
842
+ this._valueOffset = this._animationData.frameFloatOffset;
843
+ this._valueCount =
844
+ frameIntArray[frameIntOffset + 2 /* BinaryOffset.DeformValueCount */];
845
+ this._deformCount =
846
+ frameIntArray[frameIntOffset + 1 /* BinaryOffset.DeformCount */];
847
+ this._deformOffset =
848
+ frameIntArray[frameIntOffset + 3 /* BinaryOffset.DeformValueOffset */];
849
+ this._sameValueOffset =
850
+ frameIntArray[frameIntOffset + 4 /* BinaryOffset.DeformFloatOffset */] +
851
+ this._animationData.frameFloatOffset;
852
+ this._valueScale = this._armature.armatureData.scale;
853
+ this._valueArray = dragonBonesData.frameFloatArray;
854
+ this._rd.length = this._valueCount * 2;
855
+ }
856
+ else {
857
+ this._deformCount = this.displayFrame.deformVertices.length;
858
+ }
859
+ }
860
+ blend(isDirty) {
861
+ const blendState = this.target;
862
+ const slot = blendState.target;
863
+ const blendWeight = blendState.blendWeight;
864
+ const result = this.displayFrame.deformVertices;
865
+ const valueArray = this._valueArray;
866
+ if (valueArray !== null) {
867
+ const valueCount = this._valueCount;
868
+ const deformOffset = this._deformOffset;
869
+ const sameValueOffset = this._sameValueOffset;
870
+ const rd = this._rd;
871
+ for (let i = 0; i < this._deformCount; ++i) {
872
+ let value = 0.0;
873
+ if (i < deformOffset) {
874
+ value = valueArray[sameValueOffset + i];
875
+ }
876
+ else if (i < deformOffset + valueCount) {
877
+ value = rd[i - deformOffset];
878
+ }
879
+ else {
880
+ value = valueArray[sameValueOffset + i - valueCount];
881
+ }
882
+ if (blendState.dirty > 1) {
883
+ result[i] += value * blendWeight;
884
+ }
885
+ else {
886
+ result[i] = value * blendWeight;
887
+ }
888
+ }
889
+ }
890
+ else if (blendState.dirty === 1) {
891
+ for (let i = 0; i < this._deformCount; ++i) {
892
+ result[i] = 0.0;
893
+ }
894
+ }
895
+ if (isDirty || this.dirty) {
896
+ this.dirty = false;
897
+ if (slot._geometryData === this.displayFrame.getGeometryData()) {
898
+ slot._verticesDirty = true;
899
+ }
900
+ }
901
+ }
902
+ }
903
+ /**
904
+ * @internal
905
+ */
906
+ export class IKConstraintTimelineState extends DoubleValueTimelineState {
907
+ static toString() {
908
+ return "[class dragonBones.IKConstraintTimelineState]";
909
+ }
910
+ _onUpdateFrame() {
911
+ super._onUpdateFrame();
912
+ const ikConstraint = this.target;
913
+ if (this._timelineData !== null) {
914
+ ikConstraint._bendPositive = this._currentA > 0.0;
915
+ ikConstraint._weight = this._currentB;
916
+ }
917
+ else {
918
+ const ikConstraintData = ikConstraint._constraintData;
919
+ ikConstraint._bendPositive = ikConstraintData.bendPositive;
920
+ ikConstraint._weight = ikConstraintData.weight;
921
+ }
922
+ ikConstraint.invalidUpdate();
923
+ this.dirty = false;
924
+ }
925
+ init(armature, animationState, timelineData) {
926
+ super.init(armature, animationState, timelineData);
927
+ this._valueOffset = this._animationData.frameIntOffset;
928
+ this._valueScale = 0.01;
929
+ this._valueArray = this._animationData.parent.parent.frameIntArray;
930
+ }
931
+ }
932
+ /**
933
+ * @internal
934
+ */
935
+ export class AnimationProgressTimelineState extends SingleValueTimelineState {
936
+ static toString() {
937
+ return "[class dragonBones.AnimationProgressTimelineState]";
938
+ }
939
+ _onUpdateFrame() {
940
+ super._onUpdateFrame();
941
+ const animationState = this.target;
942
+ if (animationState._parent !== null) {
943
+ animationState.currentTime = this._result * animationState.totalTime;
944
+ }
945
+ this.dirty = false;
946
+ }
947
+ init(armature, animationState, timelineData) {
948
+ super.init(armature, animationState, timelineData);
949
+ this._valueOffset = this._animationData.frameIntOffset;
950
+ this._valueScale = 0.0001;
951
+ this._valueArray = this._animationData.parent.parent.frameIntArray;
952
+ }
953
+ }
954
+ /**
955
+ * @internal
956
+ */
957
+ export class AnimationWeightTimelineState extends SingleValueTimelineState {
958
+ static toString() {
959
+ return "[class dragonBones.AnimationWeightTimelineState]";
960
+ }
961
+ _onUpdateFrame() {
962
+ super._onUpdateFrame();
963
+ const animationState = this.target;
964
+ if (animationState._parent !== null) {
965
+ animationState.weight = this._result;
966
+ }
967
+ this.dirty = false;
968
+ }
969
+ init(armature, animationState, timelineData) {
970
+ super.init(armature, animationState, timelineData);
971
+ this._valueOffset = this._animationData.frameIntOffset;
972
+ this._valueScale = 0.0001;
973
+ this._valueArray = this._animationData.parent.parent.frameIntArray;
974
+ }
975
+ }
976
+ /**
977
+ * @internal
978
+ */
979
+ export class AnimationParametersTimelineState extends DoubleValueTimelineState {
980
+ static toString() {
981
+ return "[class dragonBones.AnimationParametersTimelineState]";
982
+ }
983
+ _onUpdateFrame() {
984
+ super._onUpdateFrame();
985
+ const animationState = this.target;
986
+ if (animationState._parent !== null) {
987
+ animationState.parameterX = this._resultA;
988
+ animationState.parameterY = this._resultB;
989
+ }
990
+ this.dirty = false;
991
+ }
992
+ init(armature, animationState, timelineData) {
993
+ super.init(armature, animationState, timelineData);
994
+ this._valueOffset = this._animationData.frameIntOffset;
995
+ this._valueScale = 0.0001;
996
+ this._valueArray = this._animationData.parent.parent.frameIntArray;
997
+ }
998
+ }