autodoc_client_functions
JO Functions > jo.light.create()
Creates a new light with the given properties <br>
JO Functions > jo.light.create() > Syntax
jo.light.create(coords, intensity, rgb, range, ease)
JO Functions > jo.light.create() > Parameters
coords : vector3
The position where the light will be created
intensity : float <BadgeOptional />
The light intensity from 0.0 to 1.0 - default:1.0
rgb : table <BadgeOptional />
RGB color values as a table {r,g,b} - default:
{255, 160, 122}
range : float <BadgeOptional />
The range/radius of the light - default:10.0
ease : float <BadgeOptional />
Transition time in milliseconds - default:1000
JO Functions > jo.light.create() > Return Value
Type : LightClass
The created light object
JO Functions > jo.light.create() > Example
-- Create a red light at coordinates (100, 200, 30)
local myLight = jo.light.create(
vec3(100.0, 200.0, 30.0), -- position
0.8, -- intensity
{ 255, 0, 0 }, -- RGB (red)
10.0, -- range
500 -- ease time (ms)
)
LightClass Methods > LightClass:delete()
Marks a light for deletion and starts fading it out <br>
LightClass Methods > LightClass:delete() > Syntax
LightClass:delete()
LightClass Methods > LightClass:delete() > Example
-- Create a light
local myLight = jo.light.create(vec3(100.0, 200.0, 30.0))
-- Later, remove the light with a fade-out effect
myLight:delete()
LightClass Methods > LightClass:setCoords()
Sets new target coordinates for the light <br>
LightClass Methods > LightClass:setCoords() > Syntax
LightClass:setCoords(coords)
LightClass Methods > LightClass:setCoords() > Parameters
coords : vector3
The new target position
LightClass Methods > LightClass:setCoords() > Example
local myLight = jo.light.create(vec3(100.0, 200.0, 30.0))
-- Move the light to a new position with smooth transition
myLight:setCoords(vec3(110.0, 210.0, 35.0))
LightClass Methods > LightClass:setIntensity()
Sets new target intensity for the light <br>
LightClass Methods > LightClass:setIntensity() > Syntax
LightClass:setIntensity(intensity)
LightClass Methods > LightClass:setIntensity() > Parameters
intensity : float
The new target intensity from 0.0 to 1.0
LightClass Methods > LightClass:setIntensity() > Example
local myLight = jo.light.create(vec3(100.0, 200.0, 30.0))
-- Dim the light to half brightness
myLight:setIntensity(0.5)
LightClass Methods > LightClass:update()
Updates the light properties based on elapsed time <br>
LightClass Methods > LightClass:update() > Syntax
LightClass:update(deltaTime)
LightClass Methods > LightClass:update() > Parameters
deltaTime : float
Time elapsed since last update in ms
LightClass Methods > LightClass:update() > Example
-- Note: This method is generally used internally
-- but can be called manually if needed
local myLight = jo.light.create(vec3(100.0, 200.0, 30.0))
myLight:update(16) -- Update with 16ms delta time