Vibrating rectangles: Difference between revisions
Content added Content deleted
SqrtNegInf (talk | contribs) m (was missing first 3 lines of program) |
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: minor twiddles) |
||
Line 63: | Line 63: | ||
my %r = :tl<┌>, :h<─>, :tr<┐>, :v<│>, :bl<└>, :br<┘>; |
my %r = :tl<┌>, :h<─>, :tr<┐>, :v<│>, :bl<└>, :br<┘>; |
||
my |
my @colors = « \e[1;31m \e[1;94m \e[1;33m \e[1;35m \e[1;36m \e[1;32m \e[1;34m »; |
||
bu => "\e[1;34m", mg => "\e[1;35m", cy => "\e[1;36m"; |
|||
# color palette |
# color palette |
||
my @c = flat |
my @c = flat @colors[0] xx 12, @colors[3] xx 12, @colors[2] xx 12; |
||
⚫ | |||
⚫ | |||
print "\e[?25l"; # hide the cursor |
print "\e[?25l"; # hide the cursor |
||
Line 81: | Line 76: | ||
my $rot = 1; |
my $rot = 1; |
||
⚫ | |||
loop { |
loop { |
||
⚫ | |||
display @vibe; |
display @vibe; |
||
@c.=rotate($rot); |
@c.=rotate($rot); |
||
if ++$ %% 30 { |
if ++$ %% 30 { |
||
@c = | |
@c = |@colors.pick(3); |
||
@c = sort(flat @c xx 12); |
@c = sort(flat @c xx 12); |
||
$rot *= -1; |
$rot *= -1; |
||
} |
} |
||
rect($_, 31-$_) for 0..15; |
|||
sleep .1; |
sleep .1; |
||
} |
} |