throw new DOMException(DOMException.INVALID_STATE_ERR);
}
tar.endElementAt(active);
- tar.beginElementAt(tar.getSimpleDuration());
- if (tar.getCurrentTime() !== 0) {
- var ttd = tar.ownerDocument, evt = ttd.createEvent("TimeEvents");
- tar._currentCount++;
- evt.initTimeEvent("repeatEvent", ttd.defaultView, tar._numRepeat);
- tar.dispatchEvent(evt);
- }
}, false);
this.addEventListener("DOMAttrModified", function(evt){
if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
*/
return this;
}
+ /*begin属性とend属性を処理する*/
+ var _begin = tar._begin ? tar._getOffset(tar._begin) : 0,
+ that = tar,
+ timing = function(val, name, offset) {
+ /*timing関数は時間のタイミングをidとeventと、clock-value(offset)に分割して処理していく
+ *まず、idを検出するためのsearcIdローカル関数を作る
+ */
+ var searchId = function () {
+ var n = val.indexOf(".");
+ if ((n > 0) && (/[a-z]/i).test(val.charAt(n+1))) { //. (dot)の後がアルファベットならば
+ return (val.slice(0, n));
+ }
+ n = nn = void 0;
+ return "";
+ },
+ id;
+ /*
+ *W3CのSMIl AnimationのTimingモデルは7パターンがあるので、場合分けする
+ */
+ if (isFinite(parseFloat(val))) { //1) offset-valueの場合
+ that[name](offset);
+ } else if (val.indexOf("repeat(") > -1) { //2) repeat-valueの場合
+ var inte = parseFloat(val.slice(7)),
+ ds = function (evt) {
+ if (inte === evt.target._numRepeat) {
+ that[name](offset);
+ }
+ };
+ id = searchId();
+ if (id) {
+ that.ownerDocument.getElementById(id).addEventListener("repeatEvent", ds);
+ } else {
+ that.addEventListener("repeatEvent", ds);
+ }
+ } else if ((/\.(begin|end)/).test(val)) { //3) syncbase-valueの場合
+ id = searchId();
+ if (id) {
+ var ds = function (evt) {
+ that[name](offset);
+ },
+ ev = "";
+ if (RegExp.$1 === "begin") {
+ ev = "beginEvent";
+ } else if (RegExp.$1 === "end") {
+ ev = "endEvent";
+ }
+ that.ownerDocument.getElementById(id).addEventListener(ev, ds);
+ }
+ } else if (val.indexOf("wallclock(") === 0) { //4) wallclock-valueの場合
+
+ } else if (val === "indefinte") { //5) indefinteの場合
+ } else if (val.indexOf("accesskey(") > -1) { //6) accesskey-valueの場合
+
+ } else { //7) event-valueの場合
+ id = searchId();
+ var ds = function (evt) {
+ that[name](offset);
+ };
+ if (id && val.match(/\.([a-z]+)/i)) {
+ that.ownerDocument.getElementById(id).addEventListener(RegExp.$1, ds);
+ } else if (val){
+ that.targetElement.addEventListener(val.match(/^[a-z]+/i)[0], ds)
+ }
+ }
+ val = searchId = id = void 0;
+ };
+ timing((tar._begin || "0ms"), "beginElementAt", _begin);
+ if (tar._end) {
+ timing(tar._end, "endElementAt", tar._getOffset(tar._end));
+ }
+ that = void 0;
if (tar.hasAttributeNS("http://www.w3.org/1999/xlink", "xlink:href")) {
tar.targetElement = tar.ownerDocument.getElementById(tar.getAttributeNS("http://www.w3.org/1999/xlink", "xlink:href").substring(1))
} else {
}, false);
evt = tar = void 0;
}, false);
- this.addEventListener("repeatEvent", function(evt) {
- var tar = evt.target;
- ++tar._numRepeat;
- if ((tar._currentCount >= tar._maxCount) || (tar.getCurrentTime() >= (tar._maxDur+tar.getStartTime()))) {
- tar._isRepeat = false;
- }
- }, false);
return this;
};
SVGAnimationElement.constructor = SVGElement;
if (this._start || (this._start === 0)) {
return (this._start);
} else {
- var _begin = this._begin ? this._getOffset(this._begin) : 0,
- that = this,
- timing = function(val, name, offset) {
- /*timing関数は時間のタイミングをidとeventと、clock-value(offset)に分割して処理していく
- *まず、idを検出するためのsearcIdローカル関数を作る
- */
- var searchId = function () {
- var n = val.indexOf(".");
- if ((n > 0) && (/[a-z]/i).test(val.charAt(n+1))) { //. (dot)の後がアルファベットならば
- return (val.slice(0, n));
- }
- n = nn = void 0;
- return "";
- },
- id;
- /*
- *W3CのSMIl AnimationのTimingモデルは7パターンがあるので、場合分けする
- */
- if (isFinite(parseFloat(val))) { //1) offset-valueの場合
- that[name](offset);
- } else if (val.indexOf("repeat(") > -1) { //2) repeat-valueの場合
- var inte = parseFloat(val.slice(7)),
- ds = function (evt) {
- if (inte === evt.target._numRepeat) {
- that[name](offset);
- }
- };
- id = searchId();
- if (id) {
- that.ownerDocument.getElementById(id).addEventListener("repeatEvent", ds);
- } else {
- that.addEventListener("repeatEvent", ds);
- }
- } else if ((/\.(begin|end)/).test(val)) { //3) syncbase-valueの場合
- id = searchId();
- if (id) {
- var ds = function (evt) {
- that[name](offset);
- },
- ev = "";
- if (RegExp.$1 === "begin") {
- ev = "beginEvent";
- } else if (RegExp.$1 === "end") {
- ev = "endEvent";
- }
- that.ownerDocument.getElementById(id).addEventListener(ev, ds);
- }
- } else if (val.indexOf("wallclock(") === 0) { //4) wallclock-valueの場合
-
- } else if (val === "indefinte") { //5) indefinteの場合
- } else if (val.indexOf("accesskey(") > -1) { //6) accesskey-valueの場合
-
- } else { //7) event-valueの場合
- id = searchId();
- var ds = function (evt) {
- that[name](offset);
- };
- if (id && val.match(/\.([a-z]+)/i)) {
- that.ownerDocument.getElementById(id).addEventListener(RegExp.$1, ds);
- } else if (val){
- that.targetElement.addEventListener(val.match(/^[a-z]+/i)[0], ds)
- }
- }
- val = searchId = id = void 0;
- };
- timing((this._begin || "0ms"), "beginElementAt", _begin);
- if (this._end) {
- timing(this._end, "endElementAt", this._getOffset(this._end));
- }
- that = void 0;
- //throw new DOMException(DOMException.INVALID_STATE_ERR);
+ throw new DOMException(DOMException.INVALID_STATE_ERR);
}
};
/*getCurrentTimeメソッド
}
NAIBU.stop = setInterval( (function() {
/* try{*/
- var ntc = NAIBU.Time.currentFrame++;
- var nc = NAIBU.Clip;
- var s = ntc * 100; //フレーム数ntcをミリ秒数sに変換
+ var ntc = NAIBU.Time.currentFrame,
+ nc = NAIBU.Clip,
+ s = ntc * 100; //フレーム数ntcをミリ秒数sに変換 (100 = 125 * 0.8)
if (ntc > NAIBU.Time.Max) {
clearInterval(NAIBU.stop);
}
+ nc[0] && nc[0].ownerDocument.documentElement.setCurrentTime(s);
for (var i=0,ncli=nc.length;i<ncli;++i) {
- var nci = nc[i];
- nci.ownerDocument.documentElement.setCurrentTime(s);
- if ("_start" in nci) {
- if (nci.getStartTime() <= s) {
- if (nci.getCurrentTime() === 0) {
- nci.beginElement();
- }
- nci._currentFrame++;
- }
- if (nci._finish && (nci._finish <= s) && (nci.getCurrentTime() !== 0)) {
- nci.endElement();
- nci._frame && nci._frame();
- nci._currentFrame = 0;
- delete nci._start;
- nci._finish = null;
- } else if (!!nci._frame) {
- nci._frame();
- }
+ var nci = nc[i]
+ s2 = s + 100,
+ s1 = s - 100;
+ if ((nci._start || (nci._start === 0)) && (nci.getCurrentTime() === 0) && (s1 <= nci._start && nci._start < s2)) {
+ nci.beginElement();
+ }
+ if (nci._isRepeat && (nci.getCurrentTime() !== 0) && ((nci.getSimpleDuration() % s) === 0)) {
+ var ttd = nci.ownerDocument,
+ evt = ttd.createEvent("TimeEvents");
+ ++nci._numRepeat;
+ evt.initTimeEvent("repeatEvent", ttd.defaultView, nci._numRepeat);
+ nci.dispatchEvent(evt);
+ ttd = evt = void 0;
+ }
+ if ((nci._finish || (nci._finish === 0)) && (s1 <= nci._finish && nci._finish < s2) && (nci.getCurrentTime() !== 0)) {
+ nci.endElement();
+ nci._frame && nci._frame();
+ nci._currentFrame = 0;
+ }
+ if (nci._frame) {
+ nci._currentFrame++;
+ nci._frame();
}
- nci = void 0;
}
+ ++NAIBU.Time.currentFrame;
+ nci = s1 = s2 = void 0;
/* } catch (e) {
stlog.add(e, 4157);
}*/