View Single Post
01-08-14, 12:31 PM   #3
Aanson
A Flamescale Wyrmkin
Join Date: Aug 2009
Posts: 124
Ooops

Sorry, I'd been mucking about with it before I posted it. 'mod' should be replaced by 'math.modf' for it to work as intended!

Lua Code:
  1. local GetPercentageColourGradient = function(percent)
  2.     local _, x = math.modf(percent * 0.02);
  3.     return (percent <= 50) and 1 or (percent >= 100) and 0 or (1 - x), (percent >= 50) and 1 or (percent <= 0) and 0 or x, 0;
  4. end

Aanson
__________________
__________________
  Reply With Quote