Created
June 21, 2018 15:25
-
-
Save brentpicasso/222dc8959d8afa70da7c9e0d22289944 to your computer and use it in GitHub Desktop.
Predicted time simulator + alternating TimeDelta, for testing UI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setTickRate(2) | |
delta = 0 | |
dir = 0.05 | |
did = addChannel('TimeDelta2', 50, 2, -10, 10, 'sec') | |
pid = addChannel('PredTime', 10, 4, 0, 5, 'min') | |
clid = addChannel('CurrentLap', 50, 0) | |
lcid = addChannel('LapCount', 50, 0) | |
maxval = 3 | |
pt = 99.34 | |
setChannel(pid, pt) | |
setChannel(clid, 3) | |
setChannel(lcid, 2) | |
function onTick() | |
if delta >= maxval or delta <= -maxval then dir = -dir end | |
delta = delta + dir | |
setChannel(did, delta) | |
local r = (math.random() - 0.5) * .01 | |
println(r) | |
setChannel(pid, pt + r) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment