Skip to content

SmoothMove Class

Animates the movement of an object.

C#
public class SmoothMove : UpdateComponent, IComponent

Inheritance objectUpdateComponent

Implements IComponent

Creates a new instance of this object with a default transition time of 200 milliseconds.

C#
public SmoothMove()

Creates a new instance of this object with a fixed size for calculating smooth movement.

C#
public SmoothMove(Point fontSize)

fontSize SadRogue.Primitives.Point
The size of the font used to display the object hosting the component.

Creates a new instance of this object with a specific transition time.

C#
public SmoothMove(TimeSpan transitionTime)

transitionTime TimeSpan
The amount of time it takes to animate the movement.

Creates a new instance of this object with a fixed size for calculating smooth movement and the specified transition time.

C#
public SmoothMove(Point fontSize, TimeSpan transitionTime)

fontSize SadRogue.Primitives.Point
The size of the font used to display the object hosting the component.

transitionTime TimeSpan
The amount of time it takes to animate the movement.

true when this component currently is animating the movement of the host object; otherwise false.

C#
public bool IsMoving { get; }

The size of the parent object’s font.

C#
public Point FontSize { get; set; }

false to pause this component and prevent it from animating movement; otherwise true to enable animating movement.

C#
public bool IsEnabled { get; set; }

The easing function applied to smoothing the objects movement.

C#
public EasingBase? TransitionEasingFunction { get; set; }

The amount of time it takes to animated the movement.

C#
public TimeSpan TransitionTime { get; set; }

Called by the host when the component is added to an object. Add to a IScreenSurface or Entity.

C#
public override void OnAdded(IScreenObject host)

host IScreenObject
The IScreenSurface or Entity.

Called when the component is removed from the host.

C#
public override void OnRemoved(IScreenObject host)

host IScreenObject
The host that removed the component.

Updates the component. If the object is moving, changes to pixel positioning (if required) and animates the movement.

C#
public override void Update(IScreenObject host, TimeSpan delta)

host IScreenObject
The host object being moved.

delta TimeSpan
The time difference from the previous frame.

Raised when the smoothing component starts moving an object.

C#
public event EventHandler? MoveStarted

EventHandler

Raised when the smoothing component ends moving an object.

C#
public event EventHandler? MoveEnded

EventHandler