You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							36 lines
						
					
					
						
							909 B
						
					
					
				
			
		
		
	
	
							36 lines
						
					
					
						
							909 B
						
					
					
				// Learn TypeScript:
 | 
						|
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
 | 
						|
// Learn Attribute:
 | 
						|
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
 | 
						|
// Learn life-cycle callbacks:
 | 
						|
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
 | 
						|
 | 
						|
const { ccclass, property } = cc._decorator;
 | 
						|
 | 
						|
@ccclass
 | 
						|
export default class BreathingAnimation extends cc.Component {
 | 
						|
 | 
						|
    @property(cc.Node)
 | 
						|
    breathingNode: cc.Node = null;
 | 
						|
 | 
						|
    // LIFE-CYCLE CALLBACKS:
 | 
						|
 | 
						|
    // onLoad () {}
 | 
						|
 | 
						|
    // start() {}
 | 
						|
 | 
						|
    protected onEnable(): void {
 | 
						|
        if (!this.breathingNode) {
 | 
						|
            this.breathingNode = this.node;
 | 
						|
        }
 | 
						|
        cc.tween(this.breathingNode)
 | 
						|
            .to(2, { scaleY: 0.99 })
 | 
						|
            .to(2, { scaleY: 1.01 })
 | 
						|
            .union()
 | 
						|
            .repeatForever()
 | 
						|
            .start();
 | 
						|
    }
 | 
						|
 | 
						|
 | 
						|
    // update (dt) {}
 | 
						|
}
 | 
						|
 |