RosettaCodeData/Task/Animation/Icon/animation-2.icon

22 lines
609 B
Plaintext

link graphics
procedure main()
s := "Hello World! "
WOpen("size=640,400", "label=Animation")
Font("typewriter,60,bold")
direction := 1
w := TextWidth(s)
h := WAttrib("fheight")
x := (WAttrib("width") - w) / 2
y := (WAttrib("height") - 20 + h) / 2
repeat
{ if *Pending() > 0 then if (Event() = &lrelease) & (x < &x < x + w) & (y > &y > y-h) then direction := ixor(direction, 1)
s := s[2 - 3 * direction:0] || s[1:2 - 3 * direction]
EraseArea(x, y, w, -h)
DrawString(x,y - WAttrib("descent")-1,s)
WFlush()
delay(250)
}
end