|
| 08 Sep 2016 07:47 PM |
I'm looking for a function, that returns with a new Color3 value that is LIGHTER than the old one.
For example, I have a 'Dark yellow' Color3, that I put in the function. RGB Stuff (code I need) Ends up with a 'Lime yellow' Color3.
Ideas? I couldn't find anything. |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 08 Sep 2016 07:57 PM |
Lighter? Increasing all the values proportionally should work If this doesn't work, don't be surprised.
r,g,b = 0,0,0 -- change these to your RGB value, reference it if preexisting percent = 10/100 -- this will be 10% lighter destination = Color3.new(r*percent,g*percent,b*percent)
for i = 1,0,0.01 do Frame.BackgroundColor3:lerp(destination, i) wait() end
|
|
|
| Report Abuse |
|
|
|
| 08 Sep 2016 07:58 PM |
| Lerp is a member of Color3 now too? |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 08 Sep 2016 08:00 PM |
| Keep in mind r,g,b should be values between 0 and 1 unless you change the destination to Color3.fromRGB() |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 08 Sep 2016 08:02 PM |
I think I made a mistake.
for i = 1,0,0.01 do Frame.BackgroundColor3 = Frame.BackgroundColor3:lerp(destination, i) wait() end |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2016 08:09 PM |
no you either lerp from
Start to End or you lerp from the actual until you reach the final
BackgroundColor3 = Start:lerp(End,alpha)
or loop this until it reaches the color
BackgroundColor3 = BackgroundColor3:lerp(End,1/100) --1/100 changes speed |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2016 08:15 PM |
| Your code didn't do anything, any other ideas? |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2016 08:16 PM |
read what i said
the equation for lerping a number is
function lerp(Start,End,Alpha) return Start + (End-Start)*Alpha end |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2016 08:17 PM |
so if you have 2 numbers: (example)
1 and you want it to go to 3
lerp(1,3,0) is 1 lerp(1,3,1) is 3 lerp(1,3,0.5) is 2
and when you do Color3:lerp(End,Alpha)
the color3 you start with will be lerped like in my function |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2016 08:18 PM |
| @thedailyblarg - Your code did something, but didn't do what I wanted at all. |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2016 08:20 PM |
and if you lerp the color that you already have, this happens:
lerp(1,3,0.25) == 1.5 lerp(1.5,3,0.25) == 1.875 lerp(1.875,3,0.25) == 2.15625
--this happens
so if you want it to work the best:
local Start = object.BackgroundColor3 for i=0,20 do object.BackgroundColor3 = Start:lerp(EndColor3,i/20) wait() end |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2016 08:22 PM |
| EndColor3 doesn't exist though. That's what I am trying to get. |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2016 08:23 PM |
"EndColor3 doesnt exist though" because it is obviously the ending color 3 -.- |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2016 08:27 PM |
| I want to make the color LIGHTER. - I want this to work with ANY color. I DON'T have the ending color, BECAUSE THAT IS WHAT I AM TRYING TO FIGURE OUT. |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2016 08:27 PM |
if you want it to be smoother you could attempt to slerp but you would have to do each r,g,b manually since there is not a function for it
function slerp(Start,End,Alpha) return Start + (End-Start)*(-math.cos(Alpha*math.pi)/2+0.5) end |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2016 08:28 PM |
| That's like doing an equation, a + b, when A = null. |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2016 08:28 PM |
| Read the OP you ignorant fool. |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2016 08:28 PM |
and if you want to make it lighter then simply multiply or add to the color3, it isnt rocket science. the more white you have, the lighter it is. and white is 255,255,255 so adding any equal color3 will add a shade of white to it |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2016 08:29 PM |
| and learn math you ignorant fool if you dont know how to add a shade of white then you must have a ###### ####### |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2016 08:30 PM |
| Let's pretend, I have the RGB: 70, 70, 70. I add ten to each. Oh wait, it's the same color as before. -.- |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2016 08:30 PM |
Blarg is dumb and self-advertising.
local Parent = script.Parent
for Index = 1, 10 do local Color = Parent.BackgroundColor3 Parent.BackgroundColor3 = Color3.new((Color.r - 1), (Color.g - 1), (Color.b - 1)) wait() end
Try that. |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2016 08:31 PM |
lmao this kid is truly an idiot
Color3.fromRGB(100,100,100) ~= Color3.fromRGB(120,120,120) |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2016 08:31 PM |
@Tillo Whoops, my bad. That makes it instantly go black.
for Index = 1, 10 do local Color = Parent.BackgroundColor3 Parent.BackgroundColor3 = Color3.new((Color.r - 0.001), (Color.g - 0.001), (Color.b - 0.001)) wait() end
Change the parent, color getting edited, and amount it goes by. Also change the - to a + if you want it to go lighter. This was just an example; btw sorry I failed the first time. |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2016 08:32 PM |
| if you want to make something brighter you would obviously raise the amount of r g and b |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2016 08:32 PM |
| YES, IT DOES. LEARN YOUR COLORS. |
|
|
| Report Abuse |
|
|