@cc-component/cc-ex-component 2.0.6 → 2.0.7
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.
- package/assets/ex/ExCommon.ts +7 -7
- package/package.json +1 -1
package/assets/ex/ExCommon.ts
CHANGED
|
@@ -265,8 +265,7 @@ declare module 'cc' {
|
|
|
265
265
|
interface Label {
|
|
266
266
|
/**动画播放 */
|
|
267
267
|
play(param: {
|
|
268
|
-
|
|
269
|
-
endValue: number,
|
|
268
|
+
end: number,
|
|
270
269
|
duration: number,
|
|
271
270
|
formatter?: (value: number) => string,
|
|
272
271
|
onComplete?: () => void
|
|
@@ -718,27 +717,28 @@ Map.prototype.toObject = function (): Object {
|
|
|
718
717
|
Label.prototype.play = function (
|
|
719
718
|
this: Label,
|
|
720
719
|
param: {
|
|
721
|
-
|
|
722
|
-
endValue: number,
|
|
720
|
+
end: number,
|
|
723
721
|
duration: number,
|
|
724
722
|
formatter: (value: number) => string,
|
|
725
723
|
onComplete?: () => void
|
|
726
724
|
}
|
|
727
725
|
): void {
|
|
728
726
|
const label = this;
|
|
729
|
-
|
|
730
727
|
// 如果已有动画,先停止
|
|
731
728
|
if (label._currentTween) {
|
|
732
729
|
label._currentTween.stop();
|
|
733
730
|
}
|
|
731
|
+
const start = label.startValue ?? 0;
|
|
732
|
+
label.startValue = start;
|
|
734
733
|
// 使用 tween 动画
|
|
735
|
-
const obj: { value: number } = { value:
|
|
734
|
+
const obj: { value: number } = { value: start }
|
|
736
735
|
label._currentTween = tween(obj)
|
|
737
736
|
.to(
|
|
738
737
|
param.duration,
|
|
739
|
-
{ value: param.
|
|
738
|
+
{ value: param.end },
|
|
740
739
|
{
|
|
741
740
|
onUpdate(target: { value: number }) {
|
|
741
|
+
label.startValue = target.value
|
|
742
742
|
label.string = param.formatter?.(target.value) ?? (Math.floor(target.value) + '');
|
|
743
743
|
},
|
|
744
744
|
easing: "quadOut",
|