cmn65
|
  |
| Joined: 07 May 2011 |
| Total Posts: 84 |
|
|
| 12 Oct 2014 01:35 PM |
So I have been trying to figure out how to do this for a while, but I haven't found anything helpful.
Anyways; I am trying to make the TextLabel's TextColor [smoothly] transition though the color 3 values. Such as starting at red, going to orange, then to yellow, to green, blue, purple, blue, then back to red.
Anyone have any ideas?
You can see an example of this in "Stop It, Slender!"(Link: http://www.roblox.com/Stop-it-Slender-place?id=30869879)
Thanks for your help! ~Cmn65 |
|
|
| Report Abuse |
|
|
cmn65
|
  |
| Joined: 07 May 2011 |
| Total Posts: 84 |
|
|
| 12 Oct 2014 01:36 PM |
| By the example, I do mean the ball's Humanoid names in the Lobby |
|
|
| Report Abuse |
|
|
cmn65
|
  |
| Joined: 07 May 2011 |
| Total Posts: 84 |
|
| |
|
cmn65
|
  |
| Joined: 07 May 2011 |
| Total Posts: 84 |
|
| |
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 16 Oct 2014 06:09 PM |
Lol uhm...
For loop and figuring out which arguments for the Color3 scale to change c;
What sucks about Roblox's Color wheel is that it's RGB(Red Green Blue) when in reality it's RBY(Red Blue Yellow). So I don't know how to combine color values to make another color.. Red + Yellow = Orange nsuch' |
|
|
| Report Abuse |
|
|
Amexurous
|
  |
| Joined: 28 Jan 2014 |
| Total Posts: 324 |
|
|
| 16 Oct 2014 06:22 PM |
s = script.Parent color3 = {Color3.new(0, 0, 0), Color3.new(255, 255, 255)}
local rc = 1 local gc = 1 local bc = 1
local r = coroutine.wrap(function() for i = color3[1].r, color3[2].r, 1 do wait() rc = i/255 end end)
local g = coroutine.wrap(function() for i = color3[1].g, color3[2].g, 1 do wait() gc = i/255 end end)
local b = coroutine.wrap(function() for i = color3[1].b, color3[2].b, 1 do wait() bc = i/255 end end)
r() g() b()
while wait() do s.BackgroundColor3 = Color3.new(rc, gc, bc) print(rc, gc, bc) end
|
|
|
| Report Abuse |
|
|
Amexurous
|
  |
| Joined: 28 Jan 2014 |
| Total Posts: 324 |
|
|
| 16 Oct 2014 06:25 PM |
| s is the gui, if i didnt clarify |
|
|
| Report Abuse |
|
|
Amexurous
|
  |
| Joined: 28 Jan 2014 |
| Total Posts: 324 |
|
|
| 16 Oct 2014 06:27 PM |
| @goulstem, Yes, with paint. Monitors are only capable of producing blue, green and red lights. They are packed tightly together to get different color illusions. try putting a little drop of water on your screen and you'll see. |
|
|
| Report Abuse |
|
|
|
| 16 Oct 2014 06:28 PM |
| That is pretty gross how you have that much code just to transition three color three values.. |
|
|
| Report Abuse |
|
|
Amexurous
|
  |
| Joined: 28 Jan 2014 |
| Total Posts: 324 |
|
| |
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 16 Oct 2014 07:45 PM |
Well nobody uses lerp :(
-- Yes, vector3's and between 0 and 255, not 0 and 1. You'll see why local start = Vector3.new(0, 0, 0); local end = Vector3.new(255, 255, 255);
for alpha = 0, 1, 0.1 do -- 0.1 means percent increment per iteration local offset = start:Lerp(end, alpha); object.TextColor3 = Color3.new(offset.X/255, offset.Y/255, offset.Z/255); wait(0.1); end
idk |
|
|
| Report Abuse |
|
|
tinarg
|
  |
| Joined: 18 Jun 2010 |
| Total Posts: 4925 |
|
|
| 16 Oct 2014 07:46 PM |
This is something I'm using for my games. It phases through almost all the color3 colors perpetually:
a = 0 b = 0 c = 0
while wait(0.15) do
a = a + 0.1 b = b + 0.05 c = c + 0.025
script.Parent.BackgroundColor3 = Color3.new((255-(math.sin(a)*60))/255,(255-(math.sin(b)*60))/255,(255-(math.sin(c)*60))/255)
end
Put it in a local script directly as a child from the GUI object you want to phase |
|
|
| Report Abuse |
|
|
Amexurous
|
  |
| Joined: 28 Jan 2014 |
| Total Posts: 324 |
|
| |
|
|
| 16 Oct 2014 08:27 PM |
Or wait until ROBLOX wants to add lerp to colors so that you don't have silly things like extra objects clogging up memory or die that'll probably happen first
or
local oldCnew = Color3.new local Color3 = {} Color3.new = oldCnew function Color3:Lerp(to, a) return oldCnew(self.r * (1-a) + to.r * a, self.g * (1-a) + to.g * a, self.b * (1-a) + to.b * a) end
lol does that even work
~Upload code to codepad-dot-org with Lua syntax highlighting to preserve indentation and make it easier to read!~ |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 16 Oct 2014 08:29 PM |
| Well just set those variables to nil and the GC will handle that for you :) |
|
|
| Report Abuse |
|
|
|
| 16 Oct 2014 08:32 PM |
@Goul since when is there RBY? I've never heard of it. Computers use RGB.
In reality it is RGB, not RBY. I think you are thinking of paints and such. Light is ALWAYS RGB, and it is NOT just Roblox. EVERYTHING on the computer uses RGB. |
|
|
| Report Abuse |
|
|
|
| 16 Oct 2014 08:34 PM |
But I thought he was talking about cycling through hues. I've always used open-source HSV to RGB converters, pasted, and set the saturation to 1 and value to .5. Then you loop through 359 and get all of the colors. |
|
|
| Report Abuse |
|
|
|
| 17 Oct 2014 01:39 PM |
gc is gross and we're not friends also light isn't made up of those three colors btw, but you have cones in your eye that look for those three colors and kinda interpolate between wavelengths
~Upload code to codepad-dot-org with Lua syntax highlighting to preserve indentation and make it easier to read!~ |
|
|
| Report Abuse |
|
|
|
| 17 Oct 2014 01:39 PM |
I meant me and the gc aren't friends we can still love cnt
~Upload code to codepad-dot-org with Lua syntax highlighting to preserve indentation and make it easier to read!~ |
|
|
| Report Abuse |
|
|