Quantcast WoWInterface - View Single Post - need help with some LUA-Texts
View Single Post
10-02-19, 02:34 PM   #3
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,920
Here's how I usually handle the health gradient.
Code:
("|cff%02x%02x00"):format(math.ceil(math.max(math.min(2*(1-percent),1),0)*255),math.ceil(math.max(math.min(2*percent,1),0)*255));
Note: percent is a float value clamped between 0 and 1. This scales the percent up and clamps it afterward to produce |cffffff00 at 0.5 rather than |cff808000.
__________________
ESOUI AddOns | WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote