CheaterJoin Date: 2007-06-29 Post Count: 5258 |
How the title says, I'm trying to create a script that changes the colors slowly from yellow to green and back again. My problem is finding out how to use all the color functions (Color3, etc.). I'm really confused now. Can you just tell me how you would add a tiny part of green and remove a tiny part of yellow?
Example:
We have the color numbered like that 255/0/0 (so red basicly). Now I wanna add one to make it green and remove one of the red. So then it will be 254/1/0. That's the only thing I wanna find out, how to do that.
I would be glad for your help. (Ik it is some sort of request) |
|
heheJoin Date: 2007-09-11 Post Count: 387 |
If you want to change a brick's color then you would use BrickColor.new().
And you would use brickcolor codes, numbers or words work.
http://wiki.roblox.com/index.php/Color_Codes
Ex.
brick = game.Workspace:findFirstChild("Part")
while wait() do
brick.BrickColor = BrickColor.new("Bright yellow")
wait(1)
brick.BrickColor = BrickColor.new("Bright green")
end |
|
C0D3YJoin Date: 2010-07-24 Post Count: 1692 |
My guess would be using a for statement that adds and subtracts from certain things... Not exactly sure if it would work or not though. |
|
CheaterJoin Date: 2007-06-29 Post Count: 5258 |
Next time read better.
I don't wanna change a bricks color AT ONCE from yellow to green or whatever. I wanna change it slowly (I think I'll use the while true do than). So it looks like it slowly changes to yellow. Like first it is regular green, than it looks like a light green, than it looks like a green yellow and than it looks like a light yellow and so on. |
|
CheaterJoin Date: 2007-06-29 Post Count: 5258 |
I meant hehe with the message above. |
|
nate890Join Date: 2008-11-22 Post Count: 21686 |
Liek dis?
*Youtube "Colour Spectrum :o" 4th video*
"Bro five! Wear this to let everyone know you think they deserve a high five." |
|
CheaterJoin Date: 2007-06-29 Post Count: 5258 |
Just with a brick. |
|
nate890Join Date: 2008-11-22 Post Count: 21686 |
Use this and change VertexColor (Vector3)
http://www.roblox.com/Free-Color-Brick-item?id=17090474
"Bro five! Wear this to let everyone know you think they deserve a high five." |
|
stravantForum ModeratorJoin Date: 2007-10-22 Post Count: 2893 |
Then you have to use an ugly BlockMesh.
If it doesn't have to be perfect then you can use BrickColor.new(Color3.new( r, g, b )) to get the nearest BrickColor to a given r/g/b triplet. |
|
RiderjJoin Date: 2011-08-15 Post Count: 1534 |
I would just get the RGB colors of green and yellow then do something like this:
for i=1,0,-.1 do
Workspace.Brick.BrickColor = BrickColor.new(Color3.new(yellowR*i,YellowG*i,YellowB*i))
end
Using this simple outline you can achieve such a task.
[[ 7/10 - Scripting| 4/10 - Building | 10/10 - Confused ]] |
|
RiderjJoin Date: 2011-08-15 Post Count: 1534 |
Forgot a wait above my end :o
Edit:
for i=1,0,-.1 do
Workspace.Brick.BrickColor = BrickColor.new(Color3.new((yellowR/255)*i,(YellowG/255)*i,(YellowB/255)*i))
wait()
end
[[ 7/10 - Scripting| 4/10 - Building | 10/10 - Confused ]] |
|
CheaterJoin Date: 2007-06-29 Post Count: 5258 |
Oh right, BlockMesh has these numbers.
Thx stravant. (xLEGOx, whatever)
I'll try it and if I can't make it or I'm just too stupid for that I'll post again. |
|
nate890Join Date: 2008-11-22 Post Count: 21686 |
If you wanted to complete a whole colour spectrum, like me, you can get a colour spectrum formula.
"Bro five! Wear this to let everyone know you think they deserve a high five." |
|
CheaterJoin Date: 2007-06-29 Post Count: 5258 |
I can change the VertexColor to whatever I want to in a BlockMesh. It does't change the color at all. Am I doing something wrong or forgeting anything? |
|
CheaterJoin Date: 2007-06-29 Post Count: 5258 |
Does nobody know? I think someone does. |
|
AgentFirefoxTop 100 PosterJoin Date: 2008-06-20 Post Count: 22404 |
function colorTransition(Part, NewColor, Time, Steps)
Time = Time or 1
Steps = Steps or 5
local cr, cg, cb = Part.BrickColor.r, Part.BrickColor.g, Part.BrickColor.b
local dr, dg, db = NewColor.r - cr, NewColor.g - cg, NewColor.b - cb
local sr, sg, sb = dr/Steps, dg/Steps, db/Steps
for i = 1, Steps do
cr, cg, cb = cr + sr, cg + sg, cb + sb
Part.BrickColor = BrickColor.new( Color3.new(cr, cg, cb) )
wait(Time/Steps)
end
end
--- EXAMPLES ---
colorTransition(script.Parent, BrickColor.new("Really red"), 10, 20)
colorTransition(script.Parent, BrickColor.new("Bright violet"), 5)
colorTransition(script.Parent, BrickColor.new("Camo")) |
|
|
You could also try to have a brick welded at the same part then have it the first color and slowly take away its transparency. |
|