spotLight2D
spotLight2D(
surfacePos,lightPos,lightDir,lightColor?,intensity?,distance?,innerAngle?,outerAngle?):Light2DResult
Defined in: packages/nodes/src/lighting/lights.ts:83
Calculate 2D spot light contribution with cone falloff.
Parameters
Section titled “Parameters”surfacePos
Section titled “surfacePos”Position of the surface being lit
lightPos
Section titled “lightPos”Position of the light source
lightDir
Section titled “lightDir”Direction the spotlight is pointing (normalized vec2)
lightColor?
Section titled “lightColor?”Vec3Input = ...
Light color
intensity?
Section titled “intensity?”FloatInput = 1
Light intensity
distance?
Section titled “distance?”FloatInput = 100
Maximum light distance
innerAngle?
Section titled “innerAngle?”FloatInput = 0.3
Inner cone angle in radians (full intensity)
outerAngle?
Section titled “outerAngle?”FloatInput = 0.6
Outer cone angle in radians (falloff to zero)
Returns
Section titled “Returns”Light2DResult with cone attenuation applied
Example
Section titled “Example”const spot = spotLight2D(fragPos, [100, 100], [0, -1], [1, 1, 0.9], 1.5, 150, 0.3, 0.6)