crtrdg-time
Track elapsed game time in a crtrdg-gameloop
usage
var Game = game = Time = time = game; game;
millis
, seconds()
and minutes()
all return duration since the timer was created (excluding any time that the game was paused).
throb(durationMillis)
returns a value between 0 and 1 that will rise and fall once per durationMillis
milliseconds of game time (linear, not sine wave). To get a different range, coerce the value, e.g. if you have some text changing between 0.5 and 0.75 transparency every 2 seconds, you could use throb(2000) * 0.25 + 0.5
License
MIT