Work in progress on making the pictures fade between themselves.
authorAndrew Ruthven <andrew@etc.gen.nz>
Mon, 22 Sep 2008 20:50:20 +0000 (08:50 +1200)
committerAndrew Ruthven <andrew@cerberus.etc.gen.nz>
Mon, 22 Sep 2008 20:50:20 +0000 (08:50 +1200)
lib/Display/Plugins/FSpot.pm

index 50b5cb9..2c7b208 100644 (file)
@@ -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;