3 Copyright 2012 Yahoo! Inc. All rights reserved.
4 Licensed under the BSD License.
5 http://yuilibrary.com/license/
7 if (typeof _yuitest_coverage == "undefined"){
8 _yuitest_coverage = {};
9 _yuitest_coverline = function(src, line){
10 var coverage = _yuitest_coverage[src];
11 if (!coverage.lines[line]){
12 coverage.calledLines++;
14 coverage.lines[line]++;
16 _yuitest_coverfunc = function(src, name, line){
17 var coverage = _yuitest_coverage[src],
18 funcId = name + ":" + line;
19 if (!coverage.functions[funcId]){
20 coverage.calledFunctions++;
22 coverage.functions[funcId]++;
25 _yuitest_coverage["build/anim-curve/anim-curve.js"] = {
32 path: "build/anim-curve/anim-curve.js",
35 _yuitest_coverage["build/anim-curve/anim-curve.js"].code=["YUI.add('anim-curve', function (Y, NAME) {","","/**"," * 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"," */","","Y.Anim.behaviors.curve = {"," set: function(anim, att, from, to, elapsed, duration, fn) {"," from = from.slice.call(from);"," to = to.slice.call(to);"," var t = fn(elapsed, 0, 100, duration) / 100;"," to.unshift(from);"," anim._node.setXY(Y.Anim.getBezier(to, t));"," },",""," get: function(anim, att) {"," return anim._node.getXY();"," }","};","","/**"," * Get the current position of the animated element based on t."," * 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. "," * @for Anim"," * @method getBezier"," * @static"," * @param {Array} points An array containing Bezier points"," * @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 = [];",""," for (var i = 0; i < n; ++i){"," tmp[i] = [points[i][0], points[i][1]]; // save input"," }"," "," for (var 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]; "," }"," }",""," return [ tmp[0][0], tmp[0][1] ]; ","","};","","","}, '3.7.2', {\"requires\": [\"anim-xy\"]});"];
36 _yuitest_coverage["build/anim-curve/anim-curve.js"].lines = {"1":0,"10":0,"12":0,"13":0,"14":0,"15":0,"16":0,"20":0,"37":0,"38":0,"39":0,"41":0,"42":0,"45":0,"46":0,"47":0,"48":0,"52":0};
37 _yuitest_coverage["build/anim-curve/anim-curve.js"].functions = {"set:11":0,"get:19":0,"getBezier:37":0,"(anonymous 1):1":0};
38 _yuitest_coverage["build/anim-curve/anim-curve.js"].coveredLines = 18;
39 _yuitest_coverage["build/anim-curve/anim-curve.js"].coveredFunctions = 4;
40 _yuitest_coverline("build/anim-curve/anim-curve.js", 1);
41 YUI.add('anim-curve', function (Y, NAME) {
44 * Adds support for the <code>curve</code> property for the <code>to</code>
45 * attribute. A curve is zero or more control points and an end point.
47 * @submodule anim-curve
50 _yuitest_coverfunc("build/anim-curve/anim-curve.js", "(anonymous 1)", 1);
51 _yuitest_coverline("build/anim-curve/anim-curve.js", 10);
52 Y.Anim.behaviors.curve = {
53 set: function(anim, att, from, to, elapsed, duration, fn) {
54 _yuitest_coverfunc("build/anim-curve/anim-curve.js", "set", 11);
55 _yuitest_coverline("build/anim-curve/anim-curve.js", 12);
56 from = from.slice.call(from);
57 _yuitest_coverline("build/anim-curve/anim-curve.js", 13);
58 to = to.slice.call(to);
59 _yuitest_coverline("build/anim-curve/anim-curve.js", 14);
60 var t = fn(elapsed, 0, 100, duration) / 100;
61 _yuitest_coverline("build/anim-curve/anim-curve.js", 15);
63 _yuitest_coverline("build/anim-curve/anim-curve.js", 16);
64 anim._node.setXY(Y.Anim.getBezier(to, t));
67 get: function(anim, att) {
68 _yuitest_coverfunc("build/anim-curve/anim-curve.js", "get", 19);
69 _yuitest_coverline("build/anim-curve/anim-curve.js", 20);
70 return anim._node.getXY();
75 * Get the current position of the animated element based on t.
76 * Each point is an array of "x" and "y" values (0 = x, 1 = y)
77 * At least 2 points are required (start and end).
78 * First point is start. Last point is end.
79 * Additional control points are optional.
83 * @param {Array} points An array containing Bezier points
84 * @param {Number} t A number between 0 and 1 which is the basis for determining current position
85 * @return {Array} An array containing int x and y member data
87 _yuitest_coverline("build/anim-curve/anim-curve.js", 37);
88 Y.Anim.getBezier = function(points, t) {
89 _yuitest_coverfunc("build/anim-curve/anim-curve.js", "getBezier", 37);
90 _yuitest_coverline("build/anim-curve/anim-curve.js", 38);
91 var n = points.length;
92 _yuitest_coverline("build/anim-curve/anim-curve.js", 39);
95 _yuitest_coverline("build/anim-curve/anim-curve.js", 41);
96 for (var i = 0; i < n; ++i){
97 _yuitest_coverline("build/anim-curve/anim-curve.js", 42);
98 tmp[i] = [points[i][0], points[i][1]]; // save input
101 _yuitest_coverline("build/anim-curve/anim-curve.js", 45);
102 for (var j = 1; j < n; ++j) {
103 _yuitest_coverline("build/anim-curve/anim-curve.js", 46);
104 for (i = 0; i < n - j; ++i) {
105 _yuitest_coverline("build/anim-curve/anim-curve.js", 47);
106 tmp[i][0] = (1 - t) * tmp[i][0] + t * tmp[parseInt(i + 1, 10)][0];
107 _yuitest_coverline("build/anim-curve/anim-curve.js", 48);
108 tmp[i][1] = (1 - t) * tmp[i][1] + t * tmp[parseInt(i + 1, 10)][1];
112 _yuitest_coverline("build/anim-curve/anim-curve.js", 52);
113 return [ tmp[0][0], tmp[0][1] ];
118 }, '3.7.2', {"requires": ["anim-xy"]});