generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Color3 Lerping?

Previous Thread :: Next Thread 
TilloFernandez is not online. TilloFernandez
Joined: 21 Mar 2015
Total Posts: 273
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 is not online. 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
RemasteredBox is not online. RemasteredBox
Joined: 19 Jun 2016
Total Posts: 2140
08 Sep 2016 07:58 PM
Lerp is a member of Color3 now too?
Report Abuse
Soybeen is not online. 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 is not online. 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
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
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
TilloFernandez is not online. TilloFernandez
Joined: 21 Mar 2015
Total Posts: 273
08 Sep 2016 08:15 PM
Your code didn't do anything, any other ideas?
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
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
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
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
TilloFernandez is not online. TilloFernandez
Joined: 21 Mar 2015
Total Posts: 273
08 Sep 2016 08:18 PM
@thedailyblarg - Your code did something, but didn't do what I wanted at all.
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
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
TilloFernandez is not online. TilloFernandez
Joined: 21 Mar 2015
Total Posts: 273
08 Sep 2016 08:22 PM
EndColor3 doesn't exist though. That's what I am trying to get.
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
08 Sep 2016 08:23 PM
"EndColor3 doesnt exist though"
because it is obviously the ending color 3 -.-
Report Abuse
TilloFernandez is not online. TilloFernandez
Joined: 21 Mar 2015
Total Posts: 273
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
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
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
TilloFernandez is not online. TilloFernandez
Joined: 21 Mar 2015
Total Posts: 273
08 Sep 2016 08:28 PM
That's like doing an equation, a + b, when A = null.
Report Abuse
TilloFernandez is not online. TilloFernandez
Joined: 21 Mar 2015
Total Posts: 273
08 Sep 2016 08:28 PM
Read the OP you ignorant fool.
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
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
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
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
TilloFernandez is not online. TilloFernandez
Joined: 21 Mar 2015
Total Posts: 273
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
RemasteredBox is not online. RemasteredBox
Joined: 19 Jun 2016
Total Posts: 2140
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
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
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
RemasteredBox is not online. RemasteredBox
Joined: 19 Jun 2016
Total Posts: 2140
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
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
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
TilloFernandez is not online. TilloFernandez
Joined: 21 Mar 2015
Total Posts: 273
08 Sep 2016 08:32 PM
YES, IT DOES. LEARN YOUR COLORS.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image