const {ccclass, property} = cc._decorator;
@ccclass
export class Shake extends cc.ActionInterval
{
private _initial_x:number = 0;
private _initial_y:number = 0;
private _strength_x:number = 0;
private _strength_y:number = 0;
/**
* 创建抖动动画
* @param {number} duration 动画持续时长
* @param {number} strength_x 抖动幅度: x方向
* @param {number} strength_y 抖动幅度: y方向
* @returns {Shake}
*/
public static create(duration:number,strength_x:number,strength_y:number):Shake
{
let act:Shake = new Shake();
act.initWithDuration( duration,strength_x,strength_y );
return act;
}
public initWithDuration(duration:number,strength_x:number,strength_y:number):boolean
{
cc.ActionInterval.prototype['initWithDuration'].apply(this,arguments);
this._strength_x = strength_x;
this._strength_y
Cocos Creator 震动动画扩展类 (TypeScript)
最新推荐文章于 2024-08-02 15:52:42 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)