Animation: Difference between revisions

m
→‎{{header|Wren}}: Changed to Wren S/H
m (Add emacs lisp)
m (→‎{{header|Wren}}: Changed to Wren S/H)
 
(3 intermediate revisions by 3 users not shown)
Line 2,103:
[def _() { leftward := !leftward; null }, anim.stop]
}</syntaxhighlight>
 
=={{header|EasyLang}}==
key.clear</syntaxhighlight lang=easylang>
s$ = "Hello world! "
textsize 16
lg = len s$
on timer
color 333
move 10 20
rect 80 20
color 999
move 12 24
text s$
if forw = 0
s$ = substr s$ lg 1 & substr s$ 1 (lg - 1)
else
s$ = substr s$ 2 (lg - 1) & substr s$ 1 1
.
timer 0.2
.
on mouse_down
if mouse_x > 10 and mouse_x < 90
if mouse_y > 20 and mouse_y < 40
forw = 1 - forw
.
.
.
timer 0
</syntaxhighlight>
 
 
=={{header|Elm}}==
Line 2,273 ⟶ 2,303:
"animation thread")
)
 
(animation-start)
</syntaxhighlight>
 
Line 3,389 ⟶ 3,421:
{{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
end 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}}==
Line 4,849 ⟶ 4,908:
=={{header|Wren}}==
{{libheader|DOME}}
<syntaxhighlight lang="ecmascriptwren">import "graphics" for Canvas, Color
import "dome" for Window
import "input" for Mouse
9,485

edits