diff options
author | saal | 2007-06-06 15:19:30 +0000 |
---|---|---|
committer | saal | 2007-06-06 15:19:30 +0000 |
commit | d9b2e4c566a3dea8e44ab8ab07cda8b2bb313d57 (patch) | |
tree | de93466c407f2df13d2a7346b92f8f7ab3a5dcd5 /src/MTools | |
parent | 1a819c73ebbe6ff3309344e05648ec114ab974f0 (diff) | |
download | mtc-d9b2e4c566a3dea8e44ab8ab07cda8b2bb313d57.zip mtc-d9b2e4c566a3dea8e44ab8ab07cda8b2bb313d57.tar.gz mtc-d9b2e4c566a3dea8e44ab8ab07cda8b2bb313d57.tar.bz2 mtc-d9b2e4c566a3dea8e44ab8ab07cda8b2bb313d57.tar.xz |
correction du saut?
si l'animation est à 100% on renvoie la dernière position du path
Diffstat (limited to 'src/MTools')
-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); |