wiki.sine.space | sinespace

Difference between revisions of "Scripting/SAudioReactiveLight"

From wiki.sine.space
Jump to: navigation, search
Line 25: Line 25:
 
{{ScriptFunction|bool|Range|{get; set;}|Returns true if Range Enabled.|5=  
 
{{ScriptFunction|bool|Range|{get; set;}|Returns true if Range Enabled.|5=  
 
local Object = Space.Scene.Find("Audio Source")<br>
 
local Object = Space.Scene.Find("Audio Source")<br>
Space.Log(Object.AudioReactiveLight.Range)
+
Space.Log(Object.AudioReactiveLight.Range)|6=<pre>--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)</pre>
 
}}
 
}}
  
 
{{ScriptFunction|float|MinRange|{get; set;}|Returns MinRange value of the Audio Reactive Light.|5=  
 
{{ScriptFunction|float|MinRange|{get; set;}|Returns MinRange value of the Audio Reactive Light.|5=  
 
local Object = Space.Scene.Find("Audio Source")<br>
 
local Object = Space.Scene.Find("Audio Source")<br>
Space.Log(Object.AudioReactiveLight.MinRange)
+
Space.Log(Object.AudioReactiveLight.MinRange)|6=<pre>--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)</pre>
 
}}
 
}}
  
 
{{ScriptFunction|float|MaxRange|{get; set;}|Returns MaxRange value of the Audio Reactive Light.|5=  
 
{{ScriptFunction|float|MaxRange|{get; set;}|Returns MaxRange value of the Audio Reactive Light.|5=  
 
local Object = Space.Scene.Find("Audio Source")<br>
 
local Object = Space.Scene.Find("Audio Source")<br>
Space.Log(Object.AudioReactiveLight.MaxRange)
+
Space.Log(Object.AudioReactiveLight.MaxRange)|6=<pre>--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)</pre>
 
}}
 
}}
  
 
{{ScriptFunction|bool|AnimateColor|{get; set;}|Returns true if AnimateColor Enabled.|5=  
 
{{ScriptFunction|bool|AnimateColor|{get; set;}|Returns true if AnimateColor Enabled.|5=  
 
local Object = Space.Scene.Find("Audio Source")<br>
 
local Object = Space.Scene.Find("Audio Source")<br>
Space.Log(Object.AudioReactiveLight.AnimateColor)
+
Space.Log(Object.AudioReactiveLight.AnimateColor)|6=<pre>--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)</pre>
 
}}
 
}}
  
Line 55: Line 103:
 
{{ScriptFunction|bool|Intensity|{get; set;}|Returns true if Intensity Enabled.|5=  
 
{{ScriptFunction|bool|Intensity|{get; set;}|Returns true if Intensity Enabled.|5=  
 
local Object = Space.Scene.Find("Audio Source")<br>
 
local Object = Space.Scene.Find("Audio Source")<br>
Space.Log(Object.AudioReactiveLight.Intensity)
+
Space.Log(Object.AudioReactiveLight.Intensity)|6=<pre>--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)</pre>
 
}}
 
}}
  
Line 61: Line 122:
 
{{ScriptFunction|float|MinIntensity|{get; set;}|Returns MinIntensity value of the Audio Reactive Light.|5=  
 
{{ScriptFunction|float|MinIntensity|{get; set;}|Returns MinIntensity value of the Audio Reactive Light.|5=  
 
local Object = Space.Scene.Find("Audio Source")<br>
 
local Object = Space.Scene.Find("Audio Source")<br>
Space.Log(Object.AudioReactiveLight.MinIntensity)
+
Space.Log(Object.AudioReactiveLight.MinIntensity)|6=<pre>--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)</pre>
 
}}
 
}}
  
 
{{ScriptFunction|float|MaxIntensity|{get; set;}|Returns MaxIntensity value of the Audio Reactive Light.|5=  
 
{{ScriptFunction|float|MaxIntensity|{get; set;}|Returns MaxIntensity value of the Audio Reactive Light.|5=  
 
local Object = Space.Scene.Find("Audio Source")<br>
 
local Object = Space.Scene.Find("Audio Source")<br>
Space.Log(Object.AudioReactiveLight.MaxIntensity)
+
Space.Log(Object.AudioReactiveLight.MaxIntensity)|6=<pre>--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)</pre>
 
}}
 
}}
  

Revision as of 09:13, 20 December 2021

Properties

Enabled

bool Enabled {get; set;}

Returns true if the Audio Reactive Light Enabled.

local Object = Space.Scene.Find("Audio Source")

Space.Log(Object.AudioReactiveLight.Enabled)

-- print true.


--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)

Target

SLight Target {get; set;}

Returns true if the light target Enabled.

local Object = Space.Scene.Find("Audio Source")
Space.Log(Object.AudioReactiveLight.Target.Enabled)


Range

bool Range {get; set;}

Returns true if Range Enabled.

local Object = Space.Scene.Find("Audio Source")
Space.Log(Object.AudioReactiveLight.Range)


--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)

MinRange

float MinRange {get; set;}

Returns MinRange value of the Audio Reactive Light.

local Object = Space.Scene.Find("Audio Source")
Space.Log(Object.AudioReactiveLight.MinRange)


--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)

MaxRange

float MaxRange {get; set;}

Returns MaxRange value of the Audio Reactive Light.

local Object = Space.Scene.Find("Audio Source")
Space.Log(Object.AudioReactiveLight.MaxRange)


--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)

AnimateColor

bool AnimateColor {get; set;}

Returns true if AnimateColor Enabled.

local Object = Space.Scene.Find("Audio Source")
Space.Log(Object.AudioReactiveLight.AnimateColor)


--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)

MinColor

SColor MinColor {get; set;}

Returns MinColor value of the Audio Reactive Light.

local Object = Space.Scene.Find("Audio Source")
Space.Log(Object.AudioReactiveLight.MinColor)


MaxColor

SColor MaxColor {get; set;}

Returns MaxColor value of the Audio Reactive Light.

local Object = Space.Scene.Find("Audio Source")
Space.Log(Object.AudioReactiveLight.MaxColor)


Intensity

bool Intensity {get; set;}

Returns true if Intensity Enabled.

local Object = Space.Scene.Find("Audio Source")
Space.Log(Object.AudioReactiveLight.Intensity)


--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)


MinIntensity

float MinIntensity {get; set;}

Returns MinIntensity value of the Audio Reactive Light.

local Object = Space.Scene.Find("Audio Source")
Space.Log(Object.AudioReactiveLight.MinIntensity)


--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)

MaxIntensity

float MaxIntensity {get; set;}

Returns MaxIntensity value of the Audio Reactive Light.

local Object = Space.Scene.Find("Audio Source")
Space.Log(Object.AudioReactiveLight.MaxIntensity)


--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)