@cc-component/cc-ex-component 1.6.7 → 1.6.8
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 +25 -0
- package/package.json +1 -1
package/assets/ex/ExCommon.ts
CHANGED
|
@@ -147,6 +147,10 @@ declare module 'cc' {
|
|
|
147
147
|
* @param time 禁用后xx秒后恢复,不传一直禁用
|
|
148
148
|
*/
|
|
149
149
|
enable(enable: boolean, time?: number): void;
|
|
150
|
+
/**按下放大动画 */
|
|
151
|
+
touchStartAnim(scale: number, time?: number): void;
|
|
152
|
+
/**抬起缩小 */
|
|
153
|
+
touchEndAnim(time?: number): void;
|
|
150
154
|
}
|
|
151
155
|
interface Component {
|
|
152
156
|
/**
|
|
@@ -638,6 +642,27 @@ Node.prototype.enable = function (this: Node, enable: boolean, time?: number): v
|
|
|
638
642
|
}
|
|
639
643
|
};
|
|
640
644
|
|
|
645
|
+
Node.prototype.touchStartAnim = function (this: Node, scale?: number, time?: number): void {
|
|
646
|
+
if (this.isValid) {
|
|
647
|
+
const btn = this
|
|
648
|
+
if (btn && btn.isValid) {
|
|
649
|
+
const scal = scale || 1.2
|
|
650
|
+
const t = time || 0.1
|
|
651
|
+
tween(btn).to(t, { scale: v3(scal, scal, scal) }).start();
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
};
|
|
655
|
+
|
|
656
|
+
Node.prototype.touchEndAnim = function (this: Node, time?: number): void {
|
|
657
|
+
if (this.isValid) {
|
|
658
|
+
const btn = this
|
|
659
|
+
if (btn && btn.isValid) {
|
|
660
|
+
tween(btn).to(time | 0.1, { scale: v3(1, 1, 1) }).start();
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
};
|
|
664
|
+
|
|
665
|
+
|
|
641
666
|
Map.prototype.toObject = function (): Object {
|
|
642
667
|
const obj = {};
|
|
643
668
|
for (const [key, value] of this.entries()) {
|