OSDN Git Service

Add a activeTime property
authordhrname <dhrname@users.sourceforge.jp>
Thu, 22 Jan 2015 14:06:23 +0000 (23:06 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Thu, 22 Jan 2015 14:06:23 +0000 (23:06 +0900)
org/w3c/dom/smil.js
tool/Spec/spec/SvgDomSpec.js

index 2359058..a311269 100644 (file)
@@ -137,14 +137,20 @@ if(window.requestAnimationFrame && requestAnimationFrame
   base("$frame").mix ( {\r
     /*フレームレート。1ミリ秒何フレームか。計算を省略するためミリ秒使用*/\r
     fpms: 0.024,\r
+\r
     /*タイムラインのリスト (時間区間の設定ができる)*/\r
     timelines: [],\r
+\r
     /*開始フレーム数。アニメーションの開始条件となる*/\r
     begin: 0,\r
+\r
+    /*活動持続時間 (Active Duration)。アニメーションの継続条件となる*/\r
+    activeTime: Number.MAX_VALUE,\r
+\r
     /*setFrame メソッド\r
      * フレーム数を数値num まで進めるか、戻す*/\r
     setFrame: function( /*number*/ num) {\r
-      if(num < this.begin) {\r
+      if((num < this.begin) || (num >= (this.begin+this.activeTime))) {\r
         return;\r
       }\r
       var timelines = this.timelines; // タイムラインのリスト\r
index 1b392db..ef0948e 100644 (file)
@@ -2056,6 +2056,8 @@ describe("SMIL Animation Spec", function() {
       expect(frame.timelines.length).toEqual(0);\r
       frame.setFrame();\r
       frame.setFrame(0);\r
+      /*負の値も許される*/\r
+      frame.setFrame(-1);\r
       expect(frame.addLine()).toBe(false);\r
       expect(frame.addLine(null)).toBe(false);\r
       expect(frame.addLine(0)).toBe(false);\r
@@ -2063,8 +2065,11 @@ describe("SMIL Animation Spec", function() {
     /*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/\r
     it("should be this for the value (the valid partion)", function() {\r
       expect(frame.begin).toEqual(0);\r
+      expect(frame.activeTime).toEqual(Number.MAX_VALUE);\r
       frame.begin = 10;\r
       frame.setFrame(0);\r
+      frame.begin = -10;\r
+      frame.setFrame(0);\r
 \r
       expect(frame.addLine(0, 0)).toBe(true);\r
       expect(frame.addLine(null, null)).toBe(false);\r