Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Alternate drive code for Jousway's analog clock.
- local fHour=nil
- local fMinute=nil
- local fSecond=nil
- local bBegun=false
- function fpmod(num,mod)
- assert(num>=0 and mod>0)
- return num-(mod*math.floor(num/mod))
- end
- local function sync(slef)
- local iStart=Second()
- while Second()==iStart do
- slef:sleep(0.001)
- end
- end
- local function TimeUpdate(s,fDelta)
- if not bBegun then
- fDelta=0
- sync(s)
- fHour=Hour()%12
- fMinute=Minute()
- fSecond=Second()
- end
- fHour=fpmod(fHour+(fDelta/3600),12)
- fMinute=fpmod(fMinute+(fDelta/60),60)
- fSecond=fpmod(fSecond+fDelta,60)
- s:GetChild("one"):rotationz(fHour*30)
- s:GetChild("two"):rotationz(fMinute*6)
- s:GetChild("three"):rotationz(fSecond*6)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement