import { _decorator, Component, Node, Vec3, tween,UIOpacity, director,Button, find } from 'cc'; const { ccclass, property } = _decorator; @ccclass('Start') export class Start extends Component { @property(Node) progressBar:Node = null; @property(Node) bar:Node = null; @property(Node) logoPic:Node = null; @property(Node) loadingPic:Node = null; @property(Node) updatePic:Node = null; start() { //this.bar.setScale(2,1); this.updatePic.getComponent(UIOpacity).opacity = 0; this.Logo(); } Logo(){ let opacityLogo = this.logoPic.getComponent(UIOpacity); tween(opacityLogo) .call(()=>{opacityLogo.opacity = 10;}) .to(2,{opacity:255}) .call(()=>{this.Loading();opacityLogo.opacity = 0;}) .start(); } Loading(){ // let opacityLoadingPic = this.loadingPic.getComponent(UIOpacity); // let opacityProgressBar = this.progressBar.getComponent(UIOpacity); // tween(opacityLoadingPic) // .call(()=>{opacityLoadingPic.opacity = 255}) // .start(); // tween(opacityProgressBar) // .call(()=>{opacityProgressBar.opacity = 255}) // .start(); const setOpacity = (component,targetOpacity) => { const opacityComponent = component.getComponent(UIOpacity); tween(opacityComponent) .call(()=>{opacityComponent.opacity = targetOpacity;}) .start(); } setOpacity(this.loadingPic,255); setOpacity(this.progressBar,255); tween(this.bar) .call(()=>{this.bar.setScale(0,1)}) .to(2,{scale:new Vec3(2,1)}) .call(()=>{director.loadScene("LoginScene")}) //.call(()=>{this.bar.setScale(1.5,1)}) //.call(()=>{setOpacity(this.updatePic,255);setOpacity(this.loadingPic,0);setOpacity(this.progressBar,0);}) .start(); } onBtnLogin(){ director.loadScene("SelectScene"); } update(deltaTime: number) { } } // Loading() { // const setOpacity = (component, targetOpacity) => { // const opacityComponent = component.getComponent(UIOpacity); // tween(opacityComponent) // .call(() => { opacityComponent.opacity = targetOpacity; }) // .start(); // }; // setOpacity(this.loadingPic, 255); // setOpacity(this.progressBar, 255); // tween(this.bar) // .call(() => { this.bar.setScale(0, 1); }) // .to(2, { scale: new Vec3(2, 1) }) // .start(); // }