const {ccclass, property} = cc._decorator; @ccclass export class CameraUtils extends cc.Component { /* class member could be defined like this */ // dummy = ''; /* use `property` decorator if your want the member to be serializable */ // @property // serializableDummy = 0; private min:cc.Vec3; private max:cc.Vec3; private out:cc.Vec3=new cc.Vec3(); private startTime:number; private endTime:number; private startPos:cc.Vec3=new cc.Vec3(); private shakeing:boolean; private camera:cc.Camera; /** * 抖动 * @param time 持续时间 * @param min 最小值 * @param max 最大值 */ shake(time:number,min:cc.Vec3,max:cc.Vec3):void{ this.min=min; this.max=max; this.startTime=cc.sys.now(); this.endTime=this.startTime+time; this.shakeing=true; this.startPos.set(this.node.position); this.camera=this.node.getComponent(cc.Camera); } start () { // Your initialization goes here. } update (deltaTime: number) { if(this.shakeing){ let currentTime:number=cc.sys.now(); if(currentTime