123456789101112131415161718192021222324252627282930313233343536373839 |
- import { _decorator, Component, Node, NodeEventType, Sprite, tween, UIOpacity } from 'cc';
- const { ccclass, property } = _decorator;
- @ccclass('ItemNode')
- export class ItemNode extends Component {
- @property(Sprite)
- yuantu: Sprite = null;
- @property(Sprite)
- flash: Sprite = null;
- start() {
- }
- init(sf1, sf2) {
- this.yuantu.node.active = true;
- this.yuantu.spriteFrame = sf1;
- this.flash.node.active = false;
- this.flash.spriteFrame = sf2;
- }
- flashFun() {
- this.flash.node.active = true;
- tween(this.flash.getComponent(UIOpacity))
- .delay(0.1)
- .to(0.1, { opacity: 0 })
- .call(() => {
- this.flash.node.active = false;
- this.flash.getComponent(UIOpacity).opacity = 255;
- })
- .start();
- }
- update(deltaTime: number) {
- }
- }
|