SpotLight
SpotLight
SpotLight
SpotLight
Class
Definition
Some information relates to pre-released product which may be substantially modified before it’s commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Prerelease APIs are identified by a Prerelease label.
[Contains prerelease APIs.]
A light source that casts inner and outer cones of light. For example, a flashlight.
public : sealed class SpotLight : CompositionLight, ISpotLight, ISpotLight2public sealed class SpotLight : CompositionLight, ISpotLight, ISpotLight2Public NotInheritable Class SpotLight Inherits CompositionLight Implements ISpotLight, ISpotLight2// This API is not available in Javascript.
- Inheritance
-
SpotLightSpotLightSpotLightSpotLight
- Attributes
| Device family |
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v3)
|
Inherited Members
Inherited methods
Inherited properties
Examples
_spotLight = _compositor.CreateSpotLight();
_spotLight.CoordinateSpace = root;
_spotLight.InnerConeAngleInDegrees = 30;
_spotLight.InnerConeColor = Colors.Red;
_spotLight.OuterConeAngleInDegrees = 45;
_spotLight.OuterConeColor = Colors.Yellow;
_spotLight.Offset = new Vector3(30, 30, 200);
_spotLight.Targets.Add(root);
Remarks
SpotLight is one of the four light types derived from CompositionLight.
| Light | Description |
|---|---|
| AmbientLight | A light source that emits non directional light that appears to have been reflected by everything in the scene. |
| DistantLight | An infinitely large distant light source that emits light in a single direction. |
| PointLight | A point source of light that emits light in all directions. |
| SpotLight | A light source that emits inner and outer cones of light. |
Note
A Visual cannot be targeted by more than two non-ambient lights (PointLight, SpotLight or DistantLight).
Properties
ConstantAttenuation ConstantAttenuation ConstantAttenuation ConstantAttenuation
The constant coefficient in the light's attenuation equation. Controls light intensity. Animatable.
public : float ConstantAttenuation { get; set; }public float ConstantAttenuation { get; set; }Public ReadWrite Property ConstantAttenuation As float// This API is not available in Javascript.
- Value
- float float float float
The constant coefficient in the light's attenuation equation. Controls light intensity. Range is from 0 to infinity.
Examples
_spotLight.ConstantAttenuation =1;
Remarks
The SpotLight.ConstantAttenuation property is part of the attenuation equation which also includes SpotLight.LinearAttenuation and SpotLight.QuadraticAttenuation:

- See Also
CoordinateSpace CoordinateSpace CoordinateSpace CoordinateSpace
The Visual used to determine the light's direction and offset. The light's offset and direction properties are relative to this Visual's coordinate space. SpotLight.CoordinateSpace is a required property. If SpotLight.CoordinateSpace is not set, the SpotLight will not render.
public : Visual CoordinateSpace { get; set; }public Visual CoordinateSpace { get; set; }Public ReadWrite Property CoordinateSpace As Visual// This API is not available in Javascript.
Examples
_spotLight.CoordinateSpace = root;
Remarks
SpotLight.Offset and@Windows.UI.Composition.SpotLight.Direction?text= SpotLight.Direction are relative to Spotlight.CoordiateSpace . Every Visual has an implicit 3D coordinate space, defined in this way:

X direction is from left to right. Y direction is from top to bottom. Z direction is pointing out of the plane. The original point of this coordinate is the upper-left corner of the visual, and the unit is DIP. A light’s offset and direction are defined in this coordinate.
- See Also
Direction Direction Direction Direction
The direction in which the light is pointing, specified relative to its CoordinateSpace Visual.
public : Vector3 Direction { get; set; }public Vector3 Direction { get; set; }Public ReadWrite Property Direction As Vector3// This API is not available in Javascript.
- Value
- Vector3 Vector3 Vector3 Vector3
The direction in which the light is pointing, specified relative to its coordinate space Visual.
Examples
_spotLight.Direction = new Vector3(4, 10, 0);
Remarks
SpotLight.Direction is relative to SpotLight.CoordinateSpace.
- See Also
InnerConeAngle InnerConeAngle InnerConeAngle InnerConeAngle
The SpotLight’s inner cone angle, expressed as a semi-vertical angle in radians. Animatable.
public : float InnerConeAngle { get; set; }public float InnerConeAngle { get; set; }Public ReadWrite Property InnerConeAngle As float// This API is not available in Javascript.
- Value
- float float float float
The SpotLight’s inner cone angle, expressed as a semi-vertical angle in radians.
Examples
_spotLight.InnerConeAngle = (float)(Math.PI/3);
Remarks
InnerConeAngle is not bound to OuterConeAngle and can be greater than OuterConeAngle.
InnerConeAngleInDegrees InnerConeAngleInDegrees InnerConeAngleInDegrees InnerConeAngleInDegrees
The SpotLight’s inner cone angle, expressed as a semi-vertical angle in degrees. Animatable.
public : float InnerConeAngleInDegrees { get; set; }public float InnerConeAngleInDegrees { get; set; }Public ReadWrite Property InnerConeAngleInDegrees As float// This API is not available in Javascript.
- Value
- float float float float
The SpotLight’s inner cone angle, expressed as a semi-vertical angle in degrees.
Examples
_spotLight.InnerConeAngleInDegrees = 30;
Remarks
InnerConeAngleInDegrees is not bound to OuterConeAngleInDegrees and can be greater than OuterConeAngleInDegrees.
InnerConeIntensity InnerConeIntensity InnerConeIntensity InnerConeIntensity
Prerelease. Gets or sets the intensity of the light in the spotlight's inner cone.
public : float InnerConeIntensity { get; set; }public float InnerConeIntensity { get; set; }Public ReadWrite Property InnerConeIntensity As float// This API is not available in Javascript.
- Value
- float float float float
The intensity of the light.
| Device family |
Windows 10 Insider Preview (introduced v10.0.16257.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v5)
|
LinearAttenuation LinearAttenuation LinearAttenuation LinearAttenuation
The linear coefficient in the light's attenuation equation that determines how the light falls off with distance. Animatable.
public : float LinearAttenuation { get; set; }public float LinearAttenuation { get; set; }Public ReadWrite Property LinearAttenuation As float// This API is not available in Javascript.
- Value
- float float float float
The linear coefficient in the light's attenuation equation that determines how the light falls off with distance. Range is from 0 to infinity.
Examples
_spotLight.LinearAttenuation = .14F;
Remarks
The SpotLight.LinearAttenuation property is part of the attenuation equation which also contains SpotLight.ConstantAttenuation and SpotLight.QuadraticAttenuation:

- See Also
Offset Offset Offset Offset
Offset of the light source relative to its CoordinateSpace Visual. Animatable.
public : Vector3 Offset { get; set; }public Vector3 Offset { get; set; }Public ReadWrite Property Offset As Vector3// This API is not available in Javascript.
- Value
- Vector3 Vector3 Vector3 Vector3
Offset of the light source relative to its coordinate space Visual.
Examples
_spotLight.Offset = new Vector3(30, 30, 200);
Remarks
SpotLight.Offset is relative to SpotLight.CoordinateSpace.
- See Also
OuterConeAngle OuterConeAngle OuterConeAngle OuterConeAngle
The SpotLight’s outer cone angle, expressed as a semi-vertical angle in radians. Animatable.
public : float OuterConeAngle { get; set; }public float OuterConeAngle { get; set; }Public ReadWrite Property OuterConeAngle As float// This API is not available in Javascript.
- Value
- float float float float
The SpotLight’s outer cone angle, expressed as a semi-vertical angle in radians. The value must be between 0 and pi.
Examples
_spotLight.OuterConeAngle = (float)(Math.PI/2);
Remarks
Light emitted from a spotlight is made up of a bright inner cone and a larger outer cone, with the light intensity diminishing between the two.
**OuterConeAngle**
is not bound to InnerConeAngle parameters.
OuterConeAngleInDegrees OuterConeAngleInDegrees OuterConeAngleInDegrees OuterConeAngleInDegrees
The semi-vertical angle, in degrees, of the SpotLight's outer cone. Animatable.
public : float OuterConeAngleInDegrees { get; set; }public float OuterConeAngleInDegrees { get; set; }Public ReadWrite Property OuterConeAngleInDegrees As float// This API is not available in Javascript.
- Value
- float float float float
The semi-vertical angle, in degrees, of the SpotLight's outer cone.
Remarks
Light emitted from a spotlight is made up of a bright inner cone and a larger outer cone, with the light intensity diminishing between the two.
OuterConeColor OuterConeColor OuterConeColor OuterConeColor
The color of the spotlight's outer cone. Animatable.
public : Color OuterConeColor { get; set; }public Color OuterConeColor { get; set; }Public ReadWrite Property OuterConeColor As Color// This API is not available in Javascript.
OuterConeIntensity OuterConeIntensity OuterConeIntensity OuterConeIntensity
Prerelease. Gets or sets the intensity of the light in the spotlight's outer cone.
public : float OuterConeIntensity { get; set; }public float OuterConeIntensity { get; set; }Public ReadWrite Property OuterConeIntensity As float// This API is not available in Javascript.
- Value
- float float float float
The intensity of the light.
| Device family |
Windows 10 Insider Preview (introduced v10.0.16257.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v5)
|
QuadraticAttenuation QuadraticAttenuation QuadraticAttenuation QuadraticAttenuation
The quadratic portion of the attenuation equation that determines how the light falls off with distance. Animatable.
public : float QuadraticAttenuation { get; set; }public float QuadraticAttenuation { get; set; }Public ReadWrite Property QuadraticAttenuation As float// This API is not available in Javascript.
- Value
- float float float float
The quadratic coefficient in the light's attenuation equation. Controls light intensity falloff based on distance squared. Range is from 0 to infinity.
Examples
_spotLight.QuadraticAttenuation = .0007F;
Remarks
The SpotLight.QuadraticAttenuation property is part of the attenuation equation which also includes SpotLight.LinearAttenuation and SpotLight.ConstantAttenuation:

- See Also