svnno****@sourc*****
svnno****@sourc*****
2009年 12月 12日 (土) 23:45:00 JST
Revision: 1461 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1461 Author: dhrname Date: 2009-12-12 23:45:00 +0900 (Sat, 12 Dec 2009) Log Message: ----------- 軽量化のために、getOffsetメソッドを導入した Modified Paths: -------------- branches/05x/056/sie.js Modified: branches/05x/056/sie.js =================================================================== --- branches/05x/056/sie.js 2009-12-12 14:33:46 UTC (rev 1460) +++ branches/05x/056/sie.js 2009-12-12 14:45:00 UTC (rev 1461) @@ -2252,8 +2252,7 @@ this.to = this.tar.getAttribute("to"); var offset, beginOffset = 0; try { - var n = parseFloat(this.begin.match(/[\-\d\.]+(h|min|s|ms)/)); - offset = (!isNaN(n)) ? n * this._unit[RegExp.$1] : 0; + offset = this.getOffset(this.begin); if ( /(mouse|activ|click)/.test(this.begin) ) { //イベントがある場合 var tar; if ( /\.\D/.test(this.begin) ) { @@ -2270,12 +2269,10 @@ beginOffset = offset; } if (this.dur) { - var n = parseFloat(this.dur.match(/[\-\d\.]+(h|min|s|ms)/)); - this.simpleDuration = (!isNaN(n)) ? n * this._unit[RegExp.$1] : 0; + this.simpleDuration = this.getOffset(this.dur); } if (this.end) { - var n = parseFloat(this.end.match(/[\-\d\.]+(h|min|s|ms)/)); - offset = (!isNaN(n)) ? n * this._unit[RegExp.$1] : 0; + offset = this.getOffset(this.end); if ( /(mouse|activ|click)/.test(this.end) ) { //イベントがある場合 var tar; if ( /\.\D/.test(this.end) ) { @@ -2299,6 +2296,13 @@ "s" : 800, "ms" : 0.8 }; +//どれだけズレの時間があるかを計測するメソッド +STSetElement.prototype.getOffset = function(/*string*/ t) { + var n = parseFloat(t.match(/[\-\d\.]+(h|min|s|ms)/)); + var offset = (!isNaN(n)) ? n * this._unit[RegExp.$1] : 0; + n = t = null; + return offset; +}; //sは現在のフレーム数であることに気をつけること STSetElement.prototype._frame = function(/*int*/ s) { if (this._begin) { @@ -2401,8 +2405,7 @@ this.to = this.tar.getAttributeNS(null, "to"); var offset, beginOffset = 0; try { - var n = parseFloat(this.begin.match(/[\-\d\.]+(h|min|s|ms)/)); - offset = (!isNaN(n)) ? n * this._unit[RegExp.$1] : 0; + offset = this.getOffset(this.end); if ( /(mouse|activ|click)/.test(this.begin) ) { //イベントがある場合 var tar; if ( /\.\D/.test(this.begin) ) { @@ -2420,12 +2423,10 @@ beginOffset = offset; } if (this.dur) { - var n = parseFloat(this.dur.match(/[\-\d\.]+(h|min|s|ms)/)); - this.simpleDuration = (!isNaN(n)) ? n * this._unit[RegExp.$1] : 0; + this.simpleDuration = this.getOffset(this.dur); } if (this.end) { - var n = parseFloat(this.end.match(/[\-\d\.]+(h|min|s|ms)/)); - offset = (!isNaN(n)) ? n * this._unit[RegExp.$1] : 0; + offset = this.getOffset(this.end); if ( /(mouse|activ|click)/.test(this.end) ) { //イベントがある場合 var tar; if ( /\.\D/.test(this.end) ) {