Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Matrix falling text effect

by ayrnieu (Beadle)
on Mar 11, 2006 at 21:37 UTC ( #535997=note: print w/replies, xml ) Need Help??


in reply to Matrix falling text effect

I rewrote your program before noting the "Bits I'm after" at the bottom -- I thought you wanted style suggestions. HTH, anyway.

#! /usr/bin/env perl use diagnostics; use strict; use Tk; use Time::HiRes; my $BG_COLOUR = $ENV{MY_BG_COLOUR} || "black"; my $FONT = $ENV{MY_FONT} || "-*-Matrix Code NFI-*-*-*--*-200-*"; # http://www.1001fonts.com/font_details.html?font_id=2555 my $GIF = $ENV{MY_GIF} || "C:\\Perl\\tk\\prog2\\matx.gif"; my %MATRIX = (hip => ",\n", space => "\n"x14, onegap => " \n"); $MATRIX{$_} = "$_\n" for qw/a b c d e f g H i j k l n o r s w y/; my $ITERATIONS = $ENV{MY_ITERATIONS} || 0; my $main = MainWindow->new(-title => "Matrix...", -bg => $BG_COLOUR); $main->minsize(qw(422 200)); $main->maxsize(qw(422 200)); $main->idletasks; # necessary ! $main->iconimage($main->Photo(-file => $GIF)); $main->Frame(-bg => $BG_COLOUR)->pack(-side => 'left', -fill => 'y'); # -------------------------------------------------------------------- +-- package MatrixBoxes; sub new { my @m; for (1..3) { push @m, $main->Text(-width => "2", -background => $BG_COLOUR, -font => $FONT, -foreground => "lightgreen", -wrap => "none", -relief => 'flat')->pack(-side => 'right', -fill => 'y'); } bless \@m; } sub Contents { my $m = shift; for (@$m) { $_->Contents(@{+shift}) } } sub configure { my $m = shift; for (@$m) { $_->configure(@_) } } sub yscroll { my $m = shift; for (@$m) { $_->yviewScroll(shift, 'units +') } } # -------------------------------------------------------------------- +-- package main; my $m = MatrixBoxes->new; sub five{ my @let1 = @MATRIX{qw/d l r o w onegap o l l e H space/}; my @let2 = @MATRIX{qw/n i a g a onegap o l l e H space/}; my @let3 = @MATRIX{qw/onegap onegap onegap y o b onegap d a b onegap + onegap onegap onegap onegap space/}; $m->Contents(\@let1, \@let2, \@let3); $m->configure(-state => 'disabled'); $m->yscroll(37, 67, 27); for (1..27) { $m->yscroll(-1, -2, -1); $main->update; Time::HiRes::sleep(0.1); } } five for 0..$ITERATIONS; MainLoop;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://535997]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2022-01-27 01:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (70 votes). Check out past polls.

    Notices?