(Created page with "The SColor class represents RGBA colors. =Members= {{ScriptFunction|static SColor|New|{float r, float g, float b, float a}|Create a color by red, green, blue and alpha parame...") |
|||
Line 2: | Line 2: | ||
=Members= | =Members= | ||
− | {{ScriptFunction| | + | {{ScriptFunction|SColor|New|{float r, float g, float b, float a}|Create a color by red, green, blue and alpha parameters.|5= |
''--create a cube and set a new material.''<br> | ''--create a cube and set a new material.''<br> | ||
''--add ScriptingRuntime.''<br> | ''--add ScriptingRuntime.''<br> | ||
Line 10: | Line 10: | ||
}} | }} | ||
− | {{ScriptFunction| | + | {{ScriptFunction|SColor|FromHex|{string hex}|Create a color by Hex value.|5= |
''--create a cube and set a new material.''<br> | ''--create a cube and set a new material.''<br> | ||
''--add ScriptingRuntime.''<br> | ''--add ScriptingRuntime.''<br> | ||
Line 39: | Line 39: | ||
}} | }} | ||
− | {{ScriptFunction| | + | {{ScriptFunction|string|ToString|(SColor other);|Returns the RGBA value of the current color.|5= |
Space.Log(Color.Red.ToString())<br> | Space.Log(Color.Red.ToString())<br> | ||
''--print "[1,0,0,1]".'' | ''--print "[1,0,0,1]".'' |
The SColor class represents RGBA colors.
Create a color by red, green, blue and alpha parameters.
--add ScriptingRuntime.
local mat=Space.Host.ExecutingObject.Renderer.Material;
mat.SetColor("_Color",Color.New(0,0,1,1))
Create a color by Hex value.
--add ScriptingRuntime.
local mat=Space.Host.ExecutingObject.Renderer.Material;
mat.SetColor("_Color",Color.FromHex("FF0000"))
Return the Hex value of the color.
Linearly interpolates between current color and b by t.
--add ScriptingRuntime.
local mat=Space.Host.ExecutingObject.Renderer.Material
function ChangeColor()
mat.SetColor("_Color",Color.Red.Lerp(Color.Blue,Space.Math.PingPong(Space.Time,1)))
end
Returns true if colors are same.
Space.Log(colorR.Equals(Color.Red))
Returns the RGBA value of the current color.
Solid black. RGBA is (0, 0, 0, 1).
--add ScriptingRuntime.
local mat=Space.Host.ExecutingObject.Renderer.Material;
mat.SetColor("_Color",Color.Black)
Solid White. RGBA is (1, 1, 1, 1).
--add ScriptingRuntime.
local mat=Space.Host.ExecutingObject.Renderer.Material;
mat.SetColor("_Color",Color.White)
Solid Red. RGBA is (1, 0, 0, 1).
--add ScriptingRuntime.
local mat=Space.Host.ExecutingObject.Renderer.Material;
mat.SetColor("_Color",Color.Red)
Solid Blue. RGBA is (0, 0, 1, 1).
--add ScriptingRuntime.
local mat=Space.Host.ExecutingObject.Renderer.Material;
mat.SetColor("_Color",Color.Blue)
Solid Green. RGBA is (0, 1, 0, 1).
--add ScriptingRuntime.
local mat=Space.Host.ExecutingObject.Renderer.Material;
mat.SetColor("_Color",Color.Green)
Yellow. RGBA is (1, 0.92, 0.016, 1).
--add ScriptingRuntime.
local mat=Space.Host.ExecutingObject.Renderer.Material;
mat.SetColor("_Color",Color.Yellow)
|