Sinespace Client  2023.2.17543
Client-side scripting for Sinespace
SineSpace.Scripting.Types.SColor Struct Reference
Inheritance diagram for SineSpace.Scripting.Types.SColor:

Public Member Functions

 SColor (float r, float g, float b, float a)
 Creates a color from red, green, blue and alpha parameters. More...
 
string ToHex ()
 Returns the Hex value of the color. More...
 
 SColor (float r, float g, float b)
 Creates a color from red, green, and blue parameters. Alpha is assumed to be fully opaque. More...
 
SColor Lerp (SColor b, float t)
 Linearly interpolates between current color and b by t. More...
 
bool Equals (SColor other)
 Returns true if the colors are same. More...
 
override string ToString ()
 Returns a string RGBA value of current color More...
 

Static Public Member Functions

static SColor New (float r, float g, float b, float a)
 Creates a color from red, green, blue and alpha parameters. More...
 
static SColor FromHex (string hex)
 Creates a color from Hex value More...
 

Public Attributes

float R
 
float G
 
float B
 
float A
 

Properties

SColor Black [get]
 Solid black. RGBA is (0, 0, 0, 1). More...
 
SColor White [get]
 Solid White. RGBA is (1, 1, 1, 1). More...
 
SColor Red [get]
 Solid Red. RGBA is (1, 0, 0, 1). More...
 
SColor Blue [get]
 Solid Blue. RGBA is (0, 0, 1, 1). More...
 
SColor Green [get]
 Solid Green. RGBA is (0, 1, 0, 1). More...
 
SColor Yellow [get]
 Yellow. RGBA is (1, 0.92, 0.016, 1), but the color is nice to look at! More...
 

Constructor & Destructor Documentation

◆ SColor() [1/2]

SineSpace.Scripting.Types.SColor.SColor ( float  r,
float  g,
float  b,
float  a 
)

Creates a color from red, green, blue and alpha parameters.

Parameters
r
g
b
a

◆ SColor() [2/2]

SineSpace.Scripting.Types.SColor.SColor ( float  r,
float  g,
float  b 
)

Creates a color from red, green, and blue parameters. Alpha is assumed to be fully opaque.

Parameters
r
g
b

Member Function Documentation

◆ Equals()

bool SineSpace.Scripting.Types.SColor.Equals ( SColor  other)

Returns true if the colors are same.

Parameters
otherAnother color you want to compare
local colorR=Color.New(1,0,0,1)
Space.Log(colorR.Equals(Color.Red))
–Print "true"

◆ FromHex()

static SColor SineSpace.Scripting.Types.SColor.FromHex ( string  hex)
static

Creates a color from Hex value

Parameters
hexHex value
–Create a cube and set a new material to it
–Add ScriptingRuntime on it
local mat=Space.Host.ExecutingObject.Renderer.Material
mat.SetColor("_Color",Color.FromHex("FF0000"))
–The cube will turn to red

◆ Lerp()

SColor SineSpace.Scripting.Types.SColor.Lerp ( SColor  b,
float  t 
)

Linearly interpolates between current color and b by t.

Parameters
bColor b.
tFloat for combining a and b.
–Create a cube and set a new material to it
–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
Space.Host.ExecutingObject.OnUpdate(ChangeColor)

◆ New()

static SColor SineSpace.Scripting.Types.SColor.New ( float  r,
float  g,
float  b,
float  a 
)
static

Creates a color from red, green, blue and alpha parameters.

Parameters
rRed
gGreen
bBlue
aAlpha
–Create a cube and set a new material to it
–Add ScriptingRuntime on it
local mat=Space.Host.ExecutingObject.Renderer.Material
mat.SetColor("_Color",Color.New(0,0,1,1))
–The cube will turn to blue

◆ ToHex()

string SineSpace.Scripting.Types.SColor.ToHex ( )

Returns the Hex value of the color.

Space.Log(Color.Red.ToHex())
–Print "FF0000"

◆ ToString()

override string SineSpace.Scripting.Types.SColor.ToString ( )

Returns a string RGBA value of current color

Space.Log(Color.Red.ToString())
–Print "[1,0,0,1]"

Member Data Documentation

◆ A

float SineSpace.Scripting.Types.SColor.A

◆ B

float SineSpace.Scripting.Types.SColor.B

◆ G

float SineSpace.Scripting.Types.SColor.G

◆ R

float SineSpace.Scripting.Types.SColor.R

Property Documentation

◆ Black

SColor SineSpace.Scripting.Types.SColor.Black
get

Solid black. RGBA is (0, 0, 0, 1).

–Create a cube and set a new material to it
–Add ScriptingRuntime on it
local mat=Space.Host.ExecutingObject.Renderer.Material
mat.SetColor("_Color",Color.Black)
–The cube will turn to black

◆ Blue

SColor SineSpace.Scripting.Types.SColor.Blue
get

Solid Blue. RGBA is (0, 0, 1, 1).

–Create a cube and set a new material to it
–Add ScriptingRuntime on it
local mat=Space.Host.ExecutingObject.Renderer.Material
mat.SetColor("_Color",Color.Blue)
–The cube will turn to Blue

◆ Green

SColor SineSpace.Scripting.Types.SColor.Green
get

Solid Green. RGBA is (0, 1, 0, 1).

–Create a cube and set a new material to it
–Add ScriptingRuntime on it
local mat=Space.Host.ExecutingObject.Renderer.Material
mat.SetColor("_Color",Color.Green)
–The cube will turn to Green

◆ Red

SColor SineSpace.Scripting.Types.SColor.Red
get

Solid Red. RGBA is (1, 0, 0, 1).

–Create a cube and set a new material to it
–Add ScriptingRuntime on it
local mat=Space.Host.ExecutingObject.Renderer.Material
mat.SetColor("_Color",Color.Red)
–The cube will turn to Red

◆ White

SColor SineSpace.Scripting.Types.SColor.White
get

Solid White. RGBA is (1, 1, 1, 1).

–Create a cube and set a new material to it
–Add ScriptingRuntime on it
local mat=Space.Host.ExecutingObject.Renderer.Material
mat.SetColor("_Color",Color.White)
–The cube will turn to White

◆ Yellow

SColor SineSpace.Scripting.Types.SColor.Yellow
get

Yellow. RGBA is (1, 0.92, 0.016, 1), but the color is nice to look at!

–Create a cube and set a new material to it
–Add ScriptingRuntime on it
local mat=Space.Host.ExecutingObject.Renderer.Material
mat.SetColor("_Color",Color.Yellow)
–The cube will turn to Yellow
SineSpace.Scripting.Types.SColor.White
SColor White
Solid White. RGBA is (1, 1, 1, 1).
Definition: SColor.cs:196
SineSpace.Scripting.Types.SColor.Lerp
SColor Lerp(SColor b, float t)
Linearly interpolates between current color and b by t.
Definition: SColor.cs:109
SineSpace.Scripting.Types.SColor.Red
SColor Red
Solid Red. RGBA is (1, 0, 0, 1).
Definition: SColor.cs:213
SineSpace.Scripting.Types.SColor.Green
SColor Green
Solid Green. RGBA is (0, 1, 0, 1).
Definition: SColor.cs:247
SineSpace.Scripting.Types.SColor.Yellow
SColor Yellow
Yellow. RGBA is (1, 0.92, 0.016, 1), but the color is nice to look at!
Definition: SColor.cs:264
SineSpace.Scripting.Types.SColor.Blue
SColor Blue
Solid Blue. RGBA is (0, 0, 1, 1).
Definition: SColor.cs:230