# Sandbox.SpriteRenderer

Renders a sprite in the world

- Kind: class
- Namespace: `Sandbox`
- Assembly: `Sandbox.Engine`
- Inherits: [Sandbox.Renderer](/api/Sandbox.Renderer)
- Modifiers: sealed

## Constructors

- [`SpriteRenderer`](/api/Sandbox.SpriteRenderer/.ctor)

## Properties

- [`Additive`](/api/Sandbox.SpriteRenderer/Additive): Whether or not the sprite should be rendered additively.
- [`AlphaCutoff`](/api/Sandbox.SpriteRenderer/AlphaCutoff): Alpha threshold for discarding pixels. Pixels with alpha below this value will be discarded. Only used when Opaque is true. Range: 0.0 (transparent) to 1.0 (opaque). Default is 0.5.
- [`Billboard`](/api/Sandbox.SpriteRenderer/Billboard): Alignment mode for the sprite's billboard behavior.
- [`CameraFadeFar`](/api/Sandbox.SpriteRenderer/CameraFadeFar): Sprites further from the camera than this are fully opaque. Between this and [Sandbox.SpriteRenderer.CameraFadeNear](/api/Sandbox.SpriteRenderer/CameraFadeNear) they fade out. Leave at zero to disable the fade.
- [`CameraFadeNear`](/api/Sandbox.SpriteRenderer/CameraFadeNear): Sprites closer to the camera than this are completely invisible.
- [`Color`](/api/Sandbox.SpriteRenderer/Color): The color of the sprite. This is multiplied with the texture color.
- [`ComponentVersion`](/api/Sandbox.SpriteRenderer/ComponentVersion)
- [`CurrentAnimation`](/api/Sandbox.SpriteRenderer/CurrentAnimation): The animation that is currently being played. Returns null if no sprite is set or the sprite has no animations.
- [`CurrentFrameIndex`](/api/Sandbox.SpriteRenderer/CurrentFrameIndex): The index of the current frame being displayed. This will change over time if the sprite is animated, and can be set to go to a specific frame even during playback.
- [`DepthFeather`](/api/Sandbox.SpriteRenderer/DepthFeather): Amount of feathering applied to the depth, softening its intersection with geometry.
- [`FlipHorizontal`](/api/Sandbox.SpriteRenderer/FlipHorizontal): Whether or not the sprite should be flipped horizontally.
- [`FlipVertical`](/api/Sandbox.SpriteRenderer/FlipVertical): Whether or not the sprite should be flipped vertically.
- [`FogStrength`](/api/Sandbox.SpriteRenderer/FogStrength): The strength of the fog effect applied to the sprite. This determines how much the sprite blends with any fog in the scene.
- [`IsAnimated`](/api/Sandbox.SpriteRenderer/IsAnimated): Whether or not the sprite is animated. This is true if the sprite has more than one animation.
- [`IsSorted`](/api/Sandbox.SpriteRenderer/IsSorted): Whether or not the sprite should be sorted by depth. If the sprite is opaque, this can be turned off for a performance boost if not needed.
- [`Lighting`](/api/Sandbox.SpriteRenderer/Lighting): Whether or not the sprite should be lit by the scene's lighting system. Otherwise it will be unlit/fullbright.
- [`OnAnimationEnd`](/api/Sandbox.SpriteRenderer/OnAnimationEnd): This action is invoked when an animation finishes playing or has looped. The string parameter is the name of the animation.
- [`OnAnimationStart`](/api/Sandbox.SpriteRenderer/OnAnimationStart): This action is invoked when an animation starts playing. The string parameter is the name of the animation that started.
- [`OnBroadcastMessage`](/api/Sandbox.SpriteRenderer/OnBroadcastMessage): This action is invoked when advancing to a new frame that has broadcast messages. The string parameter is the message being broadcast.
- [`Opaque`](/api/Sandbox.SpriteRenderer/Opaque): Whether or not the sprite should be rendered opaque. If true, any semi-transparent pixels will be dithered.
- [`OverlayColor`](/api/Sandbox.SpriteRenderer/OverlayColor)
- [`PlaybackSpeed`](/api/Sandbox.SpriteRenderer/PlaybackSpeed): The playback speed of the animation. 0 is paused, and negative values will play the animation in reverse.
- [`Shadows`](/api/Sandbox.SpriteRenderer/Shadows): Whether or not the sprite should cast shadows.
- [`Size`](/api/Sandbox.SpriteRenderer/Size): The width and height of the sprite in world units.
- [`Sprite`](/api/Sandbox.SpriteRenderer/Sprite): The sprite resource to render. This can be completely static or contain animation(s).
- [`StartingAnimationName`](/api/Sandbox.SpriteRenderer/StartingAnimationName): The animation that this sprite should start playing when the scene starts.
- [`Texture`](/api/Sandbox.SpriteRenderer/Texture): The texture of the current frame being displayed. Returns a transparent texture when no valid frame is available.
- [`TextureFilter`](/api/Sandbox.SpriteRenderer/TextureFilter): The texture filtering mode used when rendering the sprite. For pixelated sprites, use [Sandbox.UI.ImageRendering.Point](/api/Sandbox.UI.ImageRendering/Point).

## Methods

- [`PlayAnimation`](/api/Sandbox.SpriteRenderer/PlayAnimation): Play an animation by index (the first animation is index 0).
