\r
/*keySpline属性の値を設定*/\r
keySpline: null,\r
+ \r
+ /*全体の行列ノルム(距離)*/\r
+ norm: 1,\r
\r
/*与えられたアニメーションの進捗率を使った時間の圧縮率を計算するための関数を返す*/\r
call: function() {\r
- this.to.call();\r
- return function(t) {\r
- /*tは進捗率*/\r
- !this.keyTime && (t = 0);\r
- t = t / this.keyTime;\r
- return isNaN(t) ? "0"\r
- : this.to.advance(t);\r
- }.bind(this);\r
+ if (this.mode === "linear") {\r
+ this.to.call();\r
+ return function(t) {\r
+ /*tは進捗率*/\r
+ !this.keyTime && (t = 0);\r
+ t = t / this.keyTime;\r
+ return isNaN(t) ? "0"\r
+ : this.to.advance(t);\r
+ }.bind(this);\r
+ } else if (this.mode === "paced") {\r
+ /*keyTimes属性は無視され、ベクトルの距離の割合から計算される*/\r
+ this.keyTime = this.to.distance(this.to.from) / this.norm;\r
+ return function(t) {\r
+ !this.keyTime && (t = 0);\r
+ t = t / this.keyTime;\r
+ return isNaN(t) ? "0"\r
+ : this.to.advance(t);\r
+ }.bind(this);\r
+ }\r
}\r
} ).to = base("$from").$to;\r
//#endif // _SMIL_IDL_\r
} );\r
describe("A $calcMode object", function() {\r
var calc = base("$calcMode"),\r
- to = calc.to;\r
+ to = calc.to,\r
+ from;\r
beforeEach( function() {\r
calc = calc.up();\r
calc.to = base("$from").up().mix( {string: "1"} );\r
- calc.to.from = base("$from").up().mix( {string: "0"} );\r
+ from = calc.to.from = base("$from").up().mix( {string: "0"} );\r
} );\r
/*境界条件を調べておく (limit value analysis)*/\r
it("should be this for the value (limit value analysis)", function() {\r
\r
calc.keyTime = 0;\r
expect(calc.call()(1)).toBe("0");\r
+ \r
+ /*paced mode*/\r
+ calc.mode = "paced";\r
+ expect(calc.norm).toEqual(1);\r
+ calc.to.from = from;\r
+ expect(calc.call()(0)).toBe("0");\r
+ expect(calc.keyTime).toBe(1);\r
+ calc.to.from = from;\r
+ expect(calc.call()(1)).toBe("1");\r
+ \r
+ calc.keyTime = 0;\r
+ calc.to.from = from;\r
+ expect(calc.call()(1)).toBe("1");\r
} );\r
/*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/\r
it("should be this for the value (the valid partion)", function() {\r
+ calc.mode = "linear";\r
calc.keyTime = 0.5;\r
calc.to.degit = 1;\r
expect(calc.call()(0.2)).toBe("0.4");\r