From 9385d7b45306983c1edc73698aff613a90602fca Mon Sep 17 00:00:00 2001 From: dhrname Date: Tue, 16 May 2017 22:46:56 +0900 Subject: [PATCH] Modify the getRotate method on the object --- org/w3c/dom/smil.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/org/w3c/dom/smil.js b/org/w3c/dom/smil.js index 0dd5e0c..a20b48b 100644 --- a/org/w3c/dom/smil.js +++ b/org/w3c/dom/smil.js @@ -1000,6 +1000,7 @@ base("$calcMode").up("$attribute").mix( { return (s || def); }, + /*アニメーション関連要素を収納*/ _ele: document.documentElement, /*指定された要素にvalues属性が付いているかどうかのチェックできるメソッド*/ @@ -2052,7 +2053,15 @@ base("$calcMode").up("$attribute").mix( { y = point.y; /*一歩進んだ点*/ point = path.getPointAtLength(advanceLength+1); - return ") rotate(" +(Math.atan2(point.y-y, point.x-x)/pi*180 + rotate)+ ""; + var rad = Math.atan2(point.y-y, point.x-x); + if (rad === 0) { + /*アニメーションの終了間際では、radが0となるため、 + * 代わりに、ベジェ曲線のハンドルの傾きから角度を求める*/ + rad = Math.atan2(seg.y-seg.y2, seg.x-seg.x2); + } + return ") rotate(" +(rad/pi*180 + rotate)+ ""; + } else { + return ""; } }, -- 2.11.0