SpotLight SpotLight SpotLight Class

Definition

A light source that casts inner and outer cones of light. For example, a flashlight.

public : sealed class SpotLight : CompositionLight, ISpotLight, ISpotLight2
public sealed class SpotLight : CompositionLight, ISpotLight, ISpotLight2
Public NotInheritable Class SpotLight Inherits CompositionLight Implements ISpotLight, ISpotLight2
Inheritance
Attributes
Windows 10 requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

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.

LightDescription
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

Comment Comment Comment

Inherited from CompositionObject

Compositor Compositor Compositor

Inherited from CompositionObject

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
Value
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:

1/(Constant+Linear*(Distance/100)+Quadratic*(Distance/100)*(Distance/100))

See Also

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
Value
Visual Visual Visual

The visual the light's offset is relative to.

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-axis runs from the left edge to the right edge of the visual.  Y-axis runs from the top of the visual to the bottom.  Z-axis is perpandicular to the visual.

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

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

Dispatcher Dispatcher Dispatcher

Inherited from CompositionObject

DispatcherQueue DispatcherQueue DispatcherQueue

Inherited from CompositionObject

ExclusionsFromTargets ExclusionsFromTargets ExclusionsFromTargets

Inherited from CompositionLight

ImplicitAnimations ImplicitAnimations ImplicitAnimations

Inherited from CompositionObject

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

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
Value
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.

InnerConeColor InnerConeColor InnerConeColor

Color of the spotlight's inner cone. Animatable.

public : Color InnerConeColor { get; set; }
public Color InnerConeColor { get; set; }
Public ReadWrite Property InnerConeColor As Color
Value
Color Color Color

Color of the spotlight's inner cone.

InnerConeIntensity InnerConeIntensity InnerConeIntensity

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
Value
float float float

The intensity of the light.

Additional features and requirements
Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

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
Value
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:

1/(Constant+Linear*(Distance/100)+Quadratic*(Distance/100)*(Distance/100))

See Also

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

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

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

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
Value
Color Color Color

The color of the spotlight's outer cone.

OuterConeIntensity OuterConeIntensity OuterConeIntensity

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
Value
float float float

The intensity of the light.

Additional features and requirements
Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

Properties Properties Properties

Inherited from CompositionObject

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
Value
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:

1/(Constant+Linear*(Distance/100)+Quadratic*(Distance/100)*(Distance/100))

See Also

Targets Targets Targets

Inherited from CompositionLight

Methods

Close Close Close

Inherited from CompositionObject

StartAnimation(String,CompositionAnimation) StartAnimation(String,CompositionAnimation) StartAnimation(String,CompositionAnimation)

Inherited from CompositionObject

StartAnimationGroup(ICompositionAnimationBase) StartAnimationGroup(ICompositionAnimationBase) StartAnimationGroup(ICompositionAnimationBase)

Inherited from CompositionObject

StopAnimation(String) StopAnimation(String) StopAnimation(String)

Inherited from CompositionObject

StopAnimationGroup(ICompositionAnimationBase) StopAnimationGroup(ICompositionAnimationBase) StopAnimationGroup(ICompositionAnimationBase)

Inherited from CompositionObject

See Also