OSDN Git Service

Add a begin property of the object
authordhrname <dhrname@users.sourceforge.jp>
Thu, 22 Jan 2015 13:56:28 +0000 (22:56 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Thu, 22 Jan 2015 13:56:28 +0000 (22:56 +0900)
org/w3c/dom/smil.js
tool/Spec/spec/SvgDomSpec.js

index 22d5386..2359058 100644 (file)
@@ -139,16 +139,22 @@ if(window.requestAnimationFrame && requestAnimationFrame
     fpms: 0.024,\r
     /*タイムラインのリスト (時間区間の設定ができる)*/\r
     timelines: [],\r
+    /*開始フレーム数。アニメーションの開始条件となる*/\r
+    begin: 0,\r
     /*setFrame メソッド\r
      * フレーム数を数値num まで進めるか、戻す*/\r
     setFrame: function( /*number*/ num) {\r
+      if(num < this.begin) {\r
+        return;\r
+      }\r
       var timelines = this.timelines; // タイムラインのリスト\r
       for (var i=0;i<timelines.length;++i) {\r
         timelines[i].setFrame(num);\r
       }\r
     },\r
     /*addLineメソッド\r
-     * タイムラインを追加する*/\r
+     * タイムラインを追加する\r
+     * なお、引数の単位は時間ではなくて、フレーム数*/\r
     addLine: function( /*number*/ begin, /*number*/ activateDuration ) {\r
       if((begin === null) || (activateDuration === null) \r
         || (arguments.length < 2)) {\r
index 3e4e7be..1b392db 100644 (file)
@@ -2055,12 +2055,17 @@ describe("SMIL Animation Spec", function() {
       expect(typeof frame.setFrame).toBe("function");\r
       expect(frame.timelines.length).toEqual(0);\r
       frame.setFrame();\r
+      frame.setFrame(0);\r
       expect(frame.addLine()).toBe(false);\r
       expect(frame.addLine(null)).toBe(false);\r
       expect(frame.addLine(0)).toBe(false);\r
     });\r
     /*同値分割をして、有効同値クラスを調べておく (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
+      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
       expect(frame.addLine(0, null)).toBe(false);\r