[Sie-announce] SIEコード [1440] beginElementメソッドの実装

アーカイブの一覧に戻る

svnno****@sourc***** svnno****@sourc*****
2009年 11月 27日 (金) 23:09:13 JST


Revision: 1440
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1440
Author:   dhrname
Date:     2009-11-27 23:09:13 +0900 (Fri, 27 Nov 2009)

Log Message:
-----------
beginElementメソッドの実装

Modified Paths:
--------------
    branches/05x/055/sie.js

Modified: branches/05x/055/sie.js
===================================================================
--- branches/05x/055/sie.js	2009-11-26 15:00:28 UTC (rev 1439)
+++ branches/05x/055/sie.js	2009-11-27 14:09:13 UTC (rev 1440)
@@ -2218,25 +2218,39 @@
 };
 STSetElement.prototype.set = function (w,h){
   this.to = this.tar.getAttribute("to");
-  var timing = [this.begin, this.dur, this.end], offset = [];
-  for (var i=0;i<3;++i) {
-    var ti = timing[i];
-    if (ti) {
-      var n = parseFloat(ti.match(/[\-\d\.]+(h|min|s|ms)/));
-      offset[i] = n * this._unit[RegExp.$1];
-      if ( /(mouse|activ)/.test(ti) ) { //イベントがある場合
+  var offset;
+  try {
+    var n = parseFloat(this.begin.match(/[\-\d\.]+(h|min|s|ms)/));
+    offset = (n !== void 0) ? n * this._unit[RegExp.$1] : 0;
+    if ( /(mouse|activ)/.test(this.begin) ) { //イベントがある場合
+      var tar;
+      if ( /\.\D/.test(this.begin) ) {
+        tar = document.getElementById( this.begin.substring(0, this.begin.indexOf(".")) );
+      } else {
+        tar = this.tarrget.tar;
+      }
+      var tea = this.beginElementAt;
+      tar.addEvent( "on" + this.begin.match(/(mouse|activ)[a-z]+/i), (function(){tea(offset)}) );
+    } else {
+      this.beginElementAt(offset);
+    }
+    if (!this.dur) {
+      var n = parseFloat(this.end.match(/[\-\d\.]+(h|min|s|ms)/));
+      offset = (n !== void 0) ? n * this._unit[RegExp.$1] : 0;
+      if ( /(mouse|activ)/.test(this.end) ) { //イベントがある場合
         var tar;
-        if ( /\.\D/.test(ti) {
-          tar = document.getElementById(ti.substring(0, ti.indexOf("."));
+        if ( /\.\D/.test(this.end) ) {
+          tar = document.getElementById( this.end.substring(0, this.end.indexOf(".")) );
         } else {
           tar = this.tarrget.tar;
         }
-        tar.addEvent( ti.match(/(mouse|activ)[a-z]+/i), (function(){}) );
+        var tea = this.endElementAt;
+        tar.addEvent( "on" + this.end.match(/(mouse|activ)[a-z]+/i), (function(){tea(offset)}) );
+      } else {
+        this.endElementAt(offset);
       }
-    } else {
-      offset[i] = 0;
     }
-  }
+  } catch(e) {stlog.add(e, 2239);}
 };
 STSetElement.prototype._unit = {
   "h" : 1000,
@@ -2278,6 +2292,7 @@
   }
   target.set(this.w, this.h);
   this.base = base;
+  return;
 };
 STSetElement.prototype.endElement = function (){
   if (this.fill) {
@@ -2287,6 +2302,7 @@
   }
   this.to = this.base;
   this.beginElement();
+  return;
 };
 STSetElement.prototype.beginElementAt = function (offset){
   this._begin = offset * 0.8 * 0.024;  //フレーム数に変換(軽量化のために、1s = 800msで計算)




Sie-announce メーリングリストの案内
アーカイブの一覧に戻る