RosettaCodeData/Task/Animation/FutureBasic/animation.basic

43 lines
1.1 KiB
Plaintext

_window = 1
_label = 1
void local fn DoIt
window _window, @"Animation", (0,0,480,270)
subclass textlabel _label, @"Hello World! ", (140,112,210,45)
ControlSetFont( _label, fn FontLabelFontOfSize( 36 ) )
ViewPropertySetBool( _label, @"MoveRight", YES )
timerbegin , 0.1, YES
CFStringRef string = fn ControlStringValue(_label)
CFStringRef chr
BOOL moveRight = fn ViewPropertyBool( _label, @"MoveRight" )
if ( moveRight )
chr = right( string, 1 )
string = fn StringWithFormat( @"%@%@",chr,left(string,len(string)-1) )
else
chr = left( string, 1 )
string = fn StringWithFormat( @"%@%@",right(string,len(string)-1),chr )
end if
textlabel _label, string
timerend
end fn
void local fn DoDialog( ev as long, tag as long )
select ( ev )
case _viewMouseDown
select ( tag )
case _label
BOOL moveRight = fn ViewPropertyBool( _label, @"MoveRight" )
if ( moveRight ) then moveRight == NO else moveRight = YES
ViewPropertySetBool( _label, @"MoveRight", moveRight )
end select
end select
end fn
fn DoIt
on dialog fn DoDialog
HandleEvents