|
Post by David Drake on Feb 26, 2020 9:45:06 GMT -5
I created the code below for the Rosetta Code task "Spinning rod animation/text," found here: rosettacode.org/wiki/Spinning_rod_animation/Text. It says to create a text spinning rod animation using the characters |, /, -, and \, 0.25 seconds between frames. Looking forward to suggestions from the community. a$="|/-\" timer 250, [s]
[s] b=b+1:if b=5 then b=1 locate 2,2 print mid$(a$,b,1) wait
|
|
|
Post by tsh73 on Feb 26, 2020 10:02:05 GMT -5
we can get rid of magic number 5, that's all
a$="|/-\" timer 250, [s]
[s] b=(b+1) mod len(a$) locate 2,2 print mid$(a$,b+1,1) wait
|
|
|
Post by David Drake on Mar 2, 2020 7:03:02 GMT -5
Thanks for the suggestion. I have incorporated it in the code below:
a$="|/-\" timer 250, [s]
[s] b=(b+1) mod len(a$) locate 2,2 print mid$(a$,b+1,1) wait
|
|