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, ISpotLight2
struct winrt::Windows::UI::Composition::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 Comment

A string to associate with the CompositionObject.

(Inherited from CompositionObject)
Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

Compositor Compositor Compositor Compositor

The Compositor used to create this CompositionObject.

(Inherited from CompositionObject)

ConstantAttenuation ConstantAttenuation ConstantAttenuation ConstantAttenuation

The constant coefficient in the light's attenuation equation. Controls light intensity. Animatable.

public : float ConstantAttenuation { get; set; }
float ConstantAttenuation(); void ConstantAttenuation(float constantattenuation);
public float ConstantAttenuation { get; set; }
Public ReadWrite Property ConstantAttenuation As float
Value
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 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; }
Visual CoordinateSpace(); void CoordinateSpace(Visual coordinatespace);
public Visual CoordinateSpace { get; set; }
Public ReadWrite Property CoordinateSpace As Visual
Value
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 Direction

The direction in which the light is pointing, specified relative to its CoordinateSpace Visual.

public : Vector3 Direction { get; set; }
Vector3 Direction(); void Direction(Vector3 direction);
public Vector3 Direction { get; set; }
Public ReadWrite Property Direction As Vector3
Value
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 Dispatcher

The dispatcher for the CompositionObject.

(Inherited from CompositionObject)

DispatcherQueue DispatcherQueue DispatcherQueue DispatcherQueue

Gets the DispatcherQueue for the CompostionObject.

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

ExclusionsFromTargets ExclusionsFromTargets ExclusionsFromTargets ExclusionsFromTargets

Gets a collection of Visuals that are not targeted by the light.

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

ImplicitAnimations ImplicitAnimations ImplicitAnimations ImplicitAnimations

The collection of implicit animations attached to this object.

(Inherited from CompositionObject)
Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

InnerConeAngle InnerConeAngle InnerConeAngle InnerConeAngle

The SpotLight’s inner cone angle, expressed as a semi-vertical angle in radians. Animatable.

public : float InnerConeAngle { get; set; }
float InnerConeAngle(); void InnerConeAngle(float innerconeangle);
public float InnerConeAngle { get; set; }
Public ReadWrite Property InnerConeAngle As float
Value
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; }
float InnerConeAngleInDegrees(); void InnerConeAngleInDegrees(float innerconeangleindegrees);
public float InnerConeAngleInDegrees { get; set; }
Public ReadWrite Property InnerConeAngleInDegrees As float
Value
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 InnerConeColor

Color of the spotlight's inner cone. Animatable.

public : Color InnerConeColor { get; set; }
Color InnerConeColor(); void InnerConeColor(Color innerconecolor);
public Color InnerConeColor { get; set; }
Public ReadWrite Property InnerConeColor As Color
Value
Color Color

Color of the spotlight's inner cone.

InnerConeIntensity InnerConeIntensity InnerConeIntensity InnerConeIntensity

Gets or sets the intensity of the light in the spotlight's inner cone.

public : float InnerConeIntensity { get; set; }
float InnerConeIntensity(); void InnerConeIntensity(float innerconeintensity);
public float InnerConeIntensity { get; set; }
Public ReadWrite Property InnerConeIntensity As float
Value
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)

IsEnabled IsEnabled IsEnabled IsEnabled

Prerelease.

(Inherited from CompositionLight)
Additional features and requirements
Device family
Windows 10 Insider Preview (introduced v10.0.17095.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v6)

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; }
float LinearAttenuation(); void LinearAttenuation(float linearattenuation);
public float LinearAttenuation { get; set; }
Public ReadWrite Property LinearAttenuation As float
Value
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

MaxAttenuationCutoff MaxAttenuationCutoff MaxAttenuationCutoff MaxAttenuationCutoff

Prerelease.

public : float MaxAttenuationCutoff { get; set; }
float MaxAttenuationCutoff(); void MaxAttenuationCutoff(float maxattenuationcutoff);
public float MaxAttenuationCutoff { get; set; }
Public ReadWrite Property MaxAttenuationCutoff As float
Value
float float
Additional features and requirements
Device family
Windows 10 Insider Preview (introduced v10.0.17095.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v6)

MinAttenuationCutoff MinAttenuationCutoff MinAttenuationCutoff MinAttenuationCutoff

Prerelease.

public : float MinAttenuationCutoff { get; set; }
float MinAttenuationCutoff(); void MinAttenuationCutoff(float minattenuationcutoff);
public float MinAttenuationCutoff { get; set; }
Public ReadWrite Property MinAttenuationCutoff As float
Value
float float
Additional features and requirements
Device family
Windows 10 Insider Preview (introduced v10.0.17095.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v6)

Offset Offset Offset Offset

Offset of the light source relative to its CoordinateSpace Visual. Animatable.

public : Vector3 Offset { get; set; }
Vector3 Offset(); void Offset(Vector3 offset);
public Vector3 Offset { get; set; }
Public ReadWrite Property Offset As Vector3
Value
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; }
float OuterConeAngle(); void OuterConeAngle(float outerconeangle);
public float OuterConeAngle { get; set; }
Public ReadWrite Property OuterConeAngle As float
Value
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; }
float OuterConeAngleInDegrees(); void OuterConeAngleInDegrees(float outerconeangleindegrees);
public float OuterConeAngleInDegrees { get; set; }
Public ReadWrite Property OuterConeAngleInDegrees As float
Value
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; }
Color OuterConeColor(); void OuterConeColor(Color outerconecolor);
public Color OuterConeColor { get; set; }
Public ReadWrite Property OuterConeColor As Color
Value
Color Color

The color of the spotlight's outer cone.

OuterConeIntensity OuterConeIntensity OuterConeIntensity OuterConeIntensity

Gets or sets the intensity of the light in the spotlight's outer cone.

public : float OuterConeIntensity { get; set; }
float OuterConeIntensity(); void OuterConeIntensity(float outerconeintensity);
public float OuterConeIntensity { get; set; }
Public ReadWrite Property OuterConeIntensity As float
Value
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 Properties

The collection of properties associated with the CompositionObject.

(Inherited from CompositionObject)

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; }
float QuadraticAttenuation(); void QuadraticAttenuation(float quadraticattenuation);
public float QuadraticAttenuation { get; set; }
Public ReadWrite Property QuadraticAttenuation As float
Value
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 Targets

The collection of Visuals targeted by the light.

(Inherited from CompositionLight)

Methods

Close Close Close Close

Closes the CompositionObject and releases system resources.

(Inherited from CompositionObject)

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

Connects an animation with the specified property of the object and starts the animation.

(Inherited from CompositionObject)
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10586.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v2)

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

Starts an animation group.

The StartAnimationGroup method on CompositionObject lets you start CompositionAnimationGroup. All the animations in the group will be started at the same time on the object.

(Inherited from CompositionObject)
Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

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

Disconnects an animation from the specified property and stops the animation.

(Inherited from CompositionObject)
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10586.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v2)

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

Stops an animation group.

(Inherited from CompositionObject)
Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

TryGetAnimationController(String) TryGetAnimationController(String) TryGetAnimationController(String) TryGetAnimationController(String)

Prerelease. Returns an AnimationController for the animation running on the specified property.

(Inherited from CompositionObject)
Additional features and requirements
Device family
Windows 10 Insider Preview (introduced v10.0.17095.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v6)

See Also