Here is a Zinc version. There are some things to watch out for when you use alot of timers and movement on screen. You don't want to overload your timers with work, or they won't be able to complete their task, before their next cycle. This results in nothing appearing on the screen. In this example, if I tried to move all columns in a single timer, it would overload, so I cheated, and shared columns between a few timers. There is also the relationship between timer speed, and pixels moved per cycle. You can choose a larger pixel movement per larger timer increment, but it will look jerky. This shows smooth motion. I also cheated a bit, by making it not resizable, so I could predict the number of columns. and hard code them into the timers. It is possible to do it so the screen could be any size, but I'll leave all that code-juggling up to you. :-) This should give you the basic idea.
#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::Zinc; my $width = 400; my $height = 600; my %tgroups; my %scrollers; my $mw = MainWindow->new; $mw->protocol('WM_DELETE_WINDOW' => sub { &clean_exit }); $mw->geometry($width.'x'.$height); $mw->configure(-background => 'black'); $mw->resizable(0,0); $mw->fontCreate('medium', -family=>'courier', -weight=>'bold', -size=>int(-14*14/10)); my $zinc = $mw->Zinc(-width => $width, -height => $height, -backcolor => 'black', -borderwidth => 0, -relief => 'sunken', -cursor => "top_left_arrow", )->pack; #create a group with it's origin at 0,0 upper left corner $tgroups{0}= $zinc->add('group',1,-visible=> 1); $zinc->scale( $tgroups{0}, 1, -1); #reverse direction of y axis so # numbers increase going down #create some vertical text my @letters; foreach my $i(33..126,161..255){ push @letters, chr($i); } my @shuffled = map {$_->[0]} sort { $a->[1] <=> $b->[1]} map {[$_, rand(1)]} @letters; my $position = 0; foreach my $letter( @shuffled ){ $zinc->add( 'text', $tgroups{0} , -position => [ 0, $position ], -text => $letter, -font => 'medium', -color => 'green', -priority => 2, ); $position += 15; } ################################################### #clone and translate # get width of column considering font my @pos = $zinc->bbox( $tgroups{0} ); #(corner coords x,y,x1,y1) my $widthcol = $pos[2] - $pos[0] + 10; # add a 5 pixel border my $numcols = int($width/$widthcol) + 1; #20 cols foreach my $j(1..$numcols){ $tgroups{$j} = $zinc->clone( $tgroups{0} ); $zinc->translate($tgroups{$j}, $j * $widthcol, int rand($height/8) ) +; } #start scroll &scroll; MainLoop; ########################################################## sub clean_exit{ foreach my $scroller(keys %scrollers){ $scrollers{$scroller}->cancel; } undef $zinc; $mw->destroy; Tk::exit; } ######################################################## sub scroll { $scrollers{0} = $mw->repeat(25,sub { foreach my $key(0,5,10,15,20 ){ $zinc->translate($tgroups{ $key },0, 5 ); my @pos = $zinc->bbox( $tgroups{$key} ); #(corner coo +rds x,y,x1,y1) if($pos[1] > $height/2){ $zinc->itemconfigure($tgroups{$key}, -visible => 0); $zinc->translate($tgroups{$key}, 0, (-$pos[3] )); $zinc->itemconfigure($tgroups{$key}, -visible => 1); } } } ); $scrollers{1} = $mw->repeat(20,sub { foreach my $key(1,4,6,11,16,19){ $zinc->translate($tgroups{ $key },0,5); my @pos = $zinc->bbox( $tgroups{$key} ); #(corner coo +rds x,y,x1,y1) if($pos[1] > $height){ $zinc->itemconfigure($tgroups{$key}, -visible => 0); $zinc->translate($tgroups{$key}, 0, (-$pos[3] )); $zinc->itemconfigure($tgroups{$key}, -visible => 1); } } } ); $scrollers{2} = $mw->repeat(30,sub { foreach my $key(2,7,9,12,14,17){ $zinc->translate($tgroups{ $key },0,5); my @pos = $zinc->bbox( $tgroups{$key} ); #(corner coo +rds x,y,x1,y1) if($pos[1] > $height){ $zinc->itemconfigure($tgroups{$key}, -visible => 0); $zinc->translate($tgroups{$key}, 0, (-$pos[3] )); $zinc->itemconfigure($tgroups{$key}, -visible => 1); } } } ); $scrollers{3} = $mw->repeat(36,sub { foreach my $key(3,8,13,18){ $zinc->translate($tgroups{ $key },0,5); my @pos = $zinc->bbox( $tgroups{$key} ); #(corner coo +rds x,y,x1,y1) if($pos[1] > $height){ $zinc->itemconfigure($tgroups{$key}, -visible => 0); $zinc->translate($tgroups{$key}, 0, (-$pos[3] - $height) +); $zinc->itemconfigure($tgroups{$key}, -visible => 1); } } } ); return; }

I'm not really a human, but I play one on earth. flash japh

In reply to Re: Matrix falling text effect by zentara
in thread Matrix falling text effect by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.