Jump to content

Spinning rod animation/Text: Difference between revisions

Rename Perl 6 -> Raku, alphabetize, minor clean-up
m (The task description now says alternate characters can replace any of the frames and when that's allowed. Also, a note saying the 0.25 second delay assumes the program is running at 60 frames per second has been added to the NS-HUBASIC solution.)
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
Line 51:
}
</lang>
 
=={{header|Bash}}==
<lang bash>while : ; do
Line 126 ⟶ 127:
"\\|/-" [ "%c\r" printf flush 1/4 seconds sleep ] each
] forever</lang>
 
=={{header|Forth}}==
Tested in gforth 0.7.9
<lang forth>
: rod
cr
begin
[char] \\ emit 250 ms
13 emit [char] | emit 250 ms
13 emit [char] - emit 250 ms
13 emit [char] / emit 250 ms
again
;
rod
</lang>
 
=={{header|FreeBASIC}}==
<lang freebasic>' version 13-07-2018
Line 144 ⟶ 161:
 
End</lang>
 
=={{header|Forth}}==
Tested in gforth 0.7.9
<lang forth>
: rod
cr
begin
[char] \\ emit 250 ms
13 emit [char] | emit 250 ms
13 emit [char] - emit 250 ms
13 emit [char] / emit 250 ms
again
;
rod
</lang>
 
=={{header|GlovePIE}}==
Line 397 ⟶ 399:
}</lang>
 
=={{header|Perl 6Phix}}==
<lang Phix>puts(1,"please_wait... ")
cursor(NO_CURSOR)
for i=1 to 10 do -- (approx 10 seconds)
for j=1 to 4 do
printf(1," \b%c\b",`|/-\`[j])
sleep(0.25)
end for
end for
puts(1," \ndone") -- clear rod, "done" on next line
</lang>
 
=={{header|PicoLisp}}==
<lang Lisp>
(de rod ()
(until ()
(for R '(\\ | - /)
(prin R (wait 250) "\r")(flush) ) ) )
(rod)
</lang>
 
=={{header|Python}}==
<lang python>from time import sleep
while True:
for rod in r'\|/-':
print(rod, end='\r')
sleep(0.25)</lang>
 
=={{header|Racket}}==
<lang racket>
#lang racket
(define (anim)
(for ([c "\\|/-"])
(printf "~a\r" c)
(sleep 0.25))
(anim))
(anim)
</lang>
 
=={{header|Raku}}==
(formerly Perl 6)
{{works with|Rakudo|2018.05}}
Traditionally these are know as [[wp:throbber|throbbers]] or progress indicators.
Line 438 ⟶ 480:
 
END { print "\e[?25h\n" } # clean up on exit</lang>
 
=={{header|Phix}}==
<lang Phix>puts(1,"please_wait... ")
cursor(NO_CURSOR)
for i=1 to 10 do -- (approx 10 seconds)
for j=1 to 4 do
printf(1," \b%c\b",`|/-\`[j])
sleep(0.25)
end for
end for
puts(1," \ndone") -- clear rod, "done" on next line
</lang>
 
=={{header|PicoLisp}}==
<lang Lisp>
(de rod ()
(until ()
(for R '(\\ | - /)
(prin R (wait 250) "\r")(flush) ) ) )
(rod)
</lang>
 
=={{header|Python}}==
<lang python>from time import sleep
while True:
for rod in r'\|/-':
print(rod, end='\r')
sleep(0.25)</lang>
 
=={{header|Racket}}==
<lang racket>
#lang racket
(define (anim)
(for ([c "\\|/-"])
(printf "~a\r" c)
(sleep 0.25))
(anim))
(anim)
</lang>
 
=={{header|REXX}}==
10,339

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.