Class SmoothMove
Animates the movement of an object.
Implements
Inherited Members
Namespace: SadConsole.Components
Assembly: SadConsole.Extended.dll
Syntax
public class SmoothMove : UpdateComponent, IComponent
Constructors
SmoothMove()
Creates a new instance of this object with a default transition time of 200 milliseconds.
Declaration
public SmoothMove()
SmoothMove(Point)
Creates a new instance of this object with a fixed size for calculating smooth movement.
Declaration
public SmoothMove(Point fontSize)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | fontSize | The size of the font used to display the object hosting the component. |
SmoothMove(Point, TimeSpan)
Creates a new instance of this object with a fixed size for calculating smooth movement and the specified transition time.
Declaration
public SmoothMove(Point fontSize, TimeSpan transitionTime)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | fontSize | The size of the font used to display the object hosting the component. |
| TimeSpan | transitionTime | The amount of time it takes to animate the movement. |
SmoothMove(TimeSpan)
Creates a new instance of this object with a specific transition time.
Declaration
public SmoothMove(TimeSpan transitionTime)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeSpan | transitionTime | The amount of time it takes to animate the movement. |
Properties
FontSize
The size of the parent object's font.
Declaration
public Point FontSize { get; set; }
Property Value
| Type | Description |
|---|---|
| Point |
IsEnabled
false to pause this component and prevent it from animating movement; otherwise true to enable animating movement.
Declaration
public bool IsEnabled { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
IsMoving
Declaration
public bool IsMoving { get; }
Property Value
| Type | Description |
|---|---|
| bool |
TransitionEasingFunction
The easing function applied to smoothing the objects movement.
Declaration
public EasingBase? TransitionEasingFunction { get; set; }
Property Value
| Type | Description |
|---|---|
| EasingBase |
TransitionTime
The amount of time it takes to animated the movement.
Declaration
public TimeSpan TransitionTime { get; set; }
Property Value
| Type | Description |
|---|---|
| TimeSpan |
Methods
OnAdded(IScreenObject)
Called by the host when the component is added to an object. Add to a IScreenSurface or Entity.
Declaration
public override void OnAdded(IScreenObject host)
Parameters
| Type | Name | Description |
|---|---|---|
| IScreenObject | host | The IScreenSurface or Entity. |
Overrides
OnRemoved(IScreenObject)
Called when the component is removed from the host.
Declaration
public override void OnRemoved(IScreenObject host)
Parameters
| Type | Name | Description |
|---|---|---|
| IScreenObject | host | The host that removed the component. |
Overrides
Update(IScreenObject, TimeSpan)
Updates the component. If the object is moving, changes to pixel positioning (if required) and animates the movement.
Declaration
public override void Update(IScreenObject host, TimeSpan delta)
Parameters
| Type | Name | Description |
|---|---|---|
| IScreenObject | host | The host object being moved. |
| TimeSpan | delta | The time difference from the previous frame. |
Overrides
Events
MoveEnded
Raised when the smoothing component ends moving an object.
Declaration
public event EventHandler? MoveEnded
Event Type
| Type | Description |
|---|---|
| EventHandler |
MoveStarted
Raised when the smoothing component starts moving an object.
Declaration
public event EventHandler? MoveStarted
Event Type
| Type | Description |
|---|---|
| EventHandler |