Acme-Curses-Marquee-Extensions

 view release on metacpan or  search on metacpan

TODO  view on Meta::CPAN

fix-up window when font cycling:
       resize && mvwin w/ pre-calc'd vals
       alternate through a set of dup'd wins

Multiple style "delays"?
	cond > 0 ? every(seconds=>cond) : offset = 0

selectively recompile subroutines?
modify $RE{balanced}{-begin=>'sub\s+$NAME.*?{'}{-end=>'}'}

Text::FIGlet features
	Unicode/control files

	smush mode?

vscroll

lib/Acme/Curses/Marquee/Extensions.pm  view on Meta::CPAN

    $self->{txtlen} = delete($self->{_sweep});
  }
}

{
  my $i = 0;
  sub scroll{
    my $self = shift;
    #XXX offset would work if we could account for one wrap-around...
#   if( defined($self->{_fonts}) && ($self->{offset} == $self->{txtlen}) ){
    if( defined($self->{_fonts}) && every seconds=>$self->{_fontSec}||45 ){
      #XXX reposition vertically iff auto-centered
      $self->font( $self->{_fonts}->[ ++$i %scalar(@{ $self->{_fonts} }) ]);
    }
    $self->SUPER::scroll;
  }
}

{
  my $i = 0;
  my $rainbow = [qw/red yellow/,'bold yellow',qw/green cyan blue magenta/];
  sub colors{
    my($self, %p) = @_;
    my @colors = @{$p{colors}||$rainbow};
    if( every seconds=>$p{delay}||5 ){
      print color $colors[$i++%scalar @colors];
    }
  }
}

#XXX
sub blink{
  print color 'blink';
}

lib/Acme/Curses/Marquee/Extensions.pm  view on Meta::CPAN


Location of the origin's ordinate. Defaults to (winh - fontHeight)/2
i.e; vertically centered.

=item font

Figfont to use, defaults to standard.

This also accepts an arrayref, which can be a list of fonts to rotate through.
If cycling fonts, the last element of the arrayref may be a number indicating
the number of seconds between transitions. Otherwise, this occurs every 45 sec.

For the time being, you probably want to use fonts of the similar heights,
and list the tallest first.

=item text

The text to render.

=back

=head2 colors(delay=>I<seconds>, colors=>I<[colors]>)

=over

=item delay

The number of seconds between color changes. Defaults to 5.

=item colors

An arrayref of colors to cycle through. Defaults to a rainbow i.e;
'red', 'yellow', 'bold yellow', 'green', 'cyan', 'blue', 'magenta'
See L<Term::ANSIColor> for legal values.

=back

=head2 sweep( I<toggle> )

lib/Acme/Curses/Marquee/Extensions.pm  view on Meta::CPAN

Set once, and left enabled, sweeping will result in a sort of "Knight Rider"
effect. A toggle of I<-1> will use this effect only once, as a fade-in.

Note that you can change your sweep state at any time, though the interval
should exceed the time it takes for the message to scroll e.g;

  use Every;
  ...
  $m->sweep(1);
  while( 1 ){
    do{exists$m->{_sweep}?$m->sweep(0):$m->sweep(1)} if every seconds=>60;
    ...
  }

=head1 ENVIRONMENT

See L<Text::FIGlet>.

=head1 FILES

See L<Text::FIGlet>.



( run in 1.363 second using v1.01-cache-2.11-cpan-39bf76dae61 )