From d9d8e755b4ac08afcf4d7a8c7906ccdada84aa11 Mon Sep 17 00:00:00 2001 From: dhrname Date: Mon, 24 Nov 2014 22:25:12 +0900 Subject: [PATCH] =?utf8?q?SVGAnimationElement=E3=81=AE=E3=83=A1=E3=82=BD?= =?utf8?q?=E3=83=83=E3=83=89=E3=81=AB=E9=96=A2=E3=81=99=E3=82=8B=E3=83=90?= =?utf8?q?=E3=82=B0=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- org/w3c/dom/svg.js | 265 +++++++++++++++++++++++++++-------------------------- 1 file changed, 133 insertions(+), 132 deletions(-) diff --git a/org/w3c/dom/svg.js b/org/w3c/dom/svg.js index 7e29cfe..78f7af5 100644 --- a/org/w3c/dom/svg.js +++ b/org/w3c/dom/svg.js @@ -5359,144 +5359,145 @@ base.$1.upsvg("animate") }, false); evt = tar = void 0; }, false); -}; -(function(t) { -/*以下のメソッド(beginElementなど)については、 - *別モジュールであるsmil::ElementTimeControl(smil.js)を参照のこと - */ -/*void*/ t.beginElement = function() { - var ttd = this.ownerDocument, - evt = ttd.createEvent("TimeEvents"); - this._starting = ttd.documentElement.getCurrentTime(); //getStartTimeメソッドで使う開始時刻 - if (this._isStarted && ((this._restart === "never") - || ((this._restart === "whenNotActive") && (this.getCurrentTime() > 0)))) { - return; //restart属性の設定により、再起動させないようにする - } - if (this.getCurrentTime() > 0) { - /*アニメーションの最中で、beginEventが起きるときは、endEventが前もって起こされる。SVG1.1の仕様を参照 - * - * 19.4.2 Interface TimeEvent - * Note that if an element is restarted while it is currently playing, the element will raise an end event and another begin event, as the element restarts. - * - * http://www.w3.org/TR/SVG/animate.html#InterfaceTimeEvent - * - */ - this.endElement(); - } - evt.initTimeEvent("beginEvent", ttd.defaultView, 0); - this.dispatchEvent(evt); - /*新しくリストの頭を更新して、別の値も実行させるようにする*/ - this._start && this._start.shift(); - this._isStarted = true; - ttd = evt = void 0; -}; -/*void*/ t.endElement = function() { - var ttd = this.ownerDocument, - evt = ttd.createEvent("TimeEvents"); - evt.initTimeEvent("endEvent", ttd.defaultView, 0); - this.dispatchEvent(evt); - this._finish && this._finish.shift(); - this._currentFrame = 0; -}; -/*void*/ t.beginElementAt = function(/*float*/ offset) { - var ntc = this.ownerDocument.documentElement.getCurrentTime(), - start = this._start || []; - for (var i=0,sli=start.length;i 0)))) { + return; //restart属性の設定により、再起動させないようにする + } + if (this.getCurrentTime() > 0) { + /*アニメーションの最中で、beginEventが起きるときは、endEventが前もって起こされる。SVG1.1の仕様を参照 + * + * 19.4.2 Interface TimeEvent + * Note that if an element is restarted while it is currently playing, the element will raise an end event and another begin event, as the element restarts. + * + * http://www.w3.org/TR/SVG/animate.html#InterfaceTimeEvent + * + */ + this.endElement(); + } + evt.initTimeEvent("beginEvent", ttd.defaultView, 0); + this.dispatchEvent(evt); + /*新しくリストの頭を更新して、別の値も実行させるようにする*/ + this._start && this._start.shift(); + this._isStarted = true; + ttd = evt = void 0; + }; + /*void*/ t.endElement = function() { + var ttd = this.ownerDocument, + evt = ttd.createEvent("TimeEvents"); + evt.initTimeEvent("endEvent", ttd.defaultView, 0); + this.dispatchEvent(evt); + this._finish && this._finish.shift(); + this._currentFrame = 0; + }; + /*void*/ t.beginElementAt = function(/*float*/ offset) { + var ntc = this.ownerDocument.documentElement.getCurrentTime(), + start = this._start || []; + for (var i=0,sli=start.length;i -1) { - s = val.slice(n[0]); - t = parseFloat(s); - } else if (n[1] > -1) { - s = val.slice(n[1]); - t = parseFloat(s); - } else { - s = val; - t = parseFloat(val); - } - if (isFinite(t)) { - if (/\d+\:(\d\d)\:([\d\.]+)$/.test(s)) { //Full-Clock-Valueの場合 - t = (t*3600 + parseInt(RegExp.$1, 10)*60 + parseFloat(RegExp.$2)) * 1000; - } else if (/\d\d\:([\d\.]+)$/.test(s)) { - t = (t*60 + parseFloat(RegExp.$1)) * 1000; - } else if (/(h|min|s)$/.test(s)) { - t *= this._unit[RegExp.$1]; + fin.push(offset + ntc); + fin.sort(function(a, b) { + return a - b; + }); + this._finish = fin; + ntc = start = offset = void 0; + }; + t._eventRegExp = /(mouse|activ|clic|begi|en)[a-z]+/; + t._timeRegExp = /[\-\d\.]+(h|min|s|ms)?$/; + t._unit = { + "h" : 3600000, + "min" : 60000, + "s" : 1000 + }; + /*_getOffsetメソッド + * どれだけズレの時間があるかを計測するメソッド + *tに数値が使われていないときは0を返す + *これはSMILアニメーションモジュールの以下の記述にあるように、値のデフォルトが0であることに起因する + *http://www.w3.org/TR/2001/REC-smil20-20010807/smil-timing.html#Timing-Ex:0DurDiscreteMedia + *http://www.w3.org/TR/2001/REC-smil20-20010807/smil-timing.html#Timing-DurValueSemantics + ** Note that when the simple duration is "indefinite", some simple use cases can yield surprising results. See the related example #4 in Appendix B. + */ + t._getOffset = function(/*string*/ val) { + var t = null, //tは最初の数値 + n = [val.indexOf("+"), val.indexOf("-")], + s; + if (n[0] > -1) { + s = val.slice(n[0]); + t = parseFloat(s); + } else if (n[1] > -1) { + s = val.slice(n[1]); + t = parseFloat(s); + } else { + s = val; + t = parseFloat(val); } if (isFinite(t)) { - t *= 0.8; - return t; + if (/\d+\:(\d\d)\:([\d\.]+)$/.test(s)) { //Full-Clock-Valueの場合 + t = (t*3600 + parseInt(RegExp.$1, 10)*60 + parseFloat(RegExp.$2)) * 1000; + } else if (/\d\d\:([\d\.]+)$/.test(s)) { + t = (t*60 + parseFloat(RegExp.$1)) * 1000; + } else if (/(h|min|s)$/.test(s)) { + t *= this._unit[RegExp.$1]; + } + if (isFinite(t)) { + t *= 0.8; + return t; + } } - } - return 0; -}; - -/*float*/ t.getStartTime = function(){ - if (this._starting || (this._starting === 0)) { - return (this._starting); - } else { - throw new DOMException(/*DOMException.INVALID_STATE_ERR*/ 11); - } -}; -/*getCurrentTimeメソッド - *現在の時間コンテナ内での時刻であり、 - *決して現在時刻ではない。要素のbeginイベントの発火したときが0sである。 - */ -/*float*/ t.getCurrentTime = function(){ - return (this._currentFrame * 125 * 0.8); -}; -/*float*/ t.getSimpleDuration = function(){ - if (!this._dur && !this._finish && (this._dur === "indefinite")) { - throw new DOMException(/*DOMException.NOT_SUPPORTED_ERR*/ 9); - } else { - return (this._getOffset(this._dur)); - } + return 0; + }; + + /*float*/ t.getStartTime = function(){ + if (this._starting || (this._starting === 0)) { + return (this._starting); + } else { + throw new DOMException(/*DOMException.INVALID_STATE_ERR*/ 11); + } + }; + /*getCurrentTimeメソッド + *現在の時間コンテナ内での時刻であり、 + *決して現在時刻ではない。要素のbeginイベントの発火したときが0sである。 + */ + /*float*/ t.getCurrentTime = function(){ + return (this._currentFrame * 125 * 0.8); + }; + /*float*/ t.getSimpleDuration = function(){ + if (!this._dur && !this._finish && (this._dur === "indefinite")) { + throw new DOMException(/*DOMException.NOT_SUPPORTED_ERR*/ 9); + } else { + return (this._getOffset(this._dur)); + } + }; + }); }; -})(SVGAnimationElement.prototype); //raises( DOMException ); NAIBU.Time = { currentFrame : 0, -- 2.11.0