CocosCreator 源码cc.SkewBy详解

欢迎关注公众号:“Cocos Creator 源码讲解”,一起学习。

/*
 * Skews a Node object by skewX and skewY degrees.
 * Relative to its property modification.
 * @class SkewBy
 * @extends SkewTo
 * @param {Number} t time in seconds
 * @param {Number} sx  skew in degrees for X axis
 * @param {Number} sy  skew in degrees for Y axis
 */
/*
 * 将 Node 对象倾斜 skewX 和 skewY 度。
 * 相对于其属性的修改。
 * @类SkewBy
 * @extends SkewTo
 * @param {Number} t 时间(以秒为单位)
 * @param {Number} sx X 轴的倾斜度(以度为单位)
 * @param {Number} Y 轴的 sy 偏斜(以度为单位)
 */
cc.SkewBy = cc.Class({
    name: 'cc.SkewBy',
    extends: cc.SkewTo,

    ctor: function (t, sx, sy) {
        sy !== undefined && this.initWithDuration(t, sx, sy);
    },

    /*
     * Initializes the action.
     * @param {Number} t time in seconds
     * @param {Number} deltaSkewX  skew in degrees for X axis
     * @param {Number} deltaSkewY  skew in degrees for Y axis
     * @return {Boolean}
     */
    /*
     * 初始化操作。
     * @param {Number} t 时间(以秒为单位)
     * @param {Number} deltaSkewX X 轴的倾斜(以度为单位)
     * @param {Number} deltaSkewY Y 轴的倾斜度(以度为单位)
     * @return {布尔值}
     */
    initWithDuration: function (t, deltaSkewX, deltaSkewY) {
        var ret = false;
        if (cc.SkewTo.prototype.initWithDuration.call(this, t, deltaSkewX, deltaSkewY)) {
            this._skewX = deltaSkewX;
            this._skewY = deltaSkewY;
            ret = true;
        }
        return ret;
    },
    /* 复制action */
    clone: function () {
        var action = new cc.SkewBy();
        this._cloneDecoration(action);
        action.initWithDuration(this._duration, this._skewX, this._skewY);
        return action;
    },
    /* 传入target参数 */
    startWithTarget: function (target) {
        cc.SkewTo.prototype.startWithTarget.call(this, target);
        this._deltaX = this._skewX;
        this._deltaY = this._skewY;
        this._endSkewX = this._startSkewX + this._deltaX;
        this._endSkewY = this._startSkewY + this._deltaY;
    },
    /* 翻转 */
    reverse: function () {
        var action = new cc.SkewBy(this._duration, -this._skewX, -this._skewY);
        this._cloneDecoration(action);
        this._reverseEaseList(action);
        return action;
    }
});

/**
 * !#en
 * Skews a Node object by skewX and skewY degrees. <br />
 * Relative to its property modification.
 * !#zh 偏斜指定的角度。
 * @method skewBy
 * @param {Number} t time in seconds
 * @param {Number} sx sx skew in degrees for X axis
 * @param {Number} sy sy skew in degrees for Y axis
 * @return {ActionInterval}
 * @example
 * // example
 * var actionBy = cc.skewBy(2, 0, -90);
 */
/**
 * !#zh
 * 将 Node 对象倾斜 skewX 和 skewY 度。 <br/>
 * 相对于其属性的修改。
 * !#zh 偏斜指定的角度。
 * @方法倾斜
 * @param {Number} t 时间(以秒为单位)
 * @param {Number} sx sx X 轴的倾斜度(以度为单位)
 * @param {Number} sy sy Y 轴倾斜度
 * @return {动作间隔}
 * @例子
 * 
 * 
 */

cc.skewBy = function (t, sx, sy) {
    return new cc.SkewBy(t, sx, sy);
};

  • 8
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值