From 2a97054ff493d9b51cc4543dedca8f71bd349799 Mon Sep 17 00:00:00 2001 From: sifu <2587107273@qq.com> Date: Mon, 19 Oct 2020 21:13:11 +0800 Subject: [PATCH] add rotateX and rotateY api --- index.js | 20 ++++++++++++++++++++ move.js | 34 +++++++++++++++++++++++++++------- 2 files changed, 47 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index e0cf183..24ac152 100644 --- a/index.js +++ b/index.js @@ -250,6 +250,26 @@ Move.prototype.rotate = function(n){ return this.transform('rotate(' + n + 'deg)'); }; +/** + * + * @param {Number} n + * @returns {Move} for chaining + * @api public + */ +Move.prototype.rotateX = function(n){ + return this.transform('rotateX(' + n + 'deg)'); +}; + +/** + * + * @param {Number} n + * @returns {Move} for chaining + * @api public + */ +Move.prototype.rotateY = function(n){ + return this.transform('rotateY(' + n + 'deg)'); +}; + /** * Set transition easing function to to `fn` string. * diff --git a/move.js b/move.js index e715755..4570c0b 100644 --- a/move.js +++ b/move.js @@ -56,11 +56,11 @@ require.helper.semVerSort = function(a, b) { /** * Find and require a module which name starts with the provided name. - * If multiple modules exists, the highest semver is used. + * If multiple modules exists, the highest semver is used. * This function can only be used for remote dependencies. * @param {String} name - module name: `user~repo` - * @param {Boolean} returnPath - returns the canonical require path if true, + * @param {Boolean} returnPath - returns the canonical require path if true, * otherwise it returns the epxorted module */ require.latest = function (name, returnPath) { @@ -83,7 +83,7 @@ require.latest = function (name, returnPath) { semVerCandidates.push({version: version, name: moduleName}); } else { otherCandidates.push({version: version, name: moduleName}); - } + } } } if (semVerCandidates.concat(otherCandidates).length === 0) { @@ -327,7 +327,7 @@ CssEmitter.prototype.bind = function(fn){ /** * Unbind CSS events - * + * * @api public */ @@ -340,7 +340,7 @@ CssEmitter.prototype.unbind = function(fn){ /** * Fire callback only once - * + * * @api public */ @@ -960,6 +960,26 @@ Move.prototype.rotate = function(n){ return this.transform('rotate(' + n + 'deg)'); }; +/** + * + * @param {Number} n + * @returns {Move} for chaining + * @api public + */ + Move.prototype.rotateX = function(n){ + return this.transform('rotateX(' + n + 'deg)'); +}; + +/** + * + * @param {Number} n + * @returns {Move} for chaining + * @api public + */ +Move.prototype.rotateY = function(n){ + return this.transform('rotateY(' + n + 'deg)'); +}; + /** * Set transition easing function to to `fn` string. * @@ -1079,8 +1099,8 @@ Move.prototype.set = function(prop, val){ } } else { this.transition(prop); - this._props[prop] = val; - } + this._props[prop] = val; + } return this; };