Animation: Difference between revisions

mNo edit summary
imported>Chinhouse
Line 3,391:
{{works with|Mini Micro}}
<syntaxhighlight lang="miniscript">clear
text.inverse = true
s = "Hello World! "
toggle = true
while not key.available
while true
text.row = 12
text.column = 15
print " " + s + " "
wait 0.1
while not if key.available then
s = s[-1] + s[:-1]
toggle = not toggle
key.clear
yield
end if
if toggle then
s = s[-1] + s[:-1]
else
s = s[1:] + s[0]
end if
key.clearend while</syntaxhighlight>
 
Alternate version that scrolls pixel by pixel rather than character by character.
<syntaxhighlight lang="miniscript">clear
txt = "Hello World! "
width = txt.len * 20 + 4
gfx.print txt,0,608,color.white, "large"
toggle = false
 
while true
img1 = gfx.getImage(toggle, 608, width - 1, 32)
img2 = gfx.getImage((not toggle) * (width - 1), 608, 1, 32)
gfx.drawImage img1, (not toggle), 608
gfx.drawImage img2, toggle * (width - 1), 608
if key.available then
toggle = not toggle
key.clear
end if
yield
end while
</syntaxhighlight>
text.inverse = false
key.clear</syntaxhighlight>
 
=={{header|Nim}}==
Anonymous user