svnno****@sourc*****
svnno****@sourc*****
2011年 6月 17日 (金) 22:48:21 JST
Revision: 2774 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2774 Author: dhrname Date: 2011-06-17 22:48:21 +0900 (Fri, 17 Jun 2011) Log Message: ----------- 1, SVGAnimteMotionElementnの修正 2, SVGAnimteColorElementにおけるvar文の整理 Modified Paths: -------------- branches/08x/080/org/w3c/dom/svg.js Modified: branches/08x/080/org/w3c/dom/svg.js =================================================================== --- branches/08x/080/org/w3c/dom/svg.js 2011-06-17 13:47:18 UTC (rev 2773) +++ branches/08x/080/org/w3c/dom/svg.js 2011-06-17 13:48:21 UTC (rev 2774) @@ -5466,12 +5466,31 @@ trans.animVal.appendItem(tar.ownerDocument.documentElement.createSVGTransform()); tar._frame = function() { var _tar = tar, - tpn = _tar._path, - tgsd = _tar.getSimpleDuration(); + tpn = _tar._path, + tgsd = _tar.getSimpleDuration(), + d = tgsd * 0.8, + n = _tar._valueList.length - 1, + tg = _tar.getCurrentTime(), + ii, di, ti; if (tgsd === 0) { tgsd = null; return; } + if ((n !== -1) && (d !== 0) && (tg <= d)) { + ii = Math.floor((tg*n) / d); + if (ii === n) { //iiが境い目のときは、n-2を適用 + ii -= 1; + } + } else { + return; + } + if (tar._keyTimes) { + di = (tar._keyTimes[ii+1] - tar._keyTimes[ii]) * d; + ti = tar._keyTimes[ii]; + } else { + di = d / n; //keyTimesがなければ均等に時間を配分しておく + ti = ii / n; + } if (tpn) { //path属性が指定されていた場合、tpnは属性値となる var st = (tpn.getTotalLength() / tgsd) * _tar.getCurrentTime() / 125 * 0.8, p = tpn.getPointAtLength(st), @@ -5489,7 +5508,7 @@ var total = 0; for (var i=1, tav=tar._valueList, tvli=tav.length;i<tvli;i+=2) { total += Math.sqrt(Math.pow(tav[i][1] - tav[i][0], 2) + Math.pow(tav[i-1][1] - tav[i-1][0], 2)); - } + } var st = (total / tgsd) * _tar.getCurrentTime() / 125 * 0.8, p = tar.ownerDocument.documentElement.createSVGPoint(), trans = _tar.targetElement.transform; @@ -5580,9 +5599,10 @@ */ var d = _tar.getSimpleDuration() * 0.8, n = _tar._valueList.length - 1, - tg = _tar.getCurrentTime(); + tg = _tar.getCurrentTime(), + ii, di, ti; if ((n !== -1) && (d !== 0) && (tg <= d)) { - var ii = Math.floor((tg*n) / d); + ii = Math.floor((tg*n) / d); if (ii === n) { //iiが境い目のときは、n-2を適用 ii -= 1; } @@ -5590,11 +5610,11 @@ return; } if (tar._keyTimes) { - var di = (tar._keyTimes[ii+1] - tar._keyTimes[ii]) * d; - var ti = tar._keyTimes[ii]; + di = (tar._keyTimes[ii+1] - tar._keyTimes[ii]) * d; + ti = tar._keyTimes[ii]; } else { - var di = d / n; //keyTimesがなければ均等に時間を配分しておく - var ti = ii / n; + di = d / n; //keyTimesがなければ均等に時間を配分しておく + ti = ii / n; } var fc = _tar._valueList[ii].rgbColor, tc = _tar._valueList[ii+1].rgbColor, durd = (tg-ti*d) / di, num = CSSPrimitiveValue.CSS_NUMBER; var fr = fc.red.getFloatValue(num), fg = fc.green.getFloatValue(num), fb = fc.blue.getFloatValue(num);