OSDN Git Service

Modify a listener method for driven event
authordhrname <dhrname@users.sourceforge.jp>
Mon, 16 Feb 2015 12:25:21 +0000 (21:25 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Mon, 16 Feb 2015 12:25:21 +0000 (21:25 +0900)
org/w3c/dom/smil.js
tool/Spec/spec/SvgDomSpec.js

index 9aaa719..16214c1 100644 (file)
@@ -143,6 +143,9 @@ base("$frame").mix ( {
 \r
   /*開始フレーム数。アニメーションの開始条件となる*/\r
   begin: 0,\r
+  \r
+  /*開始時刻 (文書が読み込まれたときにDate.nowなどで取得)*/\r
+  startTime: 0,\r
 \r
   /*活動持続時間 (Active Duration)のフレーム数。アニメーションの継続条件となる\r
    * 単位はフレーム数であって、秒数ではない*/\r
@@ -287,6 +290,7 @@ base("$frame").mix ( {
     /*イベントのリスナーとして、parseメソッドで使う*/\r
     listener: function(evt) {\r
       evt = evt || { timeStamp: 0 };\r
+      this.begin += Math.floor( (evt.timeStamp - this.startTime ) * this.fpms );\r
       var s = this.$activate;\r
       s.begin = this.begin;\r
       s.timeStamp = evt.timeStamp;\r
index b5001f8..b9b49ed 100644 (file)
@@ -2054,6 +2054,7 @@ describe("SMIL Animation Spec", function() {
     it("should be this for the value  (limit value analysis)", function() {\r
       expect(typeof frame.setFrame).toBe("function");\r
       expect(frame.timelines.length).toEqual(0);\r
+      expect(frame.startTime).toEqual(0);\r
       frame.setFrame();\r
       frame.setFrame(0);\r
       /*負の値も許される*/\r
@@ -2443,6 +2444,13 @@ describe("SMIL Animation Spec", function() {
         expect(obj.$1.activeTime).toEqual(Math.floor(1000*obj.fpms) - 1);\r
         expect(obj.$1.$activate.begin).toBe(obj.$1.begin);\r
         expect(obj.timelines[1]).toBe(obj.$1);\r
+        obj.$1.listener( {\r
+          timeStamp: 500\r
+        } );\r
+        expect(obj.$1.begin).toBe(Math.floor(500*obj.fpms) + 1);\r
+        expect(obj.$1.activeTime).toEqual(Math.floor(1000*obj.fpms) - Math.floor(500*obj.fpms) - 1);\r
+        expect(obj.$1.$activate.begin).toBe(obj.$1.begin);\r
+        expect(obj.timelines[1]).toBe(obj.$1);\r
       } );\r
       /*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/\r
       it("should be this for the value (the invalid partion)", function() {\r