From: dhrname Date: Thu, 22 Jan 2015 14:06:23 +0000 (+0900) Subject: Add a activeTime property X-Git-Tag: version22~357 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=0301add2840b0224f705cd3386be87645d846afc;p=sie%2Fsie.git Add a activeTime property --- diff --git a/org/w3c/dom/smil.js b/org/w3c/dom/smil.js index 2359058..a311269 100644 --- a/org/w3c/dom/smil.js +++ b/org/w3c/dom/smil.js @@ -137,14 +137,20 @@ if(window.requestAnimationFrame && requestAnimationFrame base("$frame").mix ( { /*フレームレート。1ミリ秒何フレームか。計算を省略するためミリ秒使用*/ fpms: 0.024, + /*タイムラインのリスト (時間区間の設定ができる)*/ timelines: [], + /*開始フレーム数。アニメーションの開始条件となる*/ begin: 0, + + /*活動持続時間 (Active Duration)。アニメーションの継続条件となる*/ + activeTime: Number.MAX_VALUE, + /*setFrame メソッド * フレーム数を数値num まで進めるか、戻す*/ setFrame: function( /*number*/ num) { - if(num < this.begin) { + if((num < this.begin) || (num >= (this.begin+this.activeTime))) { return; } var timelines = this.timelines; // タイムラインのリスト diff --git a/tool/Spec/spec/SvgDomSpec.js b/tool/Spec/spec/SvgDomSpec.js index 1b392db..ef0948e 100644 --- a/tool/Spec/spec/SvgDomSpec.js +++ b/tool/Spec/spec/SvgDomSpec.js @@ -2056,6 +2056,8 @@ describe("SMIL Animation Spec", function() { expect(frame.timelines.length).toEqual(0); frame.setFrame(); frame.setFrame(0); + /*負の値も許される*/ + frame.setFrame(-1); expect(frame.addLine()).toBe(false); expect(frame.addLine(null)).toBe(false); expect(frame.addLine(0)).toBe(false); @@ -2063,8 +2065,11 @@ describe("SMIL Animation Spec", function() { /*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/ it("should be this for the value (the valid partion)", function() { expect(frame.begin).toEqual(0); + expect(frame.activeTime).toEqual(Number.MAX_VALUE); frame.begin = 10; frame.setFrame(0); + frame.begin = -10; + frame.setFrame(0); expect(frame.addLine(0, 0)).toBe(true); expect(frame.addLine(null, null)).toBe(false);