Spinning rod animation/Text: Difference between revisions
Added Easylang
(J) |
(Added Easylang) |
||
(8 intermediate revisions by 4 users not shown) | |||
Line 215:
(message "%c" char)
(sit-for 0.25)))</syntaxhighlight>
=={{header|Delphi}}==
{{works with|Delphi|6.0}}
{{libheader|SysUtils,StdCtrls}}
<syntaxhighlight lang="Delphi">
procedure SpinningRod(Memo: TMemo);
var I: integer;
const CA: array [0..3] of char = ('|','/','-','\');
begin
LastKey:=#0;
for I:=0 to 1000 do
begin
Memo.SetFocus;
Memo.Lines.Clear;
Memo.Lines.Add(CA[I mod 4]+' - Press Any Key To Stop');
Sleep(250);
if (LastKey<>#0) or Application.Terminated then break;
Application.ProcessMessages;
end;
end;
</syntaxhighlight>
{{out}}
<pre>
/ - Press Any Key To Stop
Elapsed Time: 12.251 Sec.
</pre>
=={{header|EasyLang}}==
[https://easylang.dev/show/#cod=Lc09CgIxEAXgfk7xWCwUYcmuaOdJxEKyAwZMAkkQ8Qw2/tt5RY9gHtp8w4M3M3a0WmOJXJLdblJG83mfzqhcyJXcyJ08yJO8Gil6KNkdFQsjPu4VvcHMSAwozmsSAC4M9faYY4puAh+HDjsNsPUrC7zBUBu/zE2Ytp9LK/8gXw== Run it]
<syntaxhighlight>
c$[] = strchars "🌑 🌒 🌓 🌔 🌕 🌖 🌗 🌘"
textsize 60
move 20 30
on timer
ind = (ind + 1) mod1 len c$[]
text c$[ind]
timer 0.25
.
timer 0
</syntaxhighlight>
=={{header|Factor}}==
Line 367 ⟶ 414:
Assuming you have terminal support for the hour wingdings, this would also work:
<syntaxhighlight lang=J>0.
or
<syntaxhighlight lang=J>0.25 spin a.{~240 159 149&,&>144+i.24</syntaxhighlight>
Note also that you could animate lines of text rather than individual characters. For example, converting words to lines:
<syntaxhighlight lang=J>0.5 spin >;:'this is a test'</
=={{header|Java}}==
Line 1,578 ⟶ 1,629:
=={{header|Wren}}==
{{trans|Kotlin}}
<syntaxhighlight lang="
import "timer" for Timer
var a = "|/-\\"
System.write("
var start = System.clock
var asleep = 0
while (true) {
for (i in 0..3) {
System.write("
System.write("
for (j in 0..79) {
System.write(a[i])
}
Stdout.flush()
Timer.sleep(250)
asleep = asleep + 250
}
Line 1,602 ⟶ 1,651:
if (now * 1000 + asleep - start * 1000 >= 20000) break
}
System.print("
=={{header|XPL0}}==
|