Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -1,3 +1,3 @@
Animation is the foundation of a great many parts of graphical user interfaces, including both the fancy effects when things change used in window managers, and of course games. The core of any animation system is a scheme for periodically changing the display while still remaining responsive to the user. This task demonstrates this.
'''Animation''' is integral to many parts of [[GUI]]s, including both the fancy effects when things change used in window managers, and of course games. The core of any animation system is a scheme for periodically changing the display while still remaining responsive to the user. This task demonstrates this.
Create a window containing the string "<code>Hello World! </code>" (the trailing space is significant). Make the text appear to be rotating right by periodically removing one letter from the end of the string and attaching it to the front. When the user clicks on the text, it should reverse its direction.

View file

@ -0,0 +1,47 @@
try destroydialog animGUI catch ()
global userDirection = "right"
fn reverseStr str: direction: =
(
local lastChar = str[str.count]
local firstChar = str[1]
local newStr = ""
local dir
if direction == unsupplied then dir = "left" else dir = direction
case dir of
(
"right": (newstr = lastChar + (substring str 1 (str.count-1)))
"left": (newstr = (substring str 2 (str.count))+firstChar)
)
return newstr
)
rollout animGUI "Hello World" width:200
(
button switchToLeft "<--" pos:[40,0] height:15
label HelloWorldLabel "Hello World! " pos:[80,0]
button switchToRight "-->" pos:[150,0] height:15
timer activeTimer interval:70 active:true
on activeTimer tick do
(
HelloWorldLabel.text = reverseStr str:(HelloWorldLabel.text) direction:userDirection
)
on switchToLeft pressed do
(
userDirection = "left"
)
on switchToRight pressed do
(
userDirection = "right"
)
)
createdialog animGUI