|
| 02 Jan 2016 03:40 PM |
This makes it change to the desired colour before becoming white. Any ideas?
function _G.tweenColor(colour, colour2, amount) local col1 = Vector3.new(colour.r, colour.g, colour.b) local col2 = Vector3.new(colour2.r, colour2.g, colour2.b) return col1:lerp(col2, amount) end
I input: for i = 0, 1, .01 do local newcolor = _G.tweenColor(color, endcolor, i) image.BackgroundColor3 = Color3.new(newcolor.X, newcolor.Y, newcolor.Z) wait() print(newcolor) end |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 02 Jan 2016 03:43 PM |
| What's wrong with it? It becomes white when it shouldn't or? It looks fine, me assuming color and endcolor are constant throughout the loop. |
|
|
| Report Abuse |
|
|
|
| 02 Jan 2016 03:45 PM |
| This particular issue can be solved using the solution to this particular issue which isn't vague at all and is definitely specified. |
|
|
| Report Abuse |
|
|
|
| 02 Jan 2016 03:46 PM |
I input these values: local endcolor = Color3.new(97, 95, 30) local endcolor2 = Color3.new(0, 0, 0)
And get this: 24735, 24225, 7650 |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 02 Jan 2016 03:49 PM |
Color3.new takes numbers between 0 and 1, so in your case: local endcolor = Color3.new(97/255, 95/255, 30/255)
|
|
|
| Report Abuse |
|
|
|
| 02 Jan 2016 04:07 PM |
Don't use Vector3's, that is so much unneeded.
When I looked up "Ninjas" in Thesaurus.com, it said "Ninja's can't be found" Well played Ninjas, well played. |
|
|
| Report Abuse |
|
|
|
| 02 Jan 2016 04:59 PM |
Thanks cnt!
How come, Unstable? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 02 Jan 2016 05:00 PM |
| You're creating an awful amount of objects, it's pretty hefty but it shouldn't really be much of a problem (for now). |
|
|
| Report Abuse |
|
|
|
| 02 Jan 2016 05:02 PM |
| Oh alright. What would you do? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 02 Jan 2016 05:05 PM |
| Well creating at least 1 new object every time is inevitable. I wouldn't create 3 Vector3s and a new Color3 every iteration, I'd probably just get the r g b values directly and only create a single new Color3 every iteration. |
|
|
| Report Abuse |
|
|
|
| 02 Jan 2016 06:04 PM |
Just make your own lerp function, because like cntkillme said, (and I would have said, had I been online, and was implying), you are creating lots of objects.
function lerp(a,b,t) return a+t*(v-a) end
If I remembered the formula correctly, that should work.
When I looked up "Ninjas" in Thesaurus.com, it said "Ninja's can't be found" Well played Ninjas, well played. |
|
|
| Report Abuse |
|
|
|
| 02 Jan 2016 06:05 PM |
Ah, made a mistake. Better change the v to a b if you want it to work :P
When I looked up "Ninjas" in Thesaurus.com, it said "Ninja's can't be found" Well played Ninjas, well played. |
|
|
| Report Abuse |
|
|