diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/MTools/Anim/MPath.pm | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/MTools/Anim/MPath.pm b/src/MTools/Anim/MPath.pm index 27ee976..ba62de2 100644 --- a/src/MTools/Anim/MPath.pm +++ b/src/MTools/Anim/MPath.pm @@ -35,7 +35,6 @@ package MTools::Anim::MPath; use strict; use MTools; -use MTools::MObjet; use Anim; use Anim::Pacing::Linear; @@ -145,18 +144,20 @@ sub __getPoint { my $y = $points [$#points] -> [1]; my $vx = 0; my $vy = 0; - for (my $i = 0; $i < @points - 1; $i ++) - { - $vx = $x = $points [$i + 1] -> [0] - $points [$i] -> [0]; - $vy = $y = $points [$i + 1] -> [1] - $points [$i] -> [1]; - my $d = sqrt ($x * $x + $y * $y); - $length -= $d; - if ($length <= 0) + if ($percentage != 100) { + for (my $i = 0; $i < @points - 1; $i ++) { - $d = ($d + $length) / $d; - $x = $d * $vx + $points [$i] -> [0]; - $y = $d * $vy + $points [$i] -> [1]; - $i = @points; + $vx = $x = $points [$i + 1] -> [0] - $points [$i] -> [0]; + $vy = $y = $points [$i + 1] -> [1] - $points [$i] -> [1]; + my $d = sqrt ($x * $x + $y * $y); + $length -= $d; + if ($length <= 0) + { + $d = ($d + $length) / $d; + $x = $d * $vx + $points [$i] -> [0]; + $y = $d * $vy + $points [$i] -> [1]; + $i = @points; + } } } return ($x, $y, $vx, $vy); |