Advertisement
CloneTrooper1019

GetSkyHue

Aug 31st, 2014
512
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.77 KB | None | 0 0
  1. function getSkyHue()
  2.     local TIME = game.Lighting:GetMinutesAfterMidnight()
  3.     local TIMES = {0, 300, 330, 360, 390, 1050, 1080, 1100, 1440};
  4.     local C3,V3 = Color3.new,Vector3.new
  5.         local COLORS = {C3(0,0,0),C3(0,0,0),C3(.2,.15,.01),C3(.2,.15,.01),C3(1,1,1),C3(1,1,1),C3(.4,.2,.05),C3(0,0,0),C3(0,0,0)};
  6.     local P0,P1 = 1,#TIMES
  7.     for k,v in pairs(TIMES) do
  8.         if v > TIMES[P0] and v < TIME then P0 = math.max(1,k) end
  9.         if v < TIMES[P1] and v > TIME then P1 = math.min(#TIMES,k) end
  10.     end
  11.     local START,END = TIMES[P0],TIMES[P1]
  12.     if START == END or P0 == P1 then
  13.         return Color3.new()
  14.     end
  15.     local A = math.max(0,math.min(1,(TIME-START)/(END-START)))
  16.     local S,E = COLORS[P0],COLORS[P1]
  17.     local CL = V3(S.r,S.g,S.b):lerp(V3(E.r,E.g,E.b),A)
  18.     return Color3.new(CL.X,CL.Y,CL.Z)
  19. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement