Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update for a clean lint.

  • Loading branch information...
commit 09f88df71c6779bdd36f894676dfe2610153d91f 1 parent 85797ad
@apipkin apipkin authored
View
10 src/anim/js/anim-color.js
@@ -25,9 +25,9 @@ Y.Anim.getUpdatedColorValue = function(fromColor, toColor, elapsed, duration, f
Y.Anim.behaviors.color = {
set: function(anim, att, from, to, elapsed, duration, fn) {
- anim._node.setStyle(att, Y.Anim.getUpdatedColorValue(from, to, elapsed, duration, fn));
+ anim._node.setStyle(att, Y.Anim.getUpdatedColorValue(from, to, elapsed, duration, fn));
},
-
+
// TODO: default bgcolor const
get: function(anim, att) {
var val = anim._node.getComputedStyle(att);
@@ -39,10 +39,10 @@ Y.Anim.behaviors.color = {
Y.each(['backgroundColor',
'borderColor',
'borderTopColor',
- 'borderRightColor',
- 'borderBottomColor',
+ 'borderRightColor',
+ 'borderBottomColor',
'borderLeftColor'],
- function(v, i) {
+ function(v) {
Y.Anim.behaviors[v] = Y.Anim.behaviors.color;
}
);
View
24 src/anim/js/anim-curve.js
@@ -1,5 +1,5 @@
/**
- * Adds support for the <code>curve</code> property for the <code>to</code>
+ * Adds support for the <code>curve</code> property for the <code>to</code>
* attribute. A curve is zero or more control points and an end point.
* @module anim
* @submodule anim-curve
@@ -14,7 +14,7 @@ Y.Anim.behaviors.curve = {
anim._node.setXY(Y.Anim.getBezier(to, t));
},
- get: function(anim, att) {
+ get: function(anim) {
return anim._node.getXY();
}
};
@@ -24,7 +24,7 @@ Y.Anim.behaviors.curve = {
* Each point is an array of "x" and "y" values (0 = x, 1 = y)
* At least 2 points are required (start and end).
* First point is start. Last point is end.
- * Additional control points are optional.
+ * Additional control points are optional.
* @for Anim
* @method getBezier
* @static
@@ -32,21 +32,23 @@ Y.Anim.behaviors.curve = {
* @param {Number} t A number between 0 and 1 which is the basis for determining current position
* @return {Array} An array containing int x and y member data
*/
-Y.Anim.getBezier = function(points, t) {
- var n = points.length;
- var tmp = [];
+Y.Anim.getBezier = function(points, t) {
+ var n = points.length,
+ tmp = [],
+ i,
+ j;
- for (var i = 0; i < n; ++i){
+ for (i = 0; i < n; ++i){
tmp[i] = [points[i][0], points[i][1]]; // save input
}
-
- for (var j = 1; j < n; ++j) {
+
+ for (j = 1; j < n; ++j) {
for (i = 0; i < n - j; ++i) {
tmp[i][0] = (1 - t) * tmp[i][0] + t * tmp[parseInt(i + 1, 10)][0];
- tmp[i][1] = (1 - t) * tmp[i][1] + t * tmp[parseInt(i + 1, 10)][1];
+ tmp[i][1] = (1 - t) * tmp[i][1] + t * tmp[parseInt(i + 1, 10)][1];
}
}
- return [ tmp[0][0], tmp[0][1] ];
+ return [ tmp[0][0], tmp[0][1] ];
};
View
81 src/anim/js/anim-easing.js
@@ -3,13 +3,28 @@ TERMS OF USE - EASING EQUATIONS
Open source under the BSD License.
Copyright 2001 Robert Penner All rights reserved.
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of the author nor the names of contributors may be used to
+ endorse or promote products derived from this software without specific prior
+ written permission.
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
@@ -35,7 +50,7 @@ var Easing = {
easeNone: function (t, b, c, d) {
return c*t/d + b;
},
-
+
/**
* Begins slowly and accelerates towards end. (quadratic)
* @method easeIn
@@ -61,7 +76,7 @@ var Easing = {
easeOut: function (t, b, c, d) {
return -c *(t/=d)*(t-2) + b;
},
-
+
/**
* Begins slowly and decelerates towards end. (quadratic)
* @method easeBoth
@@ -72,13 +87,13 @@ var Easing = {
* @return {Number} The computed value for the current animation frame
*/
easeBoth: function (t, b, c, d) {
- if ((t/=d/2) < 1) {
+ if ((t /= d/2) < 1) {
return c/2*t*t + b;
}
-
+
return -c/2 * ((--t)*(t-2) - 1) + b;
},
-
+
/**
* Begins slowly and accelerates towards end. (quartic)
* @method easeInStrong
@@ -91,7 +106,7 @@ var Easing = {
easeInStrong: function (t, b, c, d) {
return c*(t/=d)*t*t*t + b;
},
-
+
/**
* Begins quickly and decelerates towards end. (quartic)
* @method easeOutStrong
@@ -104,7 +119,7 @@ var Easing = {
easeOutStrong: function (t, b, c, d) {
return -c * ((t=t/d-1)*t*t*t - 1) + b;
},
-
+
/**
* Begins slowly and decelerates towards end. (quartic)
* @method easeBothStrong
@@ -115,10 +130,10 @@ var Easing = {
* @return {Number} The computed value for the current animation frame
*/
easeBothStrong: function (t, b, c, d) {
- if ((t/=d/2) < 1) {
+ if ((t /= d/2) < 1) {
return c/2*t*t*t*t + b;
}
-
+
return -c/2 * ((t-=2)*t*t*t - 2) + b;
},
@@ -145,15 +160,15 @@ var Easing = {
if (!p) {
p = d* 0.3;
}
-
+
if (!a || a < Math.abs(c)) {
- a = c;
+ a = c;
s = p/4;
}
else {
s = p/(2*Math.PI) * Math.asin (c/a);
}
-
+
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
},
@@ -179,7 +194,7 @@ var Easing = {
if (!p) {
p=d * 0.3;
}
-
+
if (!a || a < Math.abs(c)) {
a = c;
s = p / 4;
@@ -187,10 +202,10 @@ var Easing = {
else {
s = p/(2*Math.PI) * Math.asin (c/a);
}
-
+
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
},
-
+
/**
* Snap both elastic effect.
* @method elasticBoth
@@ -207,28 +222,28 @@ var Easing = {
if (t === 0) {
return b;
}
-
+
if ( (t /= d/2) === 2 ) {
return b+c;
}
-
+
if (!p) {
p = d*(0.3*1.5);
}
-
+
if ( !a || a < Math.abs(c) ) {
- a = c;
+ a = c;
s = p/4;
}
else {
s = p/(2*Math.PI) * Math.asin (c/a);
}
-
+
if (t < 1) {
- return -0.5*(a*Math.pow(2,10*(t-=1)) *
+ return -0.5*(a*Math.pow(2,10*(t-=1)) *
Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
}
- return a*Math.pow(2,-10*(t-=1)) *
+ return a*Math.pow(2,-10*(t-=1)) *
Math.sin( (t*d-s)*(2*Math.PI)/p )*0.5 + c + b;
},
@@ -269,9 +284,9 @@ var Easing = {
}
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
},
-
+
/**
- * Backtracks slightly, then reverses direction, overshoots end,
+ * Backtracks slightly, then reverses direction, overshoots end,
* then reverses and comes back to end.
* @method backBoth
* @param {Number} t Time value used to compute current value
@@ -283,9 +298,9 @@ var Easing = {
*/
backBoth: function (t, b, c, d, s) {
if (typeof s === 'undefined') {
- s = 1.70158;
+ s = 1.70158;
}
-
+
if ((t /= d/2 ) < 1) {
return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
}
@@ -304,7 +319,7 @@ var Easing = {
bounceIn: function (t, b, c, d) {
return c - Y.Easing.bounceOut(d-t, 0, c, d) + b;
},
-
+
/**
* Bounces off end.
* @method bounceOut
@@ -324,7 +339,7 @@ var Easing = {
}
return c*(7.5625*(t-=(2.625/2.75))*t + 0.984375) + b;
},
-
+
/**
* Bounces off start and end.
* @method bounceBoth
View
2  src/anim/js/anim-scroll.js
@@ -11,7 +11,7 @@ var NUM = Number;
Y.Anim.behaviors.scroll = {
set: function(anim, att, from, to, elapsed, duration, fn) {
var
- node = anim._node,
+ node = anim._node,
val = ([
fn(elapsed, NUM(from[0]), NUM(to[0]) - NUM(from[0]), duration),
fn(elapsed, NUM(from[1]), NUM(to[1]) - NUM(from[1]), duration)
View
36 src/anim/js/anim-shape.js
@@ -8,8 +8,8 @@
/**
* Adds support for the <code>transform</code>, <code>fill</code>, and <code> attributes of <code>Graphic</code>
* <code>Shape</code> instances. The <code>anim-shape</code> submodule can be used for all animations involving
- * <code>Graphic</code> <code>Shape</code> attributes.
- *
+ * <code>Graphic</code> <code>Shape</code> attributes.
+ *
* @module anim
* @submodule anim-shape
*/
@@ -27,15 +27,6 @@
fromStop,
prop,
len = to.length,
- color,
- opacity,
- offset,
- rotation,
- r,
- fx,
- fy,
- cx,
- cy,
stops = [],
stop;
for(; i < len; i = i + 1)
@@ -47,9 +38,15 @@
{
if(toStop.hasOwnProperty(prop))
{
- if(prop == COLOR)
+ if(prop === COLOR)
{
- stop[prop] = Y.Color.toHex(getUpdatedColorValue(Y.Color.toHex(fromStop[prop]), Y.Color.toHex(toStop[prop]), elapsed, duration, fn));
+ stop[prop] = Y.Color.toHex(getUpdatedColorValue(
+ Y.Color.toHex(fromStop[prop]),
+ Y.Color.toHex(toStop[prop]),
+ elapsed,
+ duration,
+ fn
+ ));
}
else
{
@@ -69,7 +66,7 @@
getUpdatedStops = GETUPDATEDSTOPS;
for(i in to)
{
- if(to.hasOwnProperty(i) && i != TYPE)
+ if(to.hasOwnProperty(i) && i !== TYPE)
{
switch(i)
{
@@ -89,7 +86,7 @@
}
};
Y.Anim.behaviors.fill = FILLANDSTROKEBEHAVIOR;
- Y.Anim.behaviors.stroke = FILLANDSTROKEBEHAVIOR;
+ Y.Anim.behaviors.stroke = FILLANDSTROKEBEHAVIOR;
Y.Anim.behaviors.transform = {
set: function(anim, att, from, to, elapsed, duration, fn) {
@@ -129,11 +126,10 @@
}
node._transform = TOSTRING;
},
-
+
get: function(anim) {
var node = anim._node,
fromMatrix = node.matrix,
- toAttr = anim.get("to") || {},
toString = anim.get("to").transform,
fromString = node.get("transform"),
toArray = Y.MatrixUtil.getTransformArray(toString),
@@ -169,8 +165,8 @@
for(i = 0; i < len; ++i)
{
transformFunction = toArray[i].shift();
- transformFunction = transformFunction == "matrix" ? "multiply" : transformFunction;
- toMatrix[transformFunction].apply(toMatrix, toArray[i]);
+ transformFunction = transformFunction === "matrix" ? "multiply" : transformFunction;
+ toMatrix[transformFunction].apply(toMatrix, toArray[i]);
}
TO = toMatrix.decompose();
@@ -180,5 +176,5 @@
TOSTRING = toString;
return from;
}
- };
+ };
View
2  src/anim/js/anim-xy.js
@@ -1,5 +1,5 @@
/**
- * Adds support for the <code>xy</code> property in <code>from</code> and
+ * Adds support for the <code>xy</code> property in <code>from</code> and
* <code>to</code> attributes.
* @module anim
* @submodule anim-xy
View
73 src/anim/js/anim.js
@@ -85,7 +85,7 @@
};
/**
- * Time in milliseconds passed to setInterval for frame processing
+ * Time in milliseconds passed to setInterval for frame processing
*
* @property intervalTime
* @default 20
@@ -173,7 +173,7 @@
node: {
setter: function(node) {
if (node) {
- if (typeof node == 'string' || node.nodeType) {
+ if (typeof node === 'string' || node.nodeType) {
node = Y.one(node);
}
}
@@ -196,7 +196,7 @@
},
/**
- * The method that will provide values to the attribute(s) during the animation.
+ * The method that will provide values to the attribute(s) during the animation.
* Defaults to "Easing.easeNone".
* @attribute easing
* @type Function
@@ -249,7 +249,7 @@
* Date stamp for the first frame of the animation.
* @attribute startTime
* @type Int
- * @default 0
+ * @default 0
* @readOnly
*/
startTime: {
@@ -261,7 +261,7 @@
* Current time the animation has been running.
* @attribute elapsedTime
* @type Int
- * @default 0
+ * @default 0
* @readOnly
*/
elapsedTime: {
@@ -271,9 +271,9 @@
/**
* Whether or not the animation is currently running.
- * @attribute running
+ * @attribute running
* @type Boolean
- * @default false
+ * @default false
* @readOnly
*/
running: {
@@ -285,10 +285,10 @@
},
/**
- * The number of times the animation should run
+ * The number of times the animation should run
* @attribute iterations
* @type Int
- * @default 1
+ * @default 1
*/
iterations: {
value: 1
@@ -296,7 +296,7 @@
/**
* The number of iterations that have occurred.
- * Resets when an animation ends (reaches iteration count or stop() called).
+ * Resets when an animation ends (reaches iteration count or stop() called).
* @attribute iterationCount
* @type Int
* @default 0
@@ -308,7 +308,7 @@
},
/**
- * How iterations of the animation should behave.
+ * How iterations of the animation should behave.
* Possible values are "normal" and "alternate".
* Normal will repeat the animation, alternate will reverse on every other pass.
*
@@ -322,9 +322,9 @@
/**
* Whether or not the animation is currently paused.
- * @attribute paused
+ * @attribute paused
* @type Boolean
- * @default false
+ * @default false
* @readOnly
*/
paused: {
@@ -336,7 +336,7 @@
* If true, animation begins from last frame
* @attribute reverse
* @type Boolean
- * @default false
+ * @default false
*/
reverse: {
value: false
@@ -349,10 +349,11 @@
* Runs all animation instances.
* @method run
* @static
- */
+ */
Y.Anim.run = function() {
- var instances = Y.Anim._instances;
- for (var i in instances) {
+ var instances = Y.Anim._instances,
+ i;
+ for (i in instances) {
if (instances[i].run) {
instances[i].run();
}
@@ -363,7 +364,7 @@
* Pauses all animation instances.
* @method pause
* @static
- */
+ */
Y.Anim.pause = function() {
for (var i in _running) { // stop timer if nothing running
if (_running[i].pause) {
@@ -378,7 +379,7 @@
* Stops all animation instances.
* @method stop
* @static
- */
+ */
Y.Anim.stop = function() {
for (var i in _running) { // stop timer if nothing running
if (_running[i].stop) {
@@ -387,7 +388,7 @@
}
Y.Anim._stopTimer();
};
-
+
Y.Anim._startTimer = function() {
if (!_timer) {
_timer = setInterval(Y.Anim._runFrame, Y.Anim._intervalTime);
@@ -404,10 +405,11 @@
* @method _runFrame
* @private
* @static
- */
+ */
Y.Anim._runFrame = function() {
- var done = true;
- for (var anim in _running) {
+ var done = true,
+ anim;
+ for (anim in _running) {
if (_running[anim]._runFrame) {
done = false;
_running[anim]._runFrame();
@@ -426,7 +428,7 @@
* Starts or resumes an animation.
* @method run
* @chainable
- */
+ */
run: function() {
if (this.get(PAUSED)) {
this._resume();
@@ -442,7 +444,7 @@
* Calling run() will continue where it left off.
* @method pause
* @chainable
- */
+ */
pause: function() {
if (this.get(RUNNING)) {
this._pause();
@@ -455,7 +457,7 @@
* @method stop
* @param {Boolean} finish If true, the animation will move to the last frame
* @chainable
- */
+ */
stop: function(finish) {
if (this.get(RUNNING) || this.get(PAUSED)) {
this._end(finish);
@@ -524,10 +526,8 @@
var d = this._runtimeAttr.duration,
t = new Date() - this.get(START_TIME),
reverse = this.get(REVERSE),
- done = (t >= d),
- attribute,
- setter;
-
+ done = (t >= d);
+
this._runAttrs(t, d, reverse);
this._actualFrames += 1;
this._set(ELAPSED_TIME, t);
@@ -564,9 +564,9 @@
customAttr[i].set : Y.Anim.DEFAULT_SETTER;
if (!done) {
- setter(this, i, attribute.from, attribute.to, t, d, easing, attribute.unit);
+ setter(this, i, attribute.from, attribute.to, t, d, easing, attribute.unit);
} else {
- setter(this, i, attribute.from, attribute.to, lastFrame, d, easing, attribute.unit);
+ setter(this, i, attribute.from, attribute.to, lastFrame, d, easing, attribute.unit);
}
}
}
@@ -623,8 +623,8 @@
begin = begin.call(this, node);
}
- var mFrom = Y.Anim.RE_UNITS.exec(begin);
- var mTo = Y.Anim.RE_UNITS.exec(val);
+ var mFrom = Y.Anim.RE_UNITS.exec(begin),
+ mTo = Y.Anim.RE_UNITS.exec(val);
begin = mFrom ? mFrom[1] : begin;
end = mTo ? mTo[1] : val;
@@ -656,10 +656,11 @@
var node = this._node,
val = node.getComputedStyle(attr),
get = (attr === 'left') ? 'getX': 'getY',
- set = (attr === 'left') ? 'setX': 'setY';
+ set = (attr === 'left') ? 'setX': 'setY',
+ position;
if (val === 'auto') {
- var position = node.getStyle('position');
+ position = node.getStyle('position');
if (position === 'absolute' || position === 'fixed') {
val = node[get]();
node[set](val);
View
20 src/anim/meta/anim.json
@@ -13,39 +13,39 @@
"submodules": {
"anim-base": {
"requires": [
- "base-base",
+ "base-base",
"node-style"
]
- },
+ },
"anim-color": {
"requires": [
"anim-base"
]
- },
+ },
"anim-curve": {
"requires": [
"anim-xy"
]
- },
+ },
"anim-easing": {
"requires": [
"anim-base"
]
- },
+ },
"anim-node-plugin": {
"requires": [
- "node-pluginhost",
+ "node-pluginhost",
"anim-base"
]
- },
+ },
"anim-scroll": {
"requires": [
"anim-base"
]
- },
+ },
"anim-xy": {
"requires": [
- "anim-base",
+ "anim-base",
"node-screen"
]
},
@@ -58,7 +58,7 @@
]
},
"anim-shape-transform": {
- "use": [
+ "use": [
"anim-shape"
]
}
Please sign in to comment.
Something went wrong with that request. Please try again.