Spinning rod animation/Text: Difference between revisions

m
No edit summary
m (→‎{{header|Wren}}: Minor tidy)
Line 1,613:
=={{header|Wren}}==
{{trans|Kotlin}}
<syntaxhighlight lang="ecmascriptwren">import "io" for Stdout
import "timer" for Timer
 
var ESC = "\u001b"
 
var a = "|/-\\"
System.write("%(ESC)\e[?25l") // hide the cursor
var start = System.clock
var asleep = 0
while (true) {
for (i in 0..3) {
System.write("%(ESC)\e[2J") // clear terminal
System.write("%(ESC)\e[0;0H") // place cursor at top left corner
for (j in 0..79) { // 80 character terminal width, say
System.write(a[i])
}
Stdout.flush()
Timer.sleep(250) // suspends both current fiber & System.clock
asleep = asleep + 250
}
Line 1,637 ⟶ 1,635:
if (now * 1000 + asleep - start * 1000 >= 20000) break
}
System.print("%(ESC)\e[?25h") // restore the cursor</syntaxhighlight>
 
=={{header|XPL0}}==
9,483

edits