diff options
Diffstat (limited to 'src/MTools/Anim')
-rw-r--r-- | src/MTools/Anim/MPath.pm | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/src/MTools/Anim/MPath.pm b/src/MTools/Anim/MPath.pm index eb8b221..6d73cff 100644 --- a/src/MTools/Anim/MPath.pm +++ b/src/MTools/Anim/MPath.pm @@ -98,34 +98,35 @@ sub pathchanged { } sub start { - my ($self) = @_; - - my @points = @{$self -> mget ('path')}; - if (!@points) {return;} - $self -> {__x} = $points [0] -> [0]; - $self -> {__y} = $points [0] -> [1]; - my $pacing = new Anim::Pacing::Linear (-duration => $self -> mget ('duration')); - $self -> {__percentage} = 0; - my $animationpath = new Anim::Path::Rectilinear ( - -xdep => 0, - -ydep => 0, - -xdest => 100, - -ydest => 0, - ); - $self -> {__animation} = my $animation = new Anim ( - -pacing => $pacing, - -resources => [ - $animationpath, - -command => sub { $self -> __event (@_)}, - -endcommand => sub {$self -> notify ('ANIMATION_END'); $self -> {__animation} = undef;}, - ], - -stopcommand => sub { - $self -> notify ('ANIMATION_ABORD', $self -> __getPoint ($self -> {__percentage})); - $self -> {__animation} = undef; - }, - -loop => $self -> mget ('loop'), - ); - $animation -> start (); + my ($self) = @_; + + my @points = @{$self -> mget ('path')}; + if (!@points) {return;} + $self -> {__x} = $points [0] -> [0]; + $self -> {__y} = $points [0] -> [1]; + my $pacing = new Anim::Pacing::Linear (-duration => $self -> mget ('duration')); + $self -> {__percentage} = 0; + my $animationpath = new Anim::Path::Rectilinear ( + -xdep => 0, + -ydep => 0, + -xdest => 100, + -ydest => 0, + ); + $self -> {__animation} = my $animation = new Anim ( + -pacing => $pacing, + -resources => [ + $animationpath, + -command => sub { $self -> __event (@_)}, + -endcommand => sub {$self -> notify ('ANIMATION_END'); + $self -> {__animation} = undef;}, + ], + -stopcommand => sub { + $self -> notify ('ANIMATION_ABORD', $self -> __getPoint ($self -> {__percentage})); + $self -> {__animation} = undef; + }, + -loop => $self -> mget ('loop'), + ); + $animation -> start (); } sub stop { |