local MAX_SECONDS = 60 * 60 * 12 local Hand = {} Hand.__index = Hand function Hand:new(length, color, sec_per_turn, ticks_per_turn) local h = { length = (length or 10), color = (color or {1,1,1}), sec_per_turn = (sec_per_turn or 1), ticks_per_turn = ticks_per_turn } return setmetatable(h, self) end local function handTransform(sec_elapsed) local turns = sec_elapsed / self.sec_per_turn if self.ticks_per_turn then turns = math.floor(turns * self.ticks_per_turn) / self.ticks_per_turn end return love.math.newTransform(0, 0, 2 * math.pi * turns) end function Hand:draw(sec_elapsed) local turns = sec_elapsed / self.sec_per_turn if self.ticks_per_turn then turns = math.floor(turns * self.ticks_per_turn) / self.ticks_per_turn end love.graphics.push("all") love.graphics.applyTransform(handTransform(sec_elapsed)) love.graphics.setColor(unpack(self.color)) love.graphics.rectangle("fill", -10, 10, 20, -self.length) love.graphics.pop() end