diff options
author | ribet | 2007-11-06 16:01:14 +0000 |
---|---|---|
committer | ribet | 2007-11-06 16:01:14 +0000 |
commit | b4060168a19582b2025bb219ac162587945924be (patch) | |
tree | 5271ddac16fac5c0c81889a38d96772d9e00195e | |
parent | 79c889d96474898034052d005e54798e5b6d5825 (diff) | |
download | mtc-b4060168a19582b2025bb219ac162587945924be.zip mtc-b4060168a19582b2025bb219ac162587945924be.tar.gz mtc-b4060168a19582b2025bb219ac162587945924be.tar.bz2 mtc-b4060168a19582b2025bb219ac162587945924be.tar.xz |
Animations en utilisant un seul timer, toutes les animations sont alors synchrones. Les animations sont améliorées.
Attention : il faut installer le dernier paquet tkanim.
Il reste à faire MPath
-rw-r--r-- | debian/control | 2 | ||||
-rw-r--r-- | src/MTools/Anim/MOpacity.pm | 43 | ||||
-rw-r--r-- | src/MTools/Anim/MScalor.pm | 44 | ||||
-rw-r--r-- | src/MTools/Anim/MTranslator.pm | 49 |
4 files changed, 67 insertions, 71 deletions
diff --git a/debian/control b/debian/control index 8279838..1950eb9 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ Section: tools Package: mtools-perl Section: x11 Architecture: any -Depends: ${misc:Depends}, zinc-perl, ivy-perl, librecogest-perl, perl-anim, libxml-parser-perl, perl-modules +Depends: ${misc:Depends}, zinc-perl, ivy-perl, librecogest-perl, perl-anim, libxml-parser-perl, perl-modules, tkanim (>=1.9a) Description: Library over zinc-perl for HMI design MTools library is designed to make zinc easier. MTools code can be mixed easily with zinc-perl code. diff --git a/src/MTools/Anim/MOpacity.pm b/src/MTools/Anim/MOpacity.pm index 19c2108..00b4450 100644 --- a/src/MTools/Anim/MOpacity.pm +++ b/src/MTools/Anim/MOpacity.pm @@ -38,9 +38,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/; @@ -83,29 +82,29 @@ sub new { sub start { my ($self) = @_; - my $pacing = new Anim::Pacing::Linear (-duration => $self -> mget ('duration')); $self -> {__opacitydep} = my $opacitydep = $self -> mget ('from_opacity'); - my $animationpath = new Anim::Path::Rectilinear ( - -xdep => 0, - -ydep => 0, - -xdest => $self -> mget ('to_opacity') - $opacitydep, - -ydest => 0, - ); $self -> {__opacity} = $opacitydep; - $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 -> {__opacity});}, - -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('number', + -path => [0, $self -> mget ('to_opacity') - $opacitydep]); + 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 -> {__opacity}); + }); + $self -> {__animation} -> start (); } sub stop { 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 { diff --git a/src/MTools/Anim/MTranslator.pm b/src/MTools/Anim/MTranslator.pm index 8c8baa2..3211eb9 100644 --- a/src/MTools/Anim/MTranslator.pm +++ b/src/MTools/Anim/MTranslator.pm @@ -38,9 +38,8 @@ package MTools::Anim::MTranslator; use strict; use MTools; -use Anim; -use Anim::Pacing::Linear; -use Anim::Path::Rectilinear; +use Tk::Anim; +Tk::Anim::synchronous(25.0); use vars qw /@ISA/; @@ -95,35 +94,33 @@ sub stop { 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 isRunning { |