OSDN Git Service

Change arguments from numbers to json
authordhrname <dhrname@users.sourceforge.jp>
Fri, 23 Jan 2015 12:20:51 +0000 (21:20 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Fri, 23 Jan 2015 12:20:51 +0000 (21:20 +0900)
org/w3c/dom/smil.js
tool/Spec/spec/SvgDomSpec.js

index 1290805..ab2f139 100644 (file)
@@ -144,7 +144,8 @@ if(window.requestAnimationFrame && requestAnimationFrame
     /*開始フレーム数。アニメーションの開始条件となる*/\r
     begin: 0,\r
 \r
-    /*活動持続時間 (Active Duration)。アニメーションの継続条件となる*/\r
+    /*活動持続時間 (Active Duration)のフレーム数。アニメーションの継続条件となる\r
+     * 単位はフレーム数であって、秒数ではない*/\r
     activeTime: Number.MAX_VALUE,\r
 \r
     /*setFrame メソッド\r
@@ -153,27 +154,21 @@ if(window.requestAnimationFrame && requestAnimationFrame
       if((num < this.begin) || (num >= (this.begin+this.activeTime))) {\r
         return;\r
       }\r
-      var timelines = this.timelines; // タイムラインのリスト\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
-    addLine: function( /*number*/ begin, /*number*/ activateDuration ) {\r
-      if((begin === null) || (activateDuration === null) \r
-        || (arguments.length < 2)) {\r
-        /*どちらの引数も未確認の場合、タイムラインは追加されない*/\r
+     * タイムラインを追加する*/\r
+    addLine: function( /*Object*/ obj ) {\r
+      if(!obj || (!obj.begin && (obj.begin !== 0))\r
+      || (!obj.activeTime && (obj.activeTime !== 0)) ) {\r
+        /*どちらのプロパティも未確認の場合、タイムラインは追加されない*/\r
         return false;\r
       }\r
-      this.timelines.push( this.up("$line").mix( {\r
-          begin:      begin,\r
-          activeTime: activateDuration,\r
-          /*リストが追加された時間 ( = 解決済み時間)*/\r
-          resolved: Date.now()\r
-        } )\r
-      );\r
+      /*objを計算実体(サンク)として適用*/\r
+      this.timelines.push( this.up("$line").of(obj) );\r
       return true;\r
     }\r
   } );\r
index ef0948e..b881fee 100644 (file)
@@ -2059,8 +2059,13 @@ describe("SMIL Animation Spec", function() {
       /*負の値も許される*/\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
+      expect(frame.addLine({})).toBe(false);\r
+      expect(frame.addLine({\r
+        begin: 0\r
+      })).toBe(false);\r
+      expect(frame.addLine({\r
+        activeTime: 1\r
+      })).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
@@ -2071,15 +2076,26 @@ describe("SMIL Animation Spec", function() {
       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
-      expect(frame.addLine(null, 0)).toBe(false);\r
+      expect(frame.addLine( {\r
+        begin: 0,\r
+        activeTime: 0\r
+      })).toBe(true);\r
+      expect(frame.addLine( {\r
+        begin: null,\r
+        activeTime: null\r
+      })).toBe(false);\r
+      expect(frame.addLine( {\r
+        begin: 0,\r
+        activeTime: null\r
+      })).toBe(false);\r
+      expect(frame.addLine( {\r
+        begin: null,\r
+        activeTime: 0\r
+      })).toBe(false);\r
       \r
       var timeline = frame.timelines[0];\r
       expect(timeline.begin).toBe(0);\r
       expect(timeline.activeTime).toBe(0);\r
-      expect(typeof timeline.resolved).toBe("number")\r
     });\r
     /*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/\r
     it("should be this for the value (the invalid partion)", function() {\r