`setup sync on : sync rate 60 set display mode 1024,768,32 : hide mouse `Types type vec2 x as float y as float endtype `Globals global time as string global hours as integer global minutes as integer global seconds as integer global clMessage as string global clLength as integer global clSize as float global clLetAng as float global spin as float global spinspeed as float global smoothness as float `Configure clMessage="Clock! By Zotoaster" clLength=text width(clMessage) clLetAng=360/len(clMessage) clSize=60 spinspeed=-1.5 smoothness=0.5 `Arrays dim letter(len(clMessage)) as string dim letterpos(len(clMessage)) as vec2 dim nletterpos(len(clMessage)) as vec2 `Configure for l=1 to len(clMessage) letter(l)=mid$(clMessage,l) next l `Main Loop do `Get Time time=get time$() `Format string hours=val(getToken(time,":",1)) minutes=val(getToken(time,":",2)) seconds=val(getToken(time,":",3)) `Rotate clock spin=wrapvalue(spin+spinspeed) `Show clock for l=1 to len(clMessage) letterpos(l).x=mousex()+(sin(-(clLetAng*l)+spin)*clSize) letterpos(l).y=mousey()+(cos(-(clLetAng*l)+spin)*clSize) nLetterPos(l).x=curvevalue(letterpos(l).x,nLetterPos(l).x,l*Smoothness) nLetterPos(l).y=curvevalue(letterpos(l).y,nLetterPos(l).y,l*Smoothness) center text nLetterPos(l).x,nLetterPos(l).y-(text size()/2),letter(l) next l `Show time line mousex(),mousey(),mousex()+(sin(hours*20)*(clSize/2)),mousey()+(cos(hours*20)*(clSize/2)) line mousex(),mousey(),mousex()+(sin(minutes*6)*(clSize/1.5)),mousey()-(cos(minutes*6)*(clSize/1.5)) line mousex(),mousey(),mousex()+(sin(seconds*6)*(clSize)),mousey()-(cos(seconds*6)*(clSize)) center text mousex(),mousey()+(clSize+(clSize/4)),time sync cls loop `Functions function getTokens(st$,sp$) repeat counter=counter+1 cur$=mid$(st$,counter) if cur$=sp$ then inc splits until counter>len(st$) tokens=splits+1 endfunction tokens function getToken(st$,sp$,num) nst$=sp$+st$+sp$ repeat inc counter cur$=mid$(nst$,counter) if cur$=sp$ then inc splits until splits=num or counter>len(st$) repeat inc counter cur$=mid$(nst$,counter) if cur$<>sp$ then token$=token$+cur$ until cur$=sp$ or counter>len(st$) endfunction token$