import { _decorator, Animation, Component, Node } from "cc"; const { ccclass, property } = _decorator; @ccclass("LoadingItem") export class LoadingItem extends Component { @property(Animation) animation: Animation; protected onEnable(): void { if (this.animation) { this.animation.play(); } } protected onDisable(): void { if (this.animation) { this.animation.pause(); } } }