Skip to content

Instantly share code, notes, and snippets.

@cxmeel
Last active May 16, 2020 13:21
Show Gist options
  • Save cxmeel/62c73c62977335f33b74cd43d938d047 to your computer and use it in GitHub Desktop.
Save cxmeel/62c73c62977335f33b74cd43d938d047 to your computer and use it in GitHub Desktop.
local function timeToDegrees(hours, minutes, inRadians)
hours = type(hours) == "number" and hours or 0
minutes = type(minutes) == "number" and minutes or 0
local timeDegrees = {
hours = (hours / 12) * 360,
minutes = (minutes / 60) * 360
}
if (inRadians) then
timeDegrees.hours = math.rad(timeDegrees.hours)
timeDegrees.minutes = math.rad(timeDegrees.minutes)
end
return timeDegrees
end
return timeToDegrees
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment