The only problem: screen size is constant. I just dont know how to determine terminal size under different OSes. Should I use curses for that?
#!/usr/bin/perl use strict; use Time::HiRes qw(usleep);my @j=split //,'just another perl hacker' ;my $clear =( $^O=~/win/i? 'cls':'clear' );my ($ +w,$h)=(80,23);my ($hw,$hh,$ky) =($w/2,int$h /2,0.5); my $times= +20;my @mix;my $M;my ($ofs,$len ,$hl)=($hh*$w+$hw-@j/2,scalar@j ,@j/2); +my $pi=3.1416;sub mix {for ( 1.. $times){my $f=int rand @j;my $t ;SAME: +$t= int rand @j ;my $r=int abs(($f-$t) /2);goto SAME if $r< +5|| $j[$f]eq $j [$t]||($j[ $f]eq"\040" &&$j[$t]eq" " );unshi +ft @mix,[$f,$t ,$r];@j[$f ,$t]=@j[$t, $f];} 1;} sub fill{$M +=' 'x($w*$h);}sub show (@){system "$clear +";print"$M\n";usleep( 10000)} sub line(@ ){subst +r($M,$ofs,$len)=join '',@j;} sub letter {my($l0,$l1 ,$a,$r,$c)=@_ ;substr +($M ,($hh+int (sin($a) * $r*$ky))*$w +$c+int(cos( $a)*$r) +,1) =$l0;substr($M,($hh-int (sin($a)*$r *$ky))*$w+$c- int(cos +($a )*$r),1)=$l1;} sub pair {my($f,$t,$r)=@_; my @c=(@j[$f, $t]); s +how line fill; $j[$f]=$j[$t ]="\040";my $xc=$hw-$hl+$r+($f <$t?$f: +$t) ;my $da=$pi/6;my $a= $da; while($a<$pi){ line fill and s +how letter(@c,$a ,$r,$xc);$a+= $da;}@j[$t, $f]=@c}sub go {pair(@$_) for@mix;show line fill}
mix and go

In reply to Some rotations (first JAPH) by maard

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.