aboutsummaryrefslogtreecommitdiff
path: root/src/MTools/Anim/MScalor.pm
diff options
context:
space:
mode:
Diffstat (limited to 'src/MTools/Anim/MScalor.pm')
-rw-r--r--src/MTools/Anim/MScalor.pm44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/MTools/Anim/MScalor.pm b/src/MTools/Anim/MScalor.pm
index 8cac21e..4845c54 100644
--- a/src/MTools/Anim/MScalor.pm
+++ b/src/MTools/Anim/MScalor.pm
@@ -39,9 +39,8 @@ use strict;
use MTools;
use MTools::MObjet;
-use Anim;
-use Anim::Pacing::Linear;
-use Anim::Path::Rectilinear;
+use Tk::Anim;
+Tk::Anim::synchronous(25.0);
use vars qw /@ISA/;
@@ -88,31 +87,32 @@ sub new {
sub start {
my ($self) = @_;
- my $pacing = new Anim::Pacing::Linear (-duration => $self -> mget ('duration'));
$self -> {__xdep} = my $xdep = $self -> mget ('from_x');
$self -> {__ydep} = my $ydep = $self -> mget ('from_y');
- my $animationpath = new Anim::Path::Rectilinear (
- -xdep => 0,
- -ydep => 0,
- -xdest => $self -> mget ('to_x') - $xdep,
- -ydest => $self -> mget ('to_y') - $ydep,
- );
$self -> {__x} = $xdep;
$self -> {__y} = $ydep;
- $self -> {__animation} = my $animation = new Anim (
- -pacing => $pacing,
- -resources => [
- $animationpath,
- -command => sub { $self -> __event (@_)},
- -endcommand => sub {$self -> {__animation} = undef;
- $self -> notify ('ANIMATION_END');},
- ],
- -stopcommand => sub {$self -> {__animation} = undef;
- $self -> notify ('ANIMATION_ABORD', $self -> {__x}, $self -> {__y});},
- -loop => $self -> mget ('loop'),
+ $self -> {__animation} = my $animation = $zinc->Anim (
+ -pacing => 'linear',
+ -duration => $self -> mget ('duration') * 1000,
+ -command => sub { $self -> __event (@{$_[0]})},
);
- $animation -> start ();
+ $animation->addresource('coords',
+ -path => [[0, 0], [$self -> mget ('to_x') - $xdep,
+ $self -> mget ('to_y') - $ydep]]);
+ my $loop = $self -> mget ('loop');
+ if ($loop != 0) {
+ $self -> {__animation} = $animation -> repeat ();
+ }
+ $self -> {__animation} -> whenterminated (sub {
+ $self -> {__animation} = undef;
+ $self -> notify ('ANIMATION_END');
+ });
+ $self -> {__animation} -> wheninterrupted (sub {
+ $self -> {__animation} = undef;
+ $self -> notify ('ANIMATION_ABORD', $self -> {__x}, $self -> {__y});
+ });
+ $self -> {__animation} -> start ();
}
sub stop {