# SAudioReactiveLight

## Index

### Properties Index

| Property Name                                       |
| --------------------------------------------------- |
| bool [**Enabled** ](#enabled)`get` `set`            |
| SLight [**Target** ](#target)`get` `set`            |
| bool [**Range** ](#range)`get` `set`                |
| float [**MinRange** ](#minrange)`get` `set`         |
| float [**MaxRange** ](#maxrange)`get` `set`         |
| bool [**AnimateColor** ](#animatecolor)`get` `set`  |
| SColor [**MinColor** ](#mincolor)`get` `set`        |
| SColor [**MaxColor** ](#maxcolor)`get` `set`        |
| bool [**Intensity** ](#intensity)`get` `set`        |
| float [**MinIntensity** ](#minintensity)`get` `set` |
| float [**MaxIntensity** ](#maxintensity)`get` `set` |

## Properties

### Enabled

bool **Enabled** `get` `set`

*Returns true if the Audio Reactive Light Enabled.*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.AudioReactiveLight.Enabled = true
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--clicking this object will Enable/Disable it's Audio Reactive Light component
thisGameObject = Space.Host.ExecutingObject
component = thisGameObject.AudioReactiveLight


OnClick = function()
component.Enabled =  not component.Enabled
end


thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)
```

{% endtab %}
{% endtabs %}

### Target

SLight **Target** `get` `set`

*Returns true if the light target Enabled.*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.AudioReactiveLight.Target = false
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--clicking the object will toggle between two different AudioReactiveLight targets
--[Add "light1" and "light2" reference to the Scripting Runtime component]

thisGameObject = Space.Host.ExecutingObject
light1 = Space.Host.GetReference("light1").Light
light2 = Space.Host.GetReference("light2").Light


OnClick = function()
if thisGameObject.AudioReactiveLight.Target == light1 then
  thisGameObject.AudioReactiveLight.Target = light2
else
  thisGameObject.AudioReactiveLight.Target = light1
end

end



thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)
```

{% endtab %}
{% endtabs %}

### Range

bool **Range** `get` `set`

*Returns true if Range Enabled.*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.AudioReactiveLight.Range = false
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--the below script will make the object toggle it's AudioReactiveLight's Range property
--[Add "arlight" reference to the Scripting Runtime component]

thisGameObject = Space.Host.ExecutingObject
arlight = Space.Host.GetReference("arlight").AudioReactiveLight


OnClick = function()
arlight.Range=  not arlight.Range
end


thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)
```

{% endtab %}
{% endtabs %}

### MinRange

float **MinRange** `get` `set`

*Returns MinRange value of the Audio Reactive Light.*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.AudioReactiveLight.MinRange = 0.5
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--the below script will make a slider set the Audio Reactive Light's MinRange
--[Add "slider" and "arlight" references to the Scripting Runtime component]

arlight = Space.Host.GetReference("arlight").AudioReactiveLight
slider = Space.Host.GetReference("slider").UISlider
 

OVC = function()
arlight.MinRange = (slider.Value * 9) + 1 --(from 1 to 10)
end

slider.OnValueChanged(OVC)
```

{% endtab %}
{% endtabs %}

### MaxRange

float **MaxRange** `get` `set`

*Returns MaxRange value of the Audio Reactive Light.*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.AudioReactiveLight.MaxRange = 1
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--the below script will make a slider set the Audio Reactive Light's MaxRange
--[Add "slider" and "arlight" references to the Scripting Runtime component]

arlight = Space.Host.GetReference("arlight").AudioReactiveLight
slider = Space.Host.GetReference("slider").UISlider
 

OVC = function()
arlight.MaxRange= (slider.Value * 10) + 10 --(from 10 to 20)
end

slider.OnValueChanged(OVC)
```

{% endtab %}
{% endtabs %}

### AnimateColor

bool **AnimateColor** `get` `set`

*Returns true if AnimateColor Enabled.*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.AudioReactiveLight.AnimateColor = false
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--the below script will make the object Enable/Disable it's AudioReactiveLight's AnimateColor property
--[Add "arlight" reference to the Scripting Runtime component]

thisGameObject = Space.Host.ExecutingObject
arlight = Space.Host.GetReference("arlight").AudioReactiveLight


OnClick = function()
arlight.AnimateColor =  not arlight.AnimateColor
end


thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)
```

{% endtab %}
{% endtabs %}

### MinColor

[SColor](https://docs.sine.space/scripting/client-scripting-api-reference/types/scolor) **MinColor** `get` `set`

*Returns MinColor value of the Audio Reactive Light.*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.AudioReactiveLight.MinColor  = Color.Red
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--clicking the object will open a color picker that changes AudioReactiveLight's MinColor
--[Add "arlight" reference to the Scripting Runtime component]

thisGameObject = Space.Host.ExecutingObject
arlight = Space.Host.GetReference("arlight").AudioReactiveLight
originalColor = nil

OnChange = function(SColor) 
 arlight.MinColor = SColor
end

OnSelect = function(SColor)
 arlight.MinColor = SColor
end

OnCancel = function()
 arlight.MinColor = originalColor
end

OnClick = function()
originalColor = arlight.MinColor
Space.Dialogues.ColorPicker("Pick a color","Ok", OnChange, OnSelect, OnCancel, originalColor)
end


thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)
```

{% endtab %}
{% endtabs %}

### MaxColor

[SColor](https://docs.sine.space/scripting/client-scripting-api-reference/types/scolor) **MaxColor** `get` `set`

*Returns MaxColor value of the Audio Reactive Light.*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.AudioReactiveLight.MaxColor = Color.Blue
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--clicking the object will open a color picker that changes AudioReactiveLight's MaxColor
--[Add "arlight" reference to the Scripting Runtime component]

thisGameObject = Space.Host.ExecutingObject
arlight = Space.Host.GetReference("arlight").AudioReactiveLight
originalColor = nil

OnChange = function(SColor) 
 arlight.MaxColor= SColor
end

OnSelect = function(SColor)
 arlight.MaxColor= SColor
end

OnCancel = function()
 arlight.MaxColor= originalColor
end

OnClick = function()
originalColor = arlight.MaxColor
Space.Dialogues.ColorPicker("Pick a color","Ok", OnChange, OnSelect, OnCancel, originalColor)
end


thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)
```

{% endtab %}
{% endtabs %}

### Intensity

bool **Intensity** `get` `set`

*Returns true if Intensity Enabled.*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.AudioReactiveLight.Intensity = false
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--the below script will make the object Enable/Disable it's AudioReactiveLight's Intensity property
--[Add "arlight" reference to the Scripting Runtime component]

thisGameObject = Space.Host.ExecutingObject
arlight = Space.Host.GetReference("arlight").AudioReactiveLight


OnClick = function()
arlight.Intensity =  not arlight.Intensity
end


thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)
```

{% endtab %}
{% endtabs %}

### MinIntensity

float **MinIntensity** `get` `set`

*Returns MinIntensity value of the Audio Reactive Light.*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.AudioReactiveLight.MinIntensity = 0.2
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--the below script will make a slider set the Audio Reactive Light's MinIntensity
--[Add "slider" and "arlight" references to the Scripting Runtime component]

arlight = Space.Host.GetReference("arlight").AudioReactiveLight
slider = Space.Host.GetReference("slider").UISlider
 

OVC = function()
arlight.MinIntensity= (slider.Value * 1) --(from 0 to 1)
end

slider.OnValueChanged(OVC)
```

{% endtab %}
{% endtabs %}

### MaxIntensity

float **MaxIntensity** `get` `set`

*Returns MaxIntensity value of the Audio Reactive Light.*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.AudioReactiveLight.MaxIntensity = 0.8
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--the below script will make a slider set the Audio Reactive Light's MaxIntensity
--[Add "slider" and "arlight" references to the Scripting Runtime component]

arlight = Space.Host.GetReference("arlight").AudioReactiveLight
slider = Space.Host.GetReference("slider").UISlider
 

OVC = function()
arlight.MaxIntensity= (slider.Value * 2) + 1 --(from 1 to 3)
end

slider.OnValueChanged(OVC)
```

{% endtab %}
{% endtabs %}

### GameObject

[SGameObject](https://docs.sine.space/scripting/client-scripting-api-reference/types/sgameobject) **GameObject** `get`

*Returns a reference to the GameObject of this component.*

{% tabs %}
{% tab title="Lua" %}

```lua
theGameObject = Space.Host.ExecutingObject.AudioReactiveLight.GameObject
```

{% endtab %}
{% endtabs %}
