Thread Tools Display Modes
09-26-13, 02:27 AM   #1
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Color to Color smooth transition.

I've been working on a function to allow me to transition one color to another.

It does its job with some additional effects but I'm wondering if there are some alternatives to my method that may do a slightly better job.

The only major downside to my function here is if the colors can cancel out and have a white or grey at the 50% region.

Lua Code:
  1. local function ColorFunction(l, h, lc, hc, ilvl)
  2.     -- l here is the lower limit
  3.     -- h here is the higher limit
  4.     -- lc is the lower limit color table {value1,value2,value3} between 0 and 1
  5.     -- hc is the higher limit color table
  6.     -- ilvl is just a value in-between the limits that determines the color
  7.     if ilvl <= l then
  8.         return unpack(lc)
  9.     elseif ilvl >= h then
  10.         return unpack(hc)
  11.     else
  12.         local p = (ilvl-l)/(h-l) -- percent of the input
  13.         local r,g,b = 1,1,1
  14.         -- Red
  15.         if hc[1] <= lc[1] then -- if the higher color's red value is lower then the lower color's red value
  16.             local v = lc[1] - hc[1] -- find the value range
  17.             r = lc[1] - (v*p) -- red equals the lower red value minus the percentage of the value range.
  18.         else
  19.             local v = hc[1] - lc[1] -- find the value range
  20.             r = lc[1] + (v*p) -- red equals the lower red value plus the percentage of the value range.
  21.         end
  22.         -- Green
  23.         if hc[2] <= lc[2] then
  24.             local v = lc[2] - hc[2]
  25.             g = lc[2] - (v*p)
  26.         else
  27.             local v = hc[2] - lc[2]
  28.             g = lc[2] + (v*p)
  29.         end
  30.         -- Blue
  31.         if hc[3] <= lc[3] then
  32.             local v = lc[3] - hc[3]
  33.             b = lc[3] - (v*p)
  34.         else
  35.             local v = hc[3] - lc[3]
  36.             b = lc[3] + (v*p)
  37.         end
  38.         return r, g, b
  39.     end
  40. end

Last edited by suicidalkatt : 09-26-13 at 02:31 AM.
  Reply With Quote
09-26-13, 03:21 AM   #2
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Hmmm...here is what I would do.

Lua Code:
  1. --colorA - color table in RGB
  2. --colorB - color table in RGB
  3. --percentage of conversion of A to B (values from 0-1)
  4. local function SmudgeColor(colorA, colorB, percent)
  5.   local r, g, b = colorA.r-(colorA.r-colorB.r)*percent, colorA.g-(colorA.g-colorB.g)*percent, colorA.b-(colorA.b-colorB.b)*percent
  6.   return {r=r,g=g,b=b}
  7. end
  8.  
  9. local colorA = {r=1,g=0,b=0.5}
  10. local colorB = {r=1,g=1,b=0}
  11. local color = SmudgeColor(colorA,colorB,0.5)

But I think you are looking for sth else.

Red = 1,0,0
You can get all variants of red by mixing in white and black.
Adding white would add color values to red ranging from {0,0,0} to {1,1,1}. All values have a max of 1.
After that black comes into play. Depending on how dark the color should be the new color will get multiplied with the blackness ranging from {1,1,1} to {0,0,0}.

baseColor = 1,0,0
baseColor+White = 1,0.5,0.5 | +1*0,5
(baseColor+White)*Black = 0.5,0.25,0.25 | * 0.5

The blackness level of a color can be checked by looking at max(r,g,b). If the max is 1 then no black is applied. Once the blackness is removed the amount of white is min(r,g,b).

Calculating back to the base color is kind of tricky.

Lets do a quick example. (RGB in 0-255)

This is my color: RGB(87,56,78)
Blackness level is: max(r,g,b)/255=0.34
Removing the blackness = (87/0.34,56/0.34,78/0.34) = RGB(255,164,229)
The whiteness level is: min(r,g,b)/255 = 0.64
Now lets get to the actual base color. The lowest and the highest number will not be needed for this. One of this will always be 255. To get to the correct base color the whiteness has the be taken out.
The calculation for this is: 255-(255-229)/(1-0.64)
Thus the final base color is: (255,0,182)
Whitness: 0.64
Blackness: 0.34

That can be transfered into a new function. Because you are having the whiteness and blackness of a color you can apply percentages to them aswell.

Color transition is another issue.


If you want to go from {1,0,0} to {0,1,0} you cannot reduce the one value and increase the other. You have to go over {1,1,0} first. One extreme is going from red to aqua. because you go from {1,0,0} to {0,1,1}

Conclusion:
You have two colors that you want to morph on a percentage. First step is to calculate whiteness, blackness and baseColor for both colors. Next step is to decide on the color transition. Basically how should the two baseColors morph into each other. I probably would use an array for that. The array would have all colors in it. You then find both color indexes and the percentage values describes an index inbetween that is the new basecolor. You then apply the median of the whiteness and blackness values to the new basecolor and have your new final color.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 09-26-13 at 05:21 AM.
  Reply With Quote
09-26-13, 04:01 AM   #3
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Originally Posted by zork View Post
Hmmm...here is what I would do.
~ snip ~
I like it, makes a lot of sense.
  Reply With Quote
09-26-13, 04:04 AM   #4
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
I'm using a slightly modified version of the ColorGradient user function that's used in 99% of addons
Code:
local ColorGradient = function(perc, ...)
    local num = select("#", ...)

    if perc >= 1 then
        return select(num-2, ...), select(num-1, ...), select(num, ...)
    elseif perc <= 0 then
    	local r,g,b = ...
    	return r,g,b
    end

    num = num / 3

    local segment, relperc = modf(perc*(num-1))
    local r1, g1, b1, r2, g2, b2
    r1, g1, b1 = select((segment*3)+1, ...), select((segment*3)+2, ...), select((segment*3)+3, ...)
    r2, g2, b2 = select((segment*3)+4, ...), select((segment*3)+5, ...), select((segment*3)+6, ...)

    if not r2 or not g2 or not b2 then
        return r1, g1, b1
    else
        return r1 + (r2-r1)*relperc,
        g1 + (g2-g1)*relperc,
        b1 + (b2-b1)*relperc
    end
end
Used as ColorGradient(percent,r1,g1,b1, r2,g2,b2 [,r3,g3,b3]) where percent is between 0 - 1
  Reply With Quote
09-26-13, 05:02 AM   #5
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
There's an own wiki entry about this:
http://www.wowwiki.com/ColorGradient
  Reply With Quote
09-26-13, 06:12 AM   #6
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
My question is how many decimals should the r, b, g, a values should have to use exactly the same color what the user picked.
  Reply With Quote
09-26-13, 06:49 AM   #7
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Regarding the color gradient calculation I probably would use a radial solution.



Red {1,0,0} = 0°
Yellow {1,1,0} = 60°
Green {0,1,0} = 120°
Aqua {0,1,1} = 180° or -180°
Blue {0,0,1} = 240° or -120°
Magenta {1,0,1} = 300° or -60°

Your two base colors will be on that ring and the smallest radius between the two points describes the pie that will be used for color extraction.

I think this can be achieved most easily by using a HSV conversion on the baseColor.
http://wowprogramming.com/docs/widge...ct/SetColorRGB
http://wowprogramming.com/docs/widge...ct/GetColorHSV

That will give you an angle, hue and saturation. You can then calculate a new angle and use the color selector to create a new basecolor.

---update---------------

Actually by thinking it through it may be possible to just use the hsv calculation. Not only do we get an angle, but we get saturation (whiteness) and value (blackness) all in one step.

Thus it is very easy to create a new point between two HSV colors. You just apply the conversion ratio on the HSV values of your two colors and create a new color based on the conversion.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 09-26-13 at 08:09 AM.
  Reply With Quote
09-26-13, 08:18 AM   #8
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
This should do it:
Lua Code:
  1. local colorA = {r=1,g=0.4,b=0}
  2. local colorB = {r=0.5,g=0.8,b=1}
  3. local colorC = {}
  4. local percentage = 0.3
  5.  
  6. local colorSelector = CreateFrame("ColorSelect") or ColorPickerFrame
  7.  
  8. local function GetHsvColorByRgb(color)
  9.   colorSelector:SetColorRGB(color.r, color.g, color.b)
  10.   color.h, color.s, color.v = colorSelector:GetColorHSV()
  11.   return color
  12. end
  13.  
  14. local function GetRgbColorByHsv(color)
  15.   colorSelector:SetColorHSV(color.h, color.s, color.v)
  16.   color.r, color.g, color.b = colorSelector:GetColorRGB()
  17.   return color
  18. end
  19.  
  20. GetHsvColorByRgb(colorA)
  21. GetHsvColorByRgb(colorB)
  22.  
  23. colorC.h = colorA.h-(colorA.h-colorB.h)*percentage
  24. colorC.s = colorA.s-(colorA.s-colorB.s)*percentage
  25. colorC.v = colorA.v-(colorA.v-colorB.v)*percentage
  26.  
  27. GetRgbColorByHsv(colorC)

If for whatever reason the ColorSelect does not want to play you can use the conversion formulas from Leaf or LibCrayon.
https://github.com/minism/leaf/blob/master/color.lua
http://www.wowace.com/addons/libcrayon-3-0/
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 09-26-13 at 08:45 AM.
  Reply With Quote
09-26-13, 10:47 AM   #9
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Not sure what element you guys want to color, but if it's a texture then:

http://wowprogramming.com/docs/widge...tGradientAlpha
  Reply With Quote
09-26-13, 11:12 AM   #10
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
We want to calculate a specific intermediate color that lives between two other colors.
What you posted is a function to fill a texture with a gradient color. That is not what we want.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
09-26-13, 12:33 PM   #11
ravagernl
Proceritate Corporis
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 1,176
How about something like this, found it on my harddrive, but can't remember from where I found this

lua Code:
  1. local function ColorMixAlpha(red1, green1, blue1, alpha1, red2, green2, blue2, alpha2, weight)
  2.     weight = weight or 0.5
  3.  
  4.     local w, a, w1, w2
  5.     w = weight * 2 - 1
  6.     a = alpha1 - alpha2
  7.  
  8.     w1 = ((w * a == -1 and w or (w + a)/(1 + w * a)) +1) / 2
  9.     w2 = 1 - w1
  10.  
  11.     return
  12.         w1 * red1 + w2 * red2,
  13.         w1 * green1 + w2 * green2,
  14.         w1 * blue1 + w2 * blue2,
  15.         alpha1 * weight + alpha2 * (weight - 1)
  16. end
  Reply With Quote
09-26-13, 01:17 PM   #12
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
I just tested my assumption. Using ColorSelect works exactly as intended.


Code:
http://code.google.com/p/rothui/sour...e/core.lua#120

Test-Addon:
http://www.wowinterface.com/download...lorSmudge.html

There is one tiny issue though. That is if I pick a color that rolls over 360°, basically where going around the left side would be shorter. That needs some work to fix.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 09-26-13 at 01:19 PM.
  Reply With Quote
09-26-13, 09:55 PM   #13
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Originally Posted by zork View Post
I just tested my assumption. Using ColorSelect works exactly as intended.
Code:
http://code.google.com/p/rothui/sour...e/core.lua#120

Test-Addon:
http://www.wowinterface.com/download...lorSmudge.html

There is one tiny issue though. That is if I pick a color that rolls over 360°, basically where going around the left side would be shorter. That needs some work to fix.
Interesting approach but how much performance loss would this cause?
  Reply With Quote
09-27-13, 01:07 AM   #14
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Why should it? You call some API functions and multiply some values. That's it.

Lua Code:
  1. local frame = CreateFrame("ColorSelect")
  2. function frame:UpdateColor()
  3.   --get hsv color for colorA
  4.   self:SetColorRGB(self.colorA.r, self.colorA.g, self.colorA.b)
  5.   self.colorA.h, self.colorA.s, self.colorA.v = self:GetColorHSV()
  6.   --get hsv color for colorB
  7.   self:SetColorRGB(self.colorB.r, self.colorB.g, self.colorB.b)
  8.   self.colorB.h, self.colorB.s, self.colorB.v = self:GetColorHSV()
  9.   --calculate colorC HSV values based on HSV values from colorA and colorB and multiply them by the percentage
  10.   self.colorC.h = floor(self.colorA.h-(self.colorA.h-self.colorB.h)*self.percentage/100)
  11.   self.colorC.s = self.colorA.s-(self.colorA.s-self.colorB.s)*self.percentage/100
  12.   self.colorC.v = self.colorA.v-(self.colorA.v-self.colorB.v)*self.percentage/100
  13.   --get the RGB value of colorC
  14.   self:SetColorHSV(self.colorC.h, self.colorC.s, self.colorC.v)
  15.   self.colorC.r, self.colorC.g, self.colorC.b = self:GetColorRGB()
  16.   --apply RGB color to texture
  17.   self.texture:SetVertexColor(self.colorC.r, self.colorC.g, self.colorC.b)    
  18. end

The only line that still needs work is this.
lua Code:
  1. self.colorC.h = floor(self.colorA.h-(self.colorA.h-self.colorB.h)*self.percentage/100)

That is because the angle is > 180.
Example:
alpha = 40°
beta = 300°
Going from 40 to 300 is > 180.
So we want to go from 40 to 0/360 to 300 which is 100 in total.

I will try this drycode later. It shows the intention on how to fix it.

---update------------

Fixed the drycode.

lua Code:
  1. if abs(self.colorA.h-self.colorB.h) > 180 then
  2.       local radius = (360-abs(self.colorA.h-self.colorB.h))*self.percentage/100
  3.       --calculate the 360° breakpoint
  4.       if self.colorA.h < self.colorB.h then
  5.         self.colorC.h = floor(self.colorA.h-radius)
  6.         if self.colorC.h < 0 then
  7.           self.colorC.h = 360+self.colorC.h
  8.         end
  9.       else
  10.         self.colorC.h = floor(self.colorA.h+radius)
  11.         if self.colorC.h > 360 then
  12.           self.colorC.h = self.colorC.h-360
  13.         end
  14.       end
  15.     else
  16.       self.colorC.h = floor(self.colorA.h-(self.colorA.h-self.colorB.h)*self.percentage/100)
  17.     end
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 09-27-13 at 09:20 AM.
  Reply With Quote
09-27-13, 02:14 AM   #15
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by zork View Post
We want to calculate a specific intermediate color that lives between two other colors.
What you posted is a function to fill a texture with a gradient color. That is not what we want.
Oh i see, my bad then.
  Reply With Quote
09-27-13, 02:26 AM   #16
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Here is the final color caluclation function that should work as intended. You enter two RGB colors and a percentage. You retrieve a new RGB color.

You do not need todo anything with the ColorSelect frame. You just want it for its inherited color calculation functions.

---update-----

Fixed the drycode.

Lua Code:
  1. --colorselect frame
  2.     local CS = CreateFrame("ColorSelect")
  3.      
  4.     --get smudge color func
  5.     function CS:GetSmudgeColorRGB(colorA, colorB, perc)
  6.       --get hsv color for colorA
  7.       self:SetColorRGB(colorA.r,colorA.g,colorA.b)
  8.       local h1, s1, v1 = self:GetColorHSV() --radius, saturation, luminance
  9.       --get hsv color for colorB
  10.       self:SetColorRGB(colorB.r,colorB.g,colorB.b)
  11.       local h2, s2, v2 = self:GetColorHSV() --radius, saturation, luminance
  12.       --calculate new HSV values based on HSV values from colorA and colorB and multiply them by the perc
  13.       local h3 = floor(h1-(h1-h2)*perc)
  14.       --check if the angle between the two H values is > 180
  15.       if abs(h1-h2) > 180 then
  16.         local radius = (360-abs(h1-h2))*perc/100
  17.         --calculate the 360° breakpoint
  18.         if h1 < h2 then
  19.           h3 = floor(h1-radius)
  20.           if h3 < 0 then
  21.             h3 = 360+h3
  22.           end
  23.         else
  24.           h3 = floor(h1+radius)
  25.           if h3 > 360 then
  26.             h3 = h3-360
  27.           end
  28.         end
  29.       end  
  30.       local s3 = s1-(s1-s2)*perc
  31.       local v3 = v1-(v1-v2)*perc
  32.       --get the RGB values of the new color
  33.       self:SetColorHSV(h3, s3, v3)
  34.       local r,g,b = self:GetColorRGB()
  35.       --return the new color
  36.       return {r=r,g=g,b=b}
  37.     end
  38.      
  39.     --call
  40.     local color = CS:GetSmudgeColorRGB({r=1,g=0,b=0}, {r=0,g=1,b=1}, 0.8)

You still can optimize this by outsourcing the HSV color calculations of colorA and colorB. Thus you can call the function directly with HSV color values.

That way it can be shortened to:
lua Code:
  1. --get smudge color func
  2. function CS:GetSmudgeColorHSV(colorA, colorB, perc)
  3.   local h1, s1, v1 = colorA.h, colorA.s, colorA.v
  4.   local h2, s2, v2 = colorB.h, colorB.s, colorB.v
  5.   --calculate new HSV values based on HSV values from colorA and colorB and multiply them by the perc
  6.   local h3 = floor(h1-(h1-h2)*perc)
  7.   --check if the angle between the two H values is > 180
  8.       if abs(h1-h2) > 180 then
  9.         local radius = (360-abs(h1-h2))*perc/100
  10.         --calculate the 360° breakpoint
  11.         if h1 < h2 then
  12.           h3 = floor(h1-radius)
  13.           if h3 < 0 then
  14.             h3 = 360+h3
  15.           end
  16.         else
  17.           h3 = floor(h1+radius)
  18.           if h3 > 360 then
  19.             h3 = h3-360
  20.           end
  21.         end
  22.       end  
  23.   local s3 = s1-(s1-s2)*perc
  24.   local v3 = v1-(v1-v2)*perc
  25.   --return the new hsv color
  26.   return h3,s3,v3
  27. end

If you do not care about the 360° breakpoint the function is even shorter
lua Code:
  1. --get smudge color func
  2. function CS:GetSmudgeColorHSV(colorA, colorB, perc)
  3.   local h1, s1, v1 = colorA.h, colorA.s, colorA.v
  4.   local h2, s2, v2 = colorB.h, colorB.s, colorB.v
  5.   return floor(h1-(h1-h2)*perc), s1-(s1-s2)*perc, v1-(v1-v2)*perc
  6. end
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 09-27-13 at 09:23 AM.
  Reply With Quote
09-27-13, 03:02 AM   #17
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
I really appreciate your work here Zork (as always).

This is one of those threads that should be thrown into the Tutorials & Other Helpful Info.

Last edited by suicidalkatt : 09-27-13 at 03:02 AM. Reason: formatting
  Reply With Quote
09-27-13, 09:24 AM   #18
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Final functions:
Lua Code:
  1. --color lib
  2. local CS = CreateFrame("ColorSelect")
  3.  
  4. --ConvertColorRgbToHsv
  5. function ConvertColorRgbToHsv(color)
  6.   CS:SetColorRGB(color.r, color.g, color.b)
  7.   local h,s,v = CS:GetColorHSV()
  8.   return {h=h,s=s,v=v}
  9. end
  10.  
  11. --ConvertColorHsvToRgb
  12. function ConvertColorHsvToRgb(color)
  13.   CS:SetColorHSV(color.h, color.s, color.v)
  14.   local r,g,b = CS:GetColorRGB()
  15.   return {r=r,g=g,b=b}
  16. end
  17.  
  18. --CalculateNewColor
  19. function CalculateNewColor(colorA,colorB,percentage)
  20.   local colorC = {}
  21.   --check if the angle between the two H values is > 180
  22.   if abs(colorA.h-colorB.h) > 180 then
  23.     local angle = (360-abs(colorA.h-colorB.h))*percentage
  24.     if colorA.h < colorB.h then
  25.       colorC.h = floor(colorA.h-angle)
  26.       if colorC.h < 0 then
  27.         colorC.h = 360+colorC.h
  28.       end
  29.     else
  30.       colorC.h = floor(colorA.h+angle)
  31.       if colorC.h > 360 then
  32.         colorC.h = colorC.h-360
  33.       end
  34.     end
  35.   else
  36.     colorC.h = floor(colorA.h-(colorA.h-colorB.h)*percentage)
  37.   end    
  38.   colorC.s = colorA.s-(colorA.s-colorB.s)*percentage
  39.   colorC.v = colorA.v-(colorA.v-colorB.v)*percentage
  40.   return colorC
  41. end
  42.  
  43. --GetSmudgeColor
  44. function GetSmudgeColor(colorA,colorB,percentage)
  45.   if colorA.r then
  46.     return ConvertColorHsvToRgb(CalculateNewColor(ConvertColorRgbToHsv(colorA),ConvertColorRgbToHsv(colorB),percentage))
  47.   elseif colorA.h then
  48.     return CalculateNewColor(colorA,colorB,percentage)  
  49.   end
  50.   return nil
  51. end
  52.  
  53. --function call
  54. local color = GetSmudgeColor({r=1,g=0,b=0}, {r=0,g=1,b=0}, 0.5)
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 10-22-13 at 02:06 AM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Color to Color smooth transition.


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off