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,CAAC,CAAC;iBACD,KAAK,EAAE,CAAC;YACb,SAAS;YACT,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC;iBACb,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;iBACrD,IAAI,CAAC,GAAG,EAAE;gBACP,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC;gBACvB,IAAI,MAAM,CAAC,QAAQ;oBAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;YAC3C,CAAC,CAAC;iBACD,KAAK,EAAE,CAAC;QACjB,CAAC;KACJ,CAAA;IA9EG;QADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;+CACrB;IAGvB;QADC,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;+CAChB;IAG9B;QADC,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;+CACpB;IATb,SAAS;QAF7B,OAAO;QACP,IAAI,CAAC,mBAAmB,CAAC;OACL,SAAS,CAiF7B;IAAD,gBAAC;KAAA;kBAjFoB,SAAS","file":"","sourceRoot":"/","sourcesContent":["// Learn TypeScript:\n// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html\n// Learn Attribute:\n// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html\n// Learn life-cycle callbacks:\n// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html\n\nimport { DummyNode } from \"../CCDummyObjects\";\n\nconst { ccclass, property,menu} = cc._decorator;\n@ccclass\n@menu(\"自定义UI组件/AlterAnim\")\nexport default class AlterAnim extends cc.Component {\n\n @property({ type: Number, tooltip: \"动画时长\" })\n animTime: number = 0.3;\n\n @property({ type: cc.Node, tooltip: \"弹出框遮罩\" })\n maskNode: cc.Node = DummyNode;\n\n @property({ type: cc.Node, tooltip: \"内容node父节点\" })\n mainNode: cc.Node = DummyNode;\n\n onEnable() {\n this._showUIAnim(this.maskNode,this.mainNode);\n }\n\n /**\n * \n * @param maskNode 遮罩node\n * @param mainNode 所有内容node\n * @param params callback:执行完成后的回调,maskNodeOpacityValue遮罩node的opacity值\n */\n _showUIAnim(maskNode: cc.Node, mainNode: cc.Node, params = { callback: () => { }, maskNodeOpacityValue: 200 }): void {\n maskNode.opacity = 0;\n maskNode.active = true;\n mainNode.scale = 0;\n mainNode.active = true;\n // 播放背景动画\n let opacityValue = params.maskNodeOpacityValue;\n cc.tween(maskNode)\n .to(this.animTime * 0.8, { opacity: opacityValue })\n .call(() => {\n })\n .start();\n // 播放主体动画\n cc.tween(mainNode)\n .to(this.animTime, { scale: 1 }, { easing: 'backOut' })\n .call(() => {\n // 弹窗已完全展示(动画完毕)\n if (params.callback) params.callback();\n })\n .start();\n\n }\n\n hideUIAnim(params){\n this._hideUIAnim(this.node,this.maskNode,this.mainNode,params);\n }\n\n /**\n * \n * @param parentNode 该组件挂载的node\n * @param maskNode 遮罩node\n * @param mainNode 所有内容node\n * @param params callback:执行完成后的回调,maskNodeOpacityValue遮罩node的opacity值\n */\n _hideUIAnim(parentNode: cc.Node, maskNode: cc.Node, mainNode: cc.Node, params = { callback: () => { } }): void {\n // 拦截点击事件\n let blocker = parentNode.getChildByName(\"blocker\");\n if (!blocker) {\n blocker = new cc.Node('blocker');\n blocker.addComponent(cc.BlockInputEvents);\n blocker.setParent(parentNode);\n blocker.setContentSize(parentNode.getContentSize());\n }\n blocker.active = true;\n // 播放背景动画\n cc.tween(maskNode)\n .delay(this.animTime * 0.2)\n .to(this.animTime * 0.8, { opacity: 0 })\n .call(() => {\n })\n .start();\n // 播放主体动画\n cc.tween(mainNode)\n .to(this.animTime, { scale: 0 }, { easing: 'backIn' })\n .call(() => {\n blocker.active = false;\n if (params.callback) params.callback();\n })\n .start();\n }\n}\n"]}