Jump to content

Spinning rod animation/Text: Difference between revisions

No edit summary
Line 1,021:
printf "\r ($_)";
}
}</lang>
 
Extending it for moon phases:
 
<lang perl>$|=1;
binmode STDOUT, ":utf8";
 
while () {
for (map { $_ + 1 } 0x1F310 .. 0x1F317) {
# creating array of sequential codepoints using map from Unicode codepoints;
# an equal to qw[🌕 🌖 🌗 🌘 🌑 🌒 🌓 🌔 🌕 ]
select undef, undef, undef, 0.25;
# all the magic of this thing; switches between three file handles every 0.25s
print "\r @{[chr]}"
# string/variable interpolation;
# (1) chr without param works on `$_`
# (2) `[]` creates a singleton list
# (3) `@{}` dereferences the created list.
}
}</lang>
 
Cookies help us deliver our services. By using our services, you agree to our use of cookies.