From e3603142b13cb814e8a7a6fd4746b9ca1586c57e Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Tue, 23 Sep 2008 08:50:20 +1200 Subject: [PATCH] Work in progress on making the pictures fade between themselves. --- lib/Display/Plugins/FSpot.pm | 37 +++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/lib/Display/Plugins/FSpot.pm b/lib/Display/Plugins/FSpot.pm index 50b5cb9..2c7b208 100644 --- a/lib/Display/Plugins/FSpot.pm +++ b/lib/Display/Plugins/FSpot.pm @@ -6,6 +6,7 @@ use POE; use POE::Component::EasyDBI; my $default_f_spot_db = "$ENV{HOME}/.gnome2/f-spot/photos.db"; +my $delay = 10; sub new { my $proto = shift; @@ -31,31 +32,37 @@ sub display_photo { return; } + #warn "Loading $file\n"; + $self->{'new'}->set_opacity(0); $self->{'new'}->set_from_file($file); + #$self->{'stage'}->add($self->{'new'}); if ($self->{'last_file'} eq '') { - fade_in($self->{'new'}); -# } else { -#warn "Fade out old\n"; -# my $old_effect = Clutter::EffectTemplate->new_for_duration(1000, 'main::smoothstep_dec' ); -# my $old = Clutter::Effect->fade($old_effect, $self->{'old'}, 0, $self->can('fade_in'), $self->{'new'}); -# $old->start(); + fade_in(undef, $self); + } else { +warn "Fade out old\n"; + my $old_effect = Clutter::EffectTemplate->new_for_duration(2000, 'main::smoothstep_dec' ); + my $old = Clutter::Effect->fade($old_effect, $self->{'new'}, 0, $self->can('fade_in'), $self); + $old->start(); + + sleep 10; } -# my $temp = $self->{'old'}; -# $self->{'old'} = $self->{'new'}; -# $self->{'new'} = $temp; $self->{'last_file'} = $file; - - $self->{'kernel'}->delay(fspot_display, 30); + $self->{'kernel'}->delay(fspot_display, $delay); } sub fade_in { - my $new_pic = shift; + my ($actor, $self) = @_; - my $new_effect = Clutter::EffectTemplate->new_for_duration(1000, 'main::smoothstep_inc'); - my $new = Clutter::Effect->fade($new_effect, $new_pic, 255); +warn "Fade in new\n"; + my $new_effect = Clutter::EffectTemplate->new_for_duration(2000, 'main::smoothstep_inc'); + my $new = Clutter::Effect->fade($new_effect, $self->{'new'}, 255); $new->start(); + + my $temp = $self->{'old'}; + $self->{'old'} = $self->{'new'}; + $self->{'new'} = $temp; } sub display { @@ -99,7 +106,7 @@ LIMIT 1 $self->{'stage'}->add($self->{$age}); } - $self->display(); + $self->{'kernel'}->yield('fspot_display'); } 1; -- 2.30.2