blimp80
|
  |
| Joined: 22 May 2011 |
| Total Posts: 278 |
|
|
| 16 Mar 2016 12:22 PM |
Is there a way to transition a color3 value rather than just changing it? Like fading from 0,0,0 to 255,255,255? And also, can you give color3 a brickcolor value? Like changing fog color to "Black"? |
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
|
| 16 Mar 2016 12:26 PM |
Here's my module for color transitions: http://www.roblox.com/Color-Transitioning-Global-Function-item?id=358436403
And BrickColors have something called 'Color' so you can do this:
brickcolor.Color
Which returns the Color3 version of the brickcolor. I think. |
|
|
| Report Abuse |
|
|
ByDefault
|
  |
| Joined: 25 Jul 2014 |
| Total Posts: 3197 |
|
|
| 16 Mar 2016 12:41 PM |
@62GB
You over complicated that a lot
I wrote my own in 10 lines lol |
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
|
| 16 Mar 2016 12:46 PM |
| You and I are different persons. Shush. |
|
|
| Report Abuse |
|
|
blimp80
|
  |
| Joined: 22 May 2011 |
| Total Posts: 278 |
|
|
| 16 Mar 2016 01:11 PM |
So basically, there is no simple way to have OutdoorAmbient smoothly transition as the time of day changes? If there is, please tell me. Seriously just like a repeat-until will be fine... |
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
| |
|
blimp80
|
  |
| Joined: 22 May 2011 |
| Total Posts: 278 |
|
|
| 16 Mar 2016 01:26 PM |
And I looked at it. Just seems like there should be a simpler, more efficient way |
|
|
| Report Abuse |
|
|
Locard
|
  |
| Joined: 13 Apr 2014 |
| Total Posts: 3516 |
|
|
| 16 Mar 2016 01:29 PM |
function Color3alpha(c1, c2, a) return Color3.new(c1.r + (c2.r - c1.r) * a, c1.g + (c2.g - c1.g) * a, c1.b + (c2.b - c1.b) * a) end
c1 being the first Color3 value, c2 being the second one, and 'a' being a number between 0 and 1.
0 would give you c1, 1 would give you c2, and .5 would give you halfway between the two. You can have 'a' be any number between 0 and 1 though.
Have fun! |
|
|
| Report Abuse |
|
|
blimp80
|
  |
| Joined: 22 May 2011 |
| Total Posts: 278 |
|
| |
|
blimp80
|
  |
| Joined: 22 May 2011 |
| Total Posts: 278 |
|
|
| 16 Mar 2016 02:11 PM |
Okay, so what about making it fade to another color? That function just gives me a color in between 2 colors. I want to perform arithmetic on a color3 value. Instead of
ambient = Color3.new(0,0,0) wait() ambient = Color3.new(1/255,1/255,1/255) wait() ambient = Color3.new(2/255,2/255,2/255) wait() so on....
I want to say
ambient = ambient + Color3.new(1/255,1/255,1/255) until ambient is 255/255,255/255,255/255
but I cannot do that. Is there another way? |
|
|
| Report Abuse |
|
|
|
| 16 Mar 2016 02:18 PM |
| You should be able to use Locard's code, and just increment 'a' within a loop as quickly or slowly as you want. |
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
|
| 16 Mar 2016 02:48 PM |
for i = 0,1,.05 do Color3Alpha() wait() end |
|
|
| Report Abuse |
|
|
Locard
|
  |
| Joined: 13 Apr 2014 |
| Total Posts: 3516 |
|
|
| 16 Mar 2016 03:03 PM |
62GB You'll never get to 1 using that sadly due to floating point precision errors. :( It only goes up to
Try this:
for i = 0,100,5 do --Changed to whole numbers, which will definitely get to 100 Color3alpha(color3,color3,i*.01) wait() end
Should take roughly 2/3 + 1/30 second(s) to complete the coloring phase. |
|
|
| Report Abuse |
|
|
Locard
|
  |
| Joined: 13 Apr 2014 |
| Total Posts: 3516 |
|
|
| 16 Mar 2016 03:04 PM |
It only goes up to .95 *
Forgot I was typing a sentence there. |
|
|
| Report Abuse |
|
|