OSDN Git Service

Lighten the object
authordhrname <dhrname@users.sourceforge.jp>
Tue, 10 Mar 2015 14:00:30 +0000 (23:00 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Tue, 10 Mar 2015 14:00:30 +0000 (23:00 +0900)
org/w3c/dom/smil.js

index 45f4981..b47c48e 100644 (file)
@@ -561,24 +561,20 @@ base("$from").of( {
       \r
    /*与えられたアニメーションの進捗率を使った時間の圧縮率を計算するための関数を返す*/\r
    call: function() {\r
+     var f = function (t) {\r
+       /*tは進捗率*/\r
+       !this.keyTime && (t = 0);\r
+       t = t / this.keyTime;\r
+       return isNaN(t) ? "0"\r
+                       : this.to.advance(t);\r
+     }.bind(this);\r
      if (this.mode === "linear") {\r
        this.to.call();\r
-       return function(t) {\r
-         /*tは進捗率*/\r
-         !this.keyTime && (t = 0);\r
-         t = t / this.keyTime;\r
-         return isNaN(t) ? "0"\r
-                         : this.to.advance(t);\r
-       }.bind(this);\r
+       return f;\r
      } else if (this.mode === "paced") {\r
        /*keyTimes属性は無視され、ベクトルの距離の割合から計算される*/\r
        this.keyTime = this.to.distance(this.to.from) / this.norm;\r
-       return function(t) {\r
-         !this.keyTime && (t = 0);\r
-         t = t / this.keyTime;\r
-         return isNaN(t) ? "0"\r
-                         : this.to.advance(t);\r
-       }.bind(this);\r
+       return f;\r
      }\r
    }\r
 } ).to = base("$from").$to;\r