User-created Colour Gradient function
Hey all.
I used to use this user-created function which I'd picked up from another wow website: Lua Code:
I've stripped it to it's bare bones for the sake of speed and simplicity. The three colours which make up it's range are red (0), yellow (50) and green (100). As with the above function, any number passed to the function which is inbetween those numbers will return a colour of the appropriate gradient (ie 25 will return an orangy-red colour): Lua Code:
Hope this comes in handy for someone. Aanson |
It will come in handy, thanks for sharing!
|
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:
Aanson |
CursorCastBar is using a gradient function similar to yours.
The advantage of the extended function is that it will deviate between 3 given colors rather than simply green/yellow/red. |
Quote:
It's cleaner and bound to run faster... not much faster I bet, but faster all the same which is going to be essential if it's getting called for AURA events or OnUpdate (when required for a fluid change between gradients) etc. Health status bars or timers for example. |
Just wanted to point to another thread that had a similar idea:
http://www.wowinterface.com/forums/s...ad.php?t=48236 Here we came to a completed addon that creates a very smooth transition from one color to another in the shortest possible way. Zork being awesome came up with this: ColorSmudge |
All times are GMT -6. The time now is 02:34 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI