Option Strict On
Option Explicit On

Imports System

Namespace Nexamas.UI.Motion

    ''' <summary>
    ''' Immutable transition plan produced by the motion gateway. It stores numeric interpolation facts without owning drawing or timers.
    ''' </summary>
    Friend NotInheritable Class MASMotionTransitionPlan

        Friend Sub New(token As MASMotionToken,
                       fromValue As Single,
                       toValue As Single,
                       effectiveDurationMs As Integer)
            If token Is Nothing Then Throw New ArgumentNullException(NameOf(token))
            Me.Token = token
            Me.FromValue = fromValue
            Me.ToValue = toValue
            Me.EffectiveDurationMs = Math.Max(0, effectiveDurationMs)
        End Sub

        Friend ReadOnly Property Token As MASMotionToken

        Friend ReadOnly Property FromValue As Single

        Friend ReadOnly Property ToValue As Single

        Friend ReadOnly Property EffectiveDurationMs As Integer

        Friend ReadOnly Property ShouldAnimate As Boolean
            Get
                Return EffectiveDurationMs > 0 AndAlso Math.Abs(ToValue - FromValue) > 0.0001F
            End Get
        End Property

    End Class

End Namespace
