//--------------------------------------------------------------------------
//
//  UIAnimation.idl
//
//  Windows Animation interface definitions and related types and enums
//
//  Copyright (c) Microsoft Corporation. All rights reserved.
//
//--------------------------------------------------------------------------

cpp_quote("//--------------------------------------------------------------------------")
cpp_quote("//")
cpp_quote("//  UIAnimation.h")
cpp_quote("//")
cpp_quote("//  Windows Animation interface definitions and related types and enums")
cpp_quote("//  (Generated from UIAnimation.idl)")
cpp_quote("//")
cpp_quote("//  Copyright (c) Microsoft Corporation. All rights reserved.")
cpp_quote("//")
cpp_quote("//--------------------------------------------------------------------------")

import "wtypes.idl";
import "unknwn.idl";
import "dcompanimation.idl";
#include "sdkddkver.h"

interface IUIAnimationManager;
interface IUIAnimationManager2;
interface IUIAnimationVariable;
interface IUIAnimationVariable2;
interface IUIAnimationStoryboard;
interface IUIAnimationStoryboard2;
interface IUIAnimationTransition;
interface IUIAnimationTransition2;
interface IUIAnimationManagerEventHandler;
interface IUIAnimationManagerEventHandler2;
interface IUIAnimationVariableChangeHandler;
interface IUIAnimationVariableChangeHandler2;
interface IUIAnimationVariableIntegerChangeHandler;
interface IUIAnimationVariableIntegerChangeHandler2;
interface IUIAnimationVariableCurveChangeHandler2;
interface IUIAnimationStoryboardEventHandler;
interface IUIAnimationStoryboardEventHandler2;
interface IUIAnimationPriorityComparison;
interface IUIAnimationPriorityComparison2;
interface IUIAnimationTransitionLibrary;
interface IUIAnimationTransitionLibrary2;

interface IUIAnimationInterpolator;
interface IUIAnimationInterpolator2;
interface IUIAnimationTransitionFactory;
interface IUIAnimationTransitionFactory2;

interface IUIAnimationTimer;
interface IUIAnimationTimerUpdateHandler;
interface IUIAnimationTimerClientEventHandler;
interface IUIAnimationTimerEventHandler;

// Annotations on methods are not supported by earlier versions of MIDL
#ifdef NTDDI_WIN7
#define UI_CHECKRETURN                              [annotation("_Check_return_")] 
#else
#define UI_CHECKRETURN                    
#endif

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Animation API

// The units of time used for all animations
typedef DOUBLE UI_ANIMATION_SECONDS;

// Special value to indicate that any predetermined time in the future will be acceptable
const UI_ANIMATION_SECONDS UI_ANIMATION_SECONDS_EVENTUALLY = -1.0;

// Defines results for animation updates
typedef [v1_enum] enum
{
    UI_ANIMATION_UPDATE_NO_CHANGE                   = 0,                                    // No animation variables changed
    UI_ANIMATION_UPDATE_VARIABLES_CHANGED           = 1                                     // One or more animation variables changed
} UI_ANIMATION_UPDATE_RESULT;

// Defines activity status for an animation manager
typedef [v1_enum] enum
{
    UI_ANIMATION_MANAGER_IDLE                       = 0,                                    // The animation manager is idle; no animations are currently playing
    UI_ANIMATION_MANAGER_BUSY                       = 1                                     // The animation manager is busy; one or more animations are currently playing
} UI_ANIMATION_MANAGER_STATUS;

// Defines animation modes
typedef [v1_enum] enum
{
    UI_ANIMATION_MODE_DISABLED                      = 0,                                    // Animation is disabled
    UI_ANIMATION_MODE_SYSTEM_DEFAULT                = 1,                                    // Animation is system managed
    UI_ANIMATION_MODE_ENABLED                       = 2                                     // Animation is enabled
} UI_ANIMATION_MODE;

// Defines animation repeat modes
typedef [v1_enum] enum
{
    UI_ANIMATION_REPEAT_MODE_NORMAL                 = 0,                                    // Animation progresses normally during repeats 
    UI_ANIMATION_REPEAT_MODE_ALTERNATE              = 1                                     // Animation alternates back and forth across repeats
} UI_ANIMATION_REPEAT_MODE;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// V1 API * * *
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Defines the animation manager, which provides a central interface for creating and managing UI animations
[
    local,
    object,
    uuid(9169896C-AC8D-4e7d-94E5-67FA4DC2F2E8),
    helpstring("IUIAnimationManager Interface"),
    pointer_default(unique)
]
interface IUIAnimationManager : IUnknown
{
    // Creates a new animation variable
    UI_CHECKRETURN HRESULT
    CreateAnimationVariable
    (
                        [in, annotation("_In_")] DOUBLE initialValue,                       // The initial value for the variable
        [out, retval, annotation("_Outptr_")] IUIAnimationVariable **variable            // The new animation variable
    );
    
    // Creates and schedules a single-transition storyboard
    UI_CHECKRETURN HRESULT
    ScheduleTransition
    (
        [in, annotation("_In_")] IUIAnimationVariable *variable,                            // The variable to schedule for transition
        [in, annotation("_In_")] IUIAnimationTransition *transition,                        // The transition to apply to the variable
        [in, annotation("_In_")] UI_ANIMATION_SECONDS timeNow                               // The current time
    );
    
    // Creates a new storyboard
    UI_CHECKRETURN HRESULT
    CreateStoryboard
    (
        [out, retval, annotation("_Outptr_")] IUIAnimationStoryboard **storyboard        // The new storyboard
    );
    
    // Directs the animation manager to finish all active storyboards
    UI_CHECKRETURN HRESULT
    FinishAllStoryboards
    (
        [in, annotation("_In_")] UI_ANIMATION_SECONDS completionDeadline                    // The maximum amount of time any storyboard is allowed
    );
    
    // Directs the animation manager to abandon all active storyboards
    UI_CHECKRETURN HRESULT
    AbandonAllStoryboards
    (
    );
    
    // Directs the animation manager to update the elapsed time for all scheduled storyboards
    UI_CHECKRETURN HRESULT 
    Update
    (
            [in, annotation("_In_")] UI_ANIMATION_SECONDS timeNow,                          // The current time
        [out, defaultvalue(0),
            annotation("_Out_opt_")] UI_ANIMATION_UPDATE_RESULT *updateResult               // The update result
    );
    
    // Gets the animation variable with a specified tag
    UI_CHECKRETURN HRESULT
    GetVariableFromTag
    (
            [in, unique, annotation("_In_opt_")] IUnknown *object,                          // The tag object
                        [in, annotation("_In_")] UINT32 id,                                 // The tag ID
        [out, retval, annotation("_Outptr_")] IUIAnimationVariable **variable            // The animation variable that matches the specified tag, or NULL if no match is found
    );
    
    // Gets the storyboard with a specified tag
    UI_CHECKRETURN HRESULT
    GetStoryboardFromTag
    (
            [in, unique, annotation("_In_opt_")] IUnknown *object,                          // The tag object
                        [in, annotation("_In_")] UINT32 id,                                 // The tag ID
        [out, retval, annotation("_Outptr_")] IUIAnimationStoryboard **storyboard        // The animation storyboard that matches the specified tag, or NULL if no match is found
    );
    
    // Gets the animation manager's status
    UI_CHECKRETURN HRESULT
    GetStatus
    (
        [out, retval, annotation("_Out_")] UI_ANIMATION_MANAGER_STATUS *status              // The animation manager's status
    );
    
    // Sets the animation mode for the animation manager
    UI_CHECKRETURN HRESULT
    SetAnimationMode
    (
        [in, annotation("_In_")] UI_ANIMATION_MODE mode                                     // The animation mode
    );
    
    // Pauses all animations
    UI_CHECKRETURN HRESULT
    Pause
    (
    );
    
    // Resumes all animations
    UI_CHECKRETURN HRESULT
    Resume
    (
    );
    
    // Specifies a handler for animation manager status updates
    UI_CHECKRETURN HRESULT
    SetManagerEventHandler
    (
        [in, unique, annotation("_In_opt_")] IUIAnimationManagerEventHandler *handler       // A handler for animation manager status update events
    );
    
    // Sets a priority comparison handler for cancellation
    UI_CHECKRETURN HRESULT
    SetCancelPriorityComparison
    (
        [in, unique, annotation("_In_opt_")] IUIAnimationPriorityComparison *comparison     // The handler for priority comparisons to determine if a scheduled storyboard can be cancelled
    );
    
    // Sets a priority comparison handler for trimming
    UI_CHECKRETURN HRESULT
    SetTrimPriorityComparison
    (
        [in, unique, annotation("_In_opt_")] IUIAnimationPriorityComparison *comparison     // The handler for priority comparisons to determine if a scheduled storyboard can be trimmed
    );
    
    // Sets a priority comparison handler for compression
    UI_CHECKRETURN HRESULT
    SetCompressPriorityComparison
    (
        [in, unique, annotation("_In_opt_")]  IUIAnimationPriorityComparison *comparison    // The handler for priority comparisons to determine if a scheduled storyboard can be compressed
    );
    
    // Sets a priority comparison handler for conclusion
    UI_CHECKRETURN HRESULT
    SetConcludePriorityComparison
    (
        [in, unique, annotation("_In_opt_")] IUIAnimationPriorityComparison *comparison     // The handler for priority comparisons to determine if a scheduled storyboard can be concluded
    );
    
    // Sets the default acceptable animation delay
    UI_CHECKRETURN HRESULT
    SetDefaultLongestAcceptableDelay
    (
        [in, annotation("_In_")] UI_ANIMATION_SECONDS delay                                 // The default value for acceptable delay before scheduled storyboards start
    );
    
    // Shuts down the animation manager and all objects it has created
    UI_CHECKRETURN HRESULT
    Shutdown
    (
    );
};

// Defines rounding modes to use when converting values from floating point to integer
typedef [v1_enum] enum
{
    UI_ANIMATION_ROUNDING_NEAREST                   = 0,                                    // Round to the nearest integer
    UI_ANIMATION_ROUNDING_FLOOR                     = 1,                                    // Round down
    UI_ANIMATION_ROUNDING_CEILING                   = 2                                     // Round up
} UI_ANIMATION_ROUNDING_MODE;

// Defines an animation variable, which represents a value that may be animated
[
    local,
    object,
    uuid(8CEEB155-2849-4ce5-9448-91FF70E1E4D9),
    helpstring("IUIAnimationVariable Interface"),
    pointer_default(unique)
]
interface IUIAnimationVariable : IUnknown
{
    // Gets the animation variable's current value
    UI_CHECKRETURN HRESULT
    GetValue
    (
        [out, retval, annotation("_Out_")] DOUBLE *value                                    // The current value
    );
    
    // Gets the animation variable's final value, after all currently scheduled animations have finished
    UI_CHECKRETURN HRESULT
    GetFinalValue
    (
        [out, retval, annotation("_Out_")] DOUBLE *finalValue                               // The final value
    );
    
    // Gets the animation variable's value before the most recent update
    UI_CHECKRETURN HRESULT
    GetPreviousValue
    (
        [out, retval, annotation("_Out_")] DOUBLE *previousValue                            // The previous value
    );
    
    // Gets the animation variable's current value, converted to INT32
    UI_CHECKRETURN HRESULT
    GetIntegerValue
    (
        [out, retval, annotation("_Out_")] INT32 *value                                     // The animation variable's current value, converted to INT32 
    );
    
    // Gets the animation variable's final value, converted to INT32
    UI_CHECKRETURN HRESULT
    GetFinalIntegerValue
    (
        [out, retval, annotation("_Out_")] INT32 *finalValue                                // The animation variable's final value, converted to INT32
    );
    
    // Gets the animation variable's value before the most recent update, converted to INT32
    UI_CHECKRETURN HRESULT
    GetPreviousIntegerValue
    (
        [out, retval, annotation("_Out_")] INT32 *previousValue                             // The animation variable's previous value, converted to INT32
    );
    
    // Gets the storyboard that is currently animating the variable
    UI_CHECKRETURN HRESULT
    GetCurrentStoryboard
    (
        [out, retval, annotation("_Outptr_")] IUIAnimationStoryboard **storyboard        // The current storyboard, or NULL if no storyboard is currently animating the variable
    );
    
    // Sets the lower bound (floor) for the animation variable's value
    UI_CHECKRETURN HRESULT
    SetLowerBound
    (
        [in, annotation("_In_")] DOUBLE bound                                               // The lower bound
    );
    
    // Sets the upper bound (ceiling) for the animation variable's value
    UI_CHECKRETURN HRESULT
    SetUpperBound
    (
        [in, annotation("_In_")] DOUBLE bound                                               // The upper bound
    );
    
    // Specifies a rounding mode for the animation variable
    UI_CHECKRETURN HRESULT
    SetRoundingMode
    (
        [in, annotation("_In_")] UI_ANIMATION_ROUNDING_MODE mode                            // A rounding mode for the animation variable
    );
    
    // Sets the animation variable's object/ID tag
    UI_CHECKRETURN HRESULT
    SetTag
    (
        [in, unique, annotation("_In_opt_")] IUnknown *object,                              // The tag object
                    [in, annotation("_In_")] UINT32 id                                      // The tag ID
    );
    
    // Gets the animation variable's object/ID tag
    UI_CHECKRETURN HRESULT
    GetTag
    (
        [out, annotation("_Outptr_opt_")] IUnknown **object,                             // The tag object
              [out, annotation("_Out_opt_")] UINT32 *id                                     // The tag ID
    );
    
    // Specifies a handler for value updates
    UI_CHECKRETURN HRESULT
    SetVariableChangeHandler
    (
        [in, unique, annotation("_In_opt_")] IUIAnimationVariableChangeHandler *handler     // A handler for animation variable value updates
    );
    
    // Specifies a handler for value updates; values are converted to INT32
    UI_CHECKRETURN HRESULT
    SetVariableIntegerChangeHandler
    (
        [in, unique,
            annotation("_In_opt_")] IUIAnimationVariableIntegerChangeHandler *handler       // A handler for animation variable value updates
    );
};

// Defines status for a storyboard
typedef [v1_enum] enum
{
    UI_ANIMATION_STORYBOARD_BUILDING                = 0,                                    // The storyboard has not yet been scheduled
    UI_ANIMATION_STORYBOARD_SCHEDULED               = 1,                                    // The storyboard is scheduled to play
    UI_ANIMATION_STORYBOARD_CANCELLED               = 2,                                    // The storyboard was cancelled
    UI_ANIMATION_STORYBOARD_PLAYING                 = 3,                                    // The storyboard is currently playing
    UI_ANIMATION_STORYBOARD_TRUNCATED               = 4,                                    // The storyboard was truncated
    UI_ANIMATION_STORYBOARD_FINISHED                = 5,                                    // The storyboard finished playing
    UI_ANIMATION_STORYBOARD_READY                   = 6,                                    // The storyboard is built and ready for re-scheduling
    UI_ANIMATION_STORYBOARD_INSUFFICIENT_PRIORITY   = 7                                     // Scheduling failed; a scheduling conflict occurred, and the currently scheduled storyboard has higher priority
} UI_ANIMATION_STORYBOARD_STATUS;

// Defines results for storyboard scheduling
typedef [v1_enum] enum
{
    UI_ANIMATION_SCHEDULING_UNEXPECTED_FAILURE      = 0,                                    // Scheduling failed for an unexpected reason
    UI_ANIMATION_SCHEDULING_INSUFFICIENT_PRIORITY   = 1,                                    // Scheduling failed; a scheduling conflict occurred, and the currently scheduled storyboard has higher priority
    UI_ANIMATION_SCHEDULING_ALREADY_SCHEDULED       = 2,                                    // Scheduling failed; the storyboard is already scheduled
    UI_ANIMATION_SCHEDULING_SUCCEEDED               = 3,                                    // Scheduling succeeded
    UI_ANIMATION_SCHEDULING_DEFERRED                = 4                                     // Scheduling will be attempted when the current operation completes
} UI_ANIMATION_SCHEDULING_RESULT;

// Defines a keyframe, which represents a time offset within a storyboard
typedef struct { int _; } *UI_ANIMATION_KEYFRAME;

// Special value representing the implicit keyframe at the start of every storyboard
const UI_ANIMATION_KEYFRAME UI_ANIMATION_KEYFRAME_STORYBOARD_START = (UI_ANIMATION_KEYFRAME)(-1);

// Special value to direct a storyboard to repeat the interval between two keyframes indefinitely
const INT32 UI_ANIMATION_REPEAT_INDEFINITELY = -1;

// Special values to direct a storyboard to repeat the interval between two keyframes indefinitely
// and specify which keyframe the animation should end at during a conclude operation. For alternating loops,
// if UI_ANIMATION_REPEAT_INDEFINITELY is passed, behavior is to conclude at the end of the loop, as 
// UI_ANIMATION_REPEAT_INDEFINITELY_CONCLUDE_AT_END and UI_ANIMATION_REPEAT_INDEFINITELY are defined to be the 
// same value.
const INT32 UI_ANIMATION_REPEAT_INDEFINITELY_CONCLUDE_AT_END   = UI_ANIMATION_REPEAT_INDEFINITELY;
const INT32 UI_ANIMATION_REPEAT_INDEFINITELY_CONCLUDE_AT_START = -2;

// Defines a storyboard, which combines animation variables and transitions to define an animation
[
    local,
    object, 
    uuid(A8FF128F-9BF9-4af1-9E67-E5E410DEFB84),
    helpstring("IUIAnimationStoryboard Interface"),
    pointer_default(unique)
]
interface IUIAnimationStoryboard : IUnknown
{
    // Adds a transition to the storyboard
    UI_CHECKRETURN HRESULT
    AddTransition
    (
        [in, annotation("_In_")] IUIAnimationVariable *variable,                            // The animation variable to transition
        [in, annotation("_In_")] IUIAnimationTransition *transition                         // The transition to apply to the variable
    );
    
    // Adds a keyfame offset from an existing keyframe
    UI_CHECKRETURN HRESULT
    AddKeyframeAtOffset
    (
                  [in, annotation("_In_")] UI_ANIMATION_KEYFRAME existingKeyframe,          // An existing keyframe
                  [in, annotation("_In_")] UI_ANIMATION_SECONDS offset,                     // The offset from existingKeyframe at which to add keyframe
        [out, retval, annotation("_Out_")] UI_ANIMATION_KEYFRAME *keyframe                  // The new keyframe
    );
    
    // Adds a keyfame at the end of a specified transition
    UI_CHECKRETURN HRESULT
    AddKeyframeAfterTransition
    (
                  [in, annotation("_In_")] IUIAnimationTransition *transition,              // The transition to add a keyframe after
        [out, retval, annotation("_Out_")] UI_ANIMATION_KEYFRAME *keyframe                  // The new keyframe
    );
    
    // Adds a transition that starts at a specified keyframe
    UI_CHECKRETURN HRESULT
    AddTransitionAtKeyframe
    (
        [in, annotation("_In_")] IUIAnimationVariable *variable,                            // The animation variable to transition
        [in, annotation("_In_")] IUIAnimationTransition *transition,                        // The transition to apply to the variable
        [in, annotation("_In_")] UI_ANIMATION_KEYFRAME startKeyframe                        // A keyframe that specifies the beginning of the new transition
    );
    
    // Adds a transition between two keyframes
    UI_CHECKRETURN HRESULT
    AddTransitionBetweenKeyframes
    (
        [in, annotation("_In_")] IUIAnimationVariable *variable,                            // The animation variable to transition
        [in, annotation("_In_")] IUIAnimationTransition *transition,                        // The transition to apply to the variable
        [in, annotation("_In_")] UI_ANIMATION_KEYFRAME startKeyframe,                       // A keyframe that specifies the beginning of the new transition
        [in, annotation("_In_")] UI_ANIMATION_KEYFRAME endKeyframe                          // A keyframe that specifies the end of the new transition
    );
    
    // Creates a play cycle between two specified keyframes
    UI_CHECKRETURN HRESULT
    RepeatBetweenKeyframes
    (
        [in, annotation("_In_")] UI_ANIMATION_KEYFRAME startKeyframe,                       // The keyframe at which to start the cycle
        [in, annotation("_In_")] UI_ANIMATION_KEYFRAME endKeyframe,                         // The keyframe at which to end the cycle
        [in, annotation("_In_")] INT32 repetitionCount                                      // The number of times to repeat; must be 1 or more, or UI_ANIMATION_REPEAT_INDEFINITELY
    );
    
    // Directs the storyboard to hold an animation variable at its final value until the storyboard ends
    UI_CHECKRETURN HRESULT
    HoldVariable
    (
        [in, annotation("_In_")] IUIAnimationVariable *variable                             // The animation variable to hold
    );
    
    // Sets the longest acceptable delay before the storyboard plays
    UI_CHECKRETURN HRESULT
    SetLongestAcceptableDelay
    (
        [in, annotation("_In_")] UI_ANIMATION_SECONDS delay                                 // The longest acceptable delay before the storyboard plays
    );
    
    // Directs the storyboard to schedule for play
    UI_CHECKRETURN HRESULT
    Schedule
    (
            [in, annotation("_In_")] UI_ANIMATION_SECONDS timeNow,                          // The current time
        [out, defaultvalue(0),
            annotation("_Out_opt_")] UI_ANIMATION_SCHEDULING_RESULT *schedulingResult       // The result of the scheduling request
    );
    
    // Directs the storyboard to conclude
    UI_CHECKRETURN HRESULT
    Conclude
    (
    );
    
    // Directs the storyboard to finish playing within a specified amount of time
    UI_CHECKRETURN HRESULT
    Finish
    (
        [in, annotation("_In_")] UI_ANIMATION_SECONDS completionDeadline                    // The maximum time the storyboard has to finish playing
    );
    
    // Directs the storyboard to abandon playing
    UI_CHECKRETURN HRESULT
    Abandon
    (
    );
    
    // Sets the storyboard's object/ID tag
    UI_CHECKRETURN HRESULT
    SetTag
    (
        [in, unique, annotation("_In_opt_")] IUnknown *object,                              // The tag object
                    [in, annotation("_In_")] UINT32 id                                      // The tag ID
    );
    
    // Gets the storyboard's object/ID tag
    UI_CHECKRETURN HRESULT
    GetTag
    (
        [out, annotation("_Outptr_opt_")] IUnknown **object,                             // The tag object
              [out, annotation("_Out_opt_")] UINT32 *id                                     // The tag ID
    );
    
    // Gets the storyboard's status
    UI_CHECKRETURN HRESULT
    GetStatus
    (
        [out, retval, annotation("_Out_")] UI_ANIMATION_STORYBOARD_STATUS *status           // The storyboard's status
    );
    
    // Gets time elapsed since the storyboard started playing
    UI_CHECKRETURN HRESULT
    GetElapsedTime
    (
        [out, annotation("_Out_")] UI_ANIMATION_SECONDS *elapsedTime                        // Time elapsed since the storyboard started playing 
    );
    
    // Specifies a handler for storyboard status and update events
    UI_CHECKRETURN HRESULT
    SetStoryboardEventHandler
    (
        [in, unique, annotation("_In_opt_")] IUIAnimationStoryboardEventHandler *handler    // A handler for storyboard status and update events
    );
};

// Defines a transition, which determines how an animation variable changes over time
[
    local,
    object,
    uuid(DC6CE252-F731-41cf-B610-614B6CA049AD),
    helpstring("IUIAnimationTransition Interface"),
    pointer_default(unique)
]
interface IUIAnimationTransition : IUnknown
{
    // Forces the transition to start at a given initial value
    UI_CHECKRETURN HRESULT
    SetInitialValue
    (
        [in, annotation("_In_")] DOUBLE value                                               // The initial value
    );
    
    // Forces the transition to start with a given initial velocity
    UI_CHECKRETURN HRESULT
    SetInitialVelocity
    (
        [in, annotation("_In_")] DOUBLE velocity                                            // The initial velocity
    );
    
    // Determines whether a transition's duration is currently known
    UI_CHECKRETURN HRESULT
    IsDurationKnown
    (
    );
    
    // Gets the transition's duration
    UI_CHECKRETURN HRESULT
    GetDuration
    (
        [out, retval, annotation("_Out_")] UI_ANIMATION_SECONDS *duration                   // The duration
    );
};

// Defines methods for handling animation manager status change events
[
    local,
    object,
    uuid(783321ED-78A3-4366-B574-6AF607A64788),
    helpstring("IUIAnimationManagerEventHandler Interface"),
    pointer_default(unique)
]
interface IUIAnimationManagerEventHandler  : IUnknown
{
    // Handles OnManagerStatusChanged events, which occur when the animation manager's status changes
    UI_CHECKRETURN HRESULT
    OnManagerStatusChanged
    (
        [in, annotation("_In_")] UI_ANIMATION_MANAGER_STATUS newStatus,                     // The new status
        [in, annotation("_In_")] UI_ANIMATION_MANAGER_STATUS previousStatus                 // The previous status
    );
};

// Defines methods for handling animation variable update events
[
    local,
    object,
    uuid(6358B7BA-87D2-42d5-BF71-82E919DD5862),
    helpstring("IUIAnimationVariableChangeHandler Interface"),
    pointer_default(unique)
]
interface IUIAnimationVariableChangeHandler  : IUnknown
{
    // Handles OnValueChanged events, which occur when an animation variable's value changes; receives value updates as DOUBLE
    UI_CHECKRETURN HRESULT
    OnValueChanged
    (
        [in, annotation("_In_")] IUIAnimationStoryboard *storyboard,                        // The storyboard that is animating the variable
        [in, annotation("_In_")] IUIAnimationVariable *variable,                            // The animation variable that was updated
        [in, annotation("_In_")] DOUBLE newValue,                                           // The new value
        [in, annotation("_In_")] DOUBLE previousValue                                       // The previous value
    );
};

// Defines methods for handling animation variable update events
[
    local,
    object,
    uuid(BB3E1550-356E-44b0-99DA-85AC6017865E),
    helpstring("IUIAnimationVariableIntegerChangeHandler Interface"),
    pointer_default(unique)
]
interface IUIAnimationVariableIntegerChangeHandler  : IUnknown
{
    // Handles OnIntegerValueChanged events, which occur when an animation variable's rounded value changes; receives value updates as INT32
    UI_CHECKRETURN HRESULT
    OnIntegerValueChanged
    (
        [in, annotation("_In_")] IUIAnimationStoryboard *storyboard,                        // The storyboard that is animating the variable 
        [in, annotation("_In_")] IUIAnimationVariable *variable,                            // The animation variable that was updated
        [in, annotation("_In_")] INT32 newValue,                                            // The new rounded value
        [in, annotation("_In_")] INT32 previousValue                                        // The previous rounded value
    );                                                              
};

// Defines methods for handling animation variable update events
[
    local,
    object,
    uuid(3D5C9008-EC7C-4364-9F8A-9AF3C58CBAE6),
    helpstring("IUIAnimationStoryboardEventHandler Interface"),
    pointer_default(unique)
]
interface IUIAnimationStoryboardEventHandler  : IUnknown
{
    // Handles OnStoryboardStatusChanged events, which occur when a storyboard's status changes
    UI_CHECKRETURN HRESULT
    OnStoryboardStatusChanged
    (
        [in, annotation("_In_")] IUIAnimationStoryboard *storyboard,                        // The storyboard that changed status
        [in, annotation("_In_")] UI_ANIMATION_STORYBOARD_STATUS newStatus,                  // The new status
        [in, annotation("_In_")] UI_ANIMATION_STORYBOARD_STATUS previousStatus              // The previous status 
    );
    
    // Handles OnStoryboardUpdated events, which occur when a storyboard is updated
    UI_CHECKRETURN HRESULT
    OnStoryboardUpdated
    (
        [in, annotation("_In_")] IUIAnimationStoryboard *storyboard                         // The storyboard that was updated
    );
};

// Defines the effect on the current attempt to schedule a storyboard if a priority comparison were to return S_FALSE
typedef [v1_enum] enum
{
    UI_ANIMATION_PRIORITY_EFFECT_FAILURE            = 0,                                    // The attempt to schedule the storyboard will fail
    UI_ANIMATION_PRIORITY_EFFECT_DELAY              = 1                                     // The storyboard will be schedule later than it would if the priority comparion were to return S_OK
} UI_ANIMATION_PRIORITY_EFFECT;

// Defines a priority comparison that the animation manager uses to resolve scheduling conflicts
[
    local,
    object,
    uuid(83FA9B74-5F86-4618-BC6A-A2FAC19B3F44),
    helpstring("IUIAnimationPriorityComparison Interface"),
    pointer_default(unique)
]
interface IUIAnimationPriorityComparison : IUnknown
{
    // Determines the relative priority between a scheduled storyboard and a new storyboard
    UI_CHECKRETURN HRESULT
    HasPriority
    (
        [in, annotation("_In_")] IUIAnimationStoryboard *scheduledStoryboard,               // The currently scheduled storyboard
        [in, annotation("_In_")] IUIAnimationStoryboard *newStoryboard,                     // The new storyboard that is in scheduling conflict with scheduledStoryboard
        [in, annotation("_In_")] UI_ANIMATION_PRIORITY_EFFECT priorityEffect                // The effect on newStoryboard if scheduledStoryboard has priority
    );
};


// Defines animation slope characteristics
typedef [v1_enum] enum
{
    UI_ANIMATION_SLOPE_INCREASING                   = 0,                                    // The slope is increasing
    UI_ANIMATION_SLOPE_DECREASING                   = 1                                     // The slope is decreasing
} UI_ANIMATION_SLOPE;

// Defines a library of standard transitions
[
    local,
    object,
    uuid(CA5A14B1-D24F-48b8-8FE4-C78169BA954E),
    helpstring("IUIAnimationTransitionLibrary Interface"),
    pointer_default(unique)
]
interface IUIAnimationTransitionLibrary : IUnknown
{
    // Creates an instantaneous transition
    UI_CHECKRETURN HRESULT
    CreateInstantaneousTransition
    (
                        [in, annotation("_In_")] DOUBLE finalValue,                         // The final value this transition leads to when applied to an animation variable
        [out, retval, annotation("_Outptr_")] IUIAnimationTransition **transition        // The new instantaneous transition
    );
    
    // Creates a constant-value transition
    UI_CHECKRETURN HRESULT
    CreateConstantTransition
    (
                        [in, annotation("_In_")] UI_ANIMATION_SECONDS duration,             // The transition duration
        [out, retval, annotation("_Outptr_")] IUIAnimationTransition **transition        // The new constant-value transition
    );
    
    // Creates a discrete transition
    UI_CHECKRETURN HRESULT
    CreateDiscreteTransition
    (
                        [in, annotation("_In_")] UI_ANIMATION_SECONDS delay,                // The delay before the variable changes value
                        [in, annotation("_In_")] DOUBLE finalValue,                         // The final value this transition leads to when applied to an animation variable
                        [in, annotation("_In_")] UI_ANIMATION_SECONDS hold,                 // The hold time at the final value
        [out, retval, annotation("_Outptr_")] IUIAnimationTransition **transition        // The new discrete transition
    );
    
    // Creates a linear transition
    UI_CHECKRETURN HRESULT
    CreateLinearTransition
    (
                        [in, annotation("_In_")] UI_ANIMATION_SECONDS duration,             // The transition duration
                        [in, annotation("_In_")] DOUBLE finalValue,                         // The final value this transition leads to when applied to an animation variable
        [out, retval, annotation("_Outptr_")] IUIAnimationTransition **transition        // The new linear transition
    );
    
    // Creates a linear transition with a given speed
    UI_CHECKRETURN HRESULT
    CreateLinearTransitionFromSpeed
    (
                        [in, annotation("_In_")] DOUBLE speed,                              // The speed, in units/second, at which the variable will transition to the final value
                        [in, annotation("_In_")] DOUBLE finalValue,                         // The final value this transition leads to when applied to an animation variable
        [out, retval, annotation("_Outptr_")] IUIAnimationTransition **transition        // The new linear transition
    );
    
    // Creates a sinusoidal transition with an amplitude determined by its initial velocity
    UI_CHECKRETURN HRESULT
    CreateSinusoidalTransitionFromVelocity
    (
                        [in, annotation("_In_")] UI_ANIMATION_SECONDS duration,             // The transition duration
                        [in, annotation("_In_")] UI_ANIMATION_SECONDS period,               // The duration of each cycle
        [out, retval, annotation("_Outptr_")] IUIAnimationTransition **transition        // The new sinusoidal transition
    );
    
    // Creates a sinusoidal transition with a given range of oscillation
    UI_CHECKRETURN HRESULT
    CreateSinusoidalTransitionFromRange
    (
                        [in, annotation("_In_")] UI_ANIMATION_SECONDS duration,             // The transition duration
                        [in, annotation("_In_")] DOUBLE minimumValue,                       // The value at each trough of the sine wave
                        [in, annotation("_In_")] DOUBLE maximumValue,                       // The value at each peak of the sine wave
                        [in, annotation("_In_")] UI_ANIMATION_SECONDS period,               // The duration of each cycle
                        [in, annotation("_In_")] UI_ANIMATION_SLOPE slope,                  // The slope at the start of the transition
        [out, retval, annotation("_Outptr_")] IUIAnimationTransition **transition        // The new sinusoidal transition
    );
    
    // Creates an accelerate-decelerate transition
    UI_CHECKRETURN HRESULT
    CreateAccelerateDecelerateTransition
    (
                        [in, annotation("_In_")] UI_ANIMATION_SECONDS duration,             // The transition duration
                        [in, annotation("_In_")] DOUBLE finalValue,                         // The final value this transition leads to when applied to an animation variable
                        [in, annotation("_In_")] DOUBLE accelerationRatio,                  // The fraction of the duration to spend accelerating (0 to 1)
                        [in, annotation("_In_")] DOUBLE decelerationRatio,                  // The fraction of the duration to spend decelerating (0 to 1)
        [out, retval, annotation("_Outptr_")] IUIAnimationTransition **transition        // The new accelerate-decelerate transition
    );
    
    // Creates a reversal transition
    UI_CHECKRETURN HRESULT
    CreateReversalTransition
    (
                        [in, annotation("_In_")] UI_ANIMATION_SECONDS duration,             // The transition duration
        [out, retval, annotation("_Outptr_")] IUIAnimationTransition **transition        // The new reversal transition
    );
    
    // Creates a cubic transition
    UI_CHECKRETURN HRESULT
    CreateCubicTransition
    (
                        [in, annotation("_In_")] UI_ANIMATION_SECONDS duration,             // The transition duration
                        [in, annotation("_In_")] DOUBLE finalValue,                         // The final value this transition leads to when applied to an animation variable
                        [in, annotation("_In_")] DOUBLE finalVelocity,                      // The final velocity, in units/second
        [out, retval, annotation("_Outptr_")] IUIAnimationTransition **transition        // The new cubic transition
    );
    
    // Creates a smooth-stop transition
    UI_CHECKRETURN HRESULT
    CreateSmoothStopTransition
    (
                        [in, annotation("_In_")] UI_ANIMATION_SECONDS maximumDuration,      // The maximum duration for the transition
                        [in, annotation("_In_")] DOUBLE finalValue,                         // The final value this transition leads to when applied to an animation variable
        [out, retval, annotation("_Outptr_")] IUIAnimationTransition **transition        // The new smooth-stop transition
    );
    
    // Creates a parabolic transition with a given acceleration    
    UI_CHECKRETURN HRESULT
    CreateParabolicTransitionFromAcceleration
    (
                        [in, annotation("_In_")] DOUBLE finalValue,                         // The final value this transition leads to when applied to an animation variable
                        [in, annotation("_In_")] DOUBLE finalVelocity,                      // The final velocity, in units/second
                        [in, annotation("_In_")] DOUBLE acceleration,                       // The rate of change of the velocity, in units/second^2
        [out, retval, annotation("_Outptr_")] IUIAnimationTransition **transition        // The new parabolic transition
    );
};


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Interpolator API

// Defines the aspects of an interpolator that depend on a given input
typedef [v1_enum] enum
{
    UI_ANIMATION_DEPENDENCY_NONE                    = 0x00000000,                           // No aspects depend on the input
    UI_ANIMATION_DEPENDENCY_INTERMEDIATE_VALUES     = 0x00000001,                           // The intermediate values depend on the input
    UI_ANIMATION_DEPENDENCY_FINAL_VALUE             = 0x00000002,                           // The final value depends on the input
    UI_ANIMATION_DEPENDENCY_FINAL_VELOCITY          = 0x00000004,                           // The final velocity depends on the input
    UI_ANIMATION_DEPENDENCY_DURATION                = 0x00000008                            // The duration depends on the input
} UI_ANIMATION_DEPENDENCIES;

cpp_quote("DEFINE_ENUM_FLAG_OPERATORS(UI_ANIMATION_DEPENDENCIES);")

// Defines methods for creating a custom interpolator
[
    local,
    object,
    uuid(7815CBBA-DDF7-478c-A46C-7B6C738B7978),
    helpstring("IUIAnimationInterpolator Interface"),
    pointer_default(unique)
]
interface IUIAnimationInterpolator : IUnknown
{
    // Sets the interpolator's initial value and velocity
    UI_CHECKRETURN HRESULT
    SetInitialValueAndVelocity
    (
        [in, annotation("_In_")] DOUBLE initialValue,                                       // The initial value
        [in, annotation("_In_")] DOUBLE initialVelocity                                     // The initial velocity
    );
    
    // Sets the interpolator's duration
    UI_CHECKRETURN HRESULT
    SetDuration
    (
        [in, annotation("_In_")] UI_ANIMATION_SECONDS duration                              // The interpolator duration
    );
    
    // Gets the interpolator's duration
    UI_CHECKRETURN HRESULT
    GetDuration
    (
        [out, retval, annotation("_Out_")] UI_ANIMATION_SECONDS *duration                   // The interpolator duration
    );
    
    // Gets the final value to which the interpolator leads
    UI_CHECKRETURN HRESULT
    GetFinalValue
    (
        [out, retval, annotation("_Out_")] DOUBLE *value                                    // The final value
    ); 
    
    // Interpolates the value at a given offset
    UI_CHECKRETURN HRESULT
    InterpolateValue
    (
                  [in, annotation("_In_")] UI_ANIMATION_SECONDS offset,                     // The offset
        [out, retval, annotation("_Out_")] DOUBLE *value                                    // The interpolated value
    );
    
    // Interpolates the velocity at a given offset
    UI_CHECKRETURN HRESULT
    InterpolateVelocity
    (
                  [in, annotation("_In_")] UI_ANIMATION_SECONDS offset,                     // The offset
        [out, retval, annotation("_Out_")] DOUBLE *velocity                                 // The interpolated velocity
    );
    
    // Get's the interpolator's dependencies
    UI_CHECKRETURN HRESULT
    GetDependencies
    (
        [out, annotation("_Out_")] UI_ANIMATION_DEPENDENCIES *initialValueDependencies,     // The aspects of the interpolator that depend on its initial value
        [out, annotation("_Out_")] UI_ANIMATION_DEPENDENCIES *initialVelocityDependencies,  // The aspects of the interpolator that depend on its initial velocity
        [out, annotation("_Out_")] UI_ANIMATION_DEPENDENCIES *durationDependencies          // The aspects of the interpolator that depend on its duration
    );
};

// Defines methods for creating transitions from custom interpolators
[
    local,
    object,
    uuid(FCD91E03-3E3B-45ad-BBB1-6DFC8153743D),
    helpstring("IUIAnimationTransitionFactory Interface"),
    pointer_default(unique)
]
interface IUIAnimationTransitionFactory : IUnknown
{
    // Creates a transition from a custom interpolator
    UI_CHECKRETURN HRESULT
    CreateTransition
    (
                        [in, annotation("_In_")] IUIAnimationInterpolator *interpolator,    // The interpolator to create a transition from
        [out, retval, annotation("_Outptr_")] IUIAnimationTransition **transition        // The new transition
    );
};


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Timer API

// Defines behaviors for a timer when its client is idle
typedef [v1_enum] enum
{
    UI_ANIMATION_IDLE_BEHAVIOR_CONTINUE             = 0,                                    // The timer continues to generate timer events (is enabled) when the client is idle
    UI_ANIMATION_IDLE_BEHAVIOR_DISABLE              = 1                                     // The timer is suspended (disabled) when the animation manager is idle
} UI_ANIMATION_IDLE_BEHAVIOR;

// Defines an animation timer, which provides services for managing animation timing
[
    local,
    object,
    uuid(6B0EFAD1-A053-41d6-9085-33A689144665),
    helpstring("IUIAnimationTimer Interface"),
    pointer_default(unique)
]
interface IUIAnimationTimer : IUnknown
{
    // Specifies a handler for timing updates
    UI_CHECKRETURN HRESULT
    SetTimerUpdateHandler
    (
        [in, unique, annotation("_In_opt_")] IUIAnimationTimerUpdateHandler *updateHandler, // A handler for timing events
                    [in, annotation("_In_")] UI_ANIMATION_IDLE_BEHAVIOR idleBehavior        // The desired behavior of the timer when it is idle
    );
    
    // Specifies a handler for timing events
    UI_CHECKRETURN HRESULT
    SetTimerEventHandler
    (
        [in, unique, annotation("_In_opt_")] IUIAnimationTimerEventHandler *handler         // A handler for timing events
    );
    
    // Enables the animation timer
    UI_CHECKRETURN HRESULT
    Enable
    (
    );
    
    // Disables the animation timer
    UI_CHECKRETURN HRESULT
    Disable
    (
    );
    
    // Determines whether the timer is currently enabled
    UI_CHECKRETURN HRESULT
    IsEnabled
    (
    );
    
    // Gets the current time
    UI_CHECKRETURN HRESULT
    GetTime
    (
        [out, annotation("_Out_")] UI_ANIMATION_SECONDS *seconds                            // Current update time
    );
    
    // Sets the frame rate below which the timer event handler will be called
    UI_CHECKRETURN HRESULT
    SetFrameRateThreshold
    (
        [in, annotation("_In_")] UINT32 framesPerSecond                                     // The minimum acceptable frame rate, in frames-per-second
    );
};

// Defines methods for handling timing update events
[
    local,
    object,
    uuid(195509B7-5D5E-4e3e-B278-EE3759B367AD),
    helpstring("IUIAnimationTimerUpdateHandler Interface"),
    pointer_default(unique)
]
interface IUIAnimationTimerUpdateHandler : IUnknown
{
    // Handles OnUpdate events, which occur when it is time to update an animation
    UI_CHECKRETURN HRESULT
    OnUpdate
    (
                  [in, annotation("_In_")] UI_ANIMATION_SECONDS timeNow,                    // The current time
        [out, retval, annotation("_Out_")] UI_ANIMATION_UPDATE_RESULT *result               // The result of the animation update
    );
    
    // Specifies a handler for timer client status change events
    UI_CHECKRETURN HRESULT
    SetTimerClientEventHandler
    (
        [in, annotation("_In_")] IUIAnimationTimerClientEventHandler *handler               // A handler for timer client events
    );
    
    // Clears the handler for timer client status change events
    UI_CHECKRETURN HRESULT
    ClearTimerClientEventHandler
    (
    );
};

// Defines activity status for a timer's client
typedef [v1_enum] enum
{
    UI_ANIMATION_TIMER_CLIENT_IDLE                  = 0,                                    // The timer's client is idle
    UI_ANIMATION_TIMER_CLIENT_BUSY                  = 1                                     // The timer's client is busy
} UI_ANIMATION_TIMER_CLIENT_STATUS;

// Defines methods for handling events related to changes in timer client status
[
    local,
    object,
    uuid(BEDB4DB6-94FA-4bfb-A47F-EF2D9E408C25),
    helpstring("IUIAnimationTimerClientEventHandler Interface"),
    pointer_default(unique)
]
interface IUIAnimationTimerClientEventHandler  : IUnknown
{
    // Handles OnTimerClientStatusChanged events, which occur when the timer client's status changes
    UI_CHECKRETURN HRESULT
    OnTimerClientStatusChanged
    (
        [in, annotation("_In_")] UI_ANIMATION_TIMER_CLIENT_STATUS newStatus,                // The new status
        [in, annotation("_In_")] UI_ANIMATION_TIMER_CLIENT_STATUS previousStatus            // The previous status
    );
};

// Defines methods for handling timing events
[
    local,
    object,
    uuid(274A7DEA-D771-4095-ABBD-8DF7ABD23CE3),
    helpstring("IUIAnimationTimerEventHandler Interface"),
    pointer_default(unique)
]
interface IUIAnimationTimerEventHandler : IUnknown
{
    // Handles OnPreUpdate events, which occur before an animation update begins
    UI_CHECKRETURN HRESULT
    OnPreUpdate
    (
    );
    
    // Handles OnPostUpdate events, which occur after an animation update is finished
    UI_CHECKRETURN HRESULT
    OnPostUpdate
    (
    );
    
    // Handles OnRenderingTooSlow events, which occur when the rendering frame rate for an animation falls below the minimum acceptable frame rate
    UI_CHECKRETURN HRESULT
    OnRenderingTooSlow
    (
        [in, annotation("_In_")] UINT32 framesPerSecond                                     // The current frame rate, in frames-per-second
    );
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// V2 API * * *
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Animation API

// Special value for EstimateNextEventTime which indicates that there are no more scheduled events
const UI_ANIMATION_SECONDS UI_ANIMATION_SECONDS_INFINITE = -1.0;

// Defines the animation manager, which provides a central interface for creating and managing UI animations
[
    local,
    object,
    uuid(D8B6F7D4-4109-4d3f-ACEE-879926968CB1),
    helpstring("IUIAnimationManager2 Interface"),
    pointer_default(unique)
]
interface IUIAnimationManager2 : IUnknown
{
    // Creates a new vector animation variable
    UI_CHECKRETURN HRESULT
    CreateAnimationVectorVariable
    (
        [in, annotation("_In_reads_(cDimension)")] const DOUBLE *initialValue,             // The initial value for the variable
                           [in, annotation("_In_")] UINT cDimension,                       // Number of animated values
           [out, retval, annotation("_Outptr_")] IUIAnimationVariable2 **variable          // The new animation variable
    );
    
    // Creates a new scalar animation variable
    UI_CHECKRETURN HRESULT
    CreateAnimationVariable
    (
                        [in, annotation("_In_")] DOUBLE initialValue,                       // The initial value for the variable
        [out, retval, annotation("_Outptr_")] IUIAnimationVariable2 **variable           // The new animation variable
    );

    // Creates and schedules a single-transition storyboard
    UI_CHECKRETURN HRESULT
    ScheduleTransition
    (
        [in, annotation("_In_")] IUIAnimationVariable2 *variable,                            // The variable to schedule for transition
        [in, annotation("_In_")] IUIAnimationTransition2 *transition,                        // The transition to apply to the variable
        [in, annotation("_In_")] UI_ANIMATION_SECONDS timeNow                                // The current time
    );

    // Creates a new storyboard
    UI_CHECKRETURN HRESULT
    CreateStoryboard
    (
        [out, retval, annotation("_Outptr_")] IUIAnimationStoryboard2 **storyboard        // The new storyboard
    );

    // Directs the animation manager to finish all active storyboards
    UI_CHECKRETURN HRESULT
    FinishAllStoryboards
    (
        [in, annotation("_In_")] UI_ANIMATION_SECONDS completionDeadline                     // The maximum amount of time any storyboard is allowed
    );
    
    // Directs the animation manager to abandon all active storyboards
    UI_CHECKRETURN HRESULT
    AbandonAllStoryboards
    (
    );
    
    // Directs the animation manager to update the elapsed time for all scheduled storyboards
    UI_CHECKRETURN HRESULT 
    Update
    (
            [in, annotation("_In_")] UI_ANIMATION_SECONDS timeNow,                           // The current time
        [out, defaultvalue(0),
            annotation("_Out_opt_")] UI_ANIMATION_UPDATE_RESULT *updateResult                // The update result
    );
    
    // Gets the animation variable with a specified tag
    UI_CHECKRETURN HRESULT
    GetVariableFromTag
    (
            [in, unique, annotation("_In_opt_")] IUnknown *object,                           // The tag object
                        [in, annotation("_In_")] UINT32 id,                                  // The tag ID
        [out, retval, annotation("_Outptr_")] IUIAnimationVariable2 **variable            // The animation variable that matches the specified tag, or NULL if no match is found
    );
    
    // Gets the storyboard with a specified tag
    UI_CHECKRETURN HRESULT
    GetStoryboardFromTag
    (
            [in, unique, annotation("_In_opt_")] IUnknown *object,                           // The tag object
                        [in, annotation("_In_")] UINT32 id,                                  // The tag ID
        [out, retval, annotation("_Outptr_")] IUIAnimationStoryboard2 **storyboard        // The animation storyboard that matches the specified tag, or NULL if no match is found
    );
    
    // Returns the estimated next animation event time
    UI_CHECKRETURN HRESULT
    EstimateNextEventTime
    (
        [out, retval, annotation("_Out_")] UI_ANIMATION_SECONDS *seconds                     // The returned time at which the next event occurs
    );

    // Gets the animation manager's status
    UI_CHECKRETURN HRESULT
    GetStatus
    (
        [out, retval, annotation("_Out_")] UI_ANIMATION_MANAGER_STATUS *status               // The animation manager's status
    );
    
    // Sets the animation mode for the animation manager
    UI_CHECKRETURN HRESULT
    SetAnimationMode
    (
        [in, annotation("_In_")] UI_ANIMATION_MODE mode                                      // The animation mode
    );
    
    // Pauses all animations
    UI_CHECKRETURN HRESULT
    Pause
    (
    );
    
    // Resumes all animations
    UI_CHECKRETURN HRESULT
    Resume
    (
    );
    
    // Specifies a handler for animation manager status updates
    UI_CHECKRETURN HRESULT
    SetManagerEventHandler
    (
                 [in, unique, annotation("_In_opt_")] IUIAnimationManagerEventHandler2 *handler,    // A handler for animation manager status update events
        [in, defaultvalue(FALSE), annotation("_In_")] BOOL fRegisterForNextAnimationEvent           // Register this manager's events to be incorporated into next event time
    );
    
    // Sets a priority comparison handler for cancellation
    UI_CHECKRETURN HRESULT
    SetCancelPriorityComparison
    (
        [in, unique, annotation("_In_opt_")] IUIAnimationPriorityComparison2 *comparison     // The handler for priority comparisons to determine if a scheduled storyboard can be cancelled
    );
    
    // Sets a priority comparison handler for trimming
    UI_CHECKRETURN HRESULT
    SetTrimPriorityComparison
    (
        [in, unique, annotation("_In_opt_")] IUIAnimationPriorityComparison2 *comparison     // The handler for priority comparisons to determine if a scheduled storyboard can be trimmed
    );
    
    // Sets a priority comparison handler for compression
    UI_CHECKRETURN HRESULT
    SetCompressPriorityComparison
    (
        [in, unique, annotation("_In_opt_")]  IUIAnimationPriorityComparison2 *comparison    // The handler for priority comparisons to determine if a scheduled storyboard can be compressed
    );
    
    // Sets a priority comparison handler for conclusion
    UI_CHECKRETURN HRESULT
    SetConcludePriorityComparison
    (
        [in, unique, annotation("_In_opt_")] IUIAnimationPriorityComparison2 *comparison     // The handler for priority comparisons to determine if a scheduled storyboard can be concluded
    );
    
    // Sets the default acceptable animation delay
    UI_CHECKRETURN HRESULT
    SetDefaultLongestAcceptableDelay
    (
        [in, annotation("_In_")] UI_ANIMATION_SECONDS delay                                  // The default value for acceptable delay before scheduled storyboards start
    );
    
    // Shuts down the animation manager and all objects it has created
    UI_CHECKRETURN HRESULT
    Shutdown
    (
    );
};

// Defines a WAM2 animation variable, which represents a value that may be animated
[
    local,
    object,
    uuid(4914B304-96AB-44d9-9E77-D5109B7E7466),
    helpstring("IUIAnimationVariable2 Interface"),
    pointer_default(unique)
]
interface IUIAnimationVariable2 : IUnknown
{
    // Gets the animation variable's current value
    UI_CHECKRETURN HRESULT
    GetDimension
    (
        [out, retval, annotation("_Out_")] UINT *dimension                         // The number of dimensions animated by the variable
    );

    // Gets the animation variable's current value
    UI_CHECKRETURN HRESULT
    GetValue
    (
        [out, retval, annotation("_Out_")] DOUBLE *value                           // The current value
    );

    // Gets the animation variable's current value
    UI_CHECKRETURN HRESULT
    GetVectorValue
    (
        [out, annotation("_Out_writes_(cDimension)")] DOUBLE *value,               // The current value
                             [in, annotation("_In_")] UINT cDimension              // Number of animated values                                  
    );

    // Gets the animation variable's IDCompositionAnimation curve
    UI_CHECKRETURN HRESULT
    GetCurve
    (
        [in, annotation("_In_")] IDCompositionAnimation *animation                 // Pointer to IDCompositionAnimation to be called back with curve info
    );

    // Gets the animation variable's IDCompositionAnimation curve
    UI_CHECKRETURN HRESULT
    GetVectorCurve
    (
        [in, annotation("_In_reads_(cDimension)")] IDCompositionAnimation **animation,    // Pointer to array of IDCompositionAnimation pointers to be called back with curve info
                           [in, annotation("_In_")] UINT cDimension                        // Number of animation curves in array
    );

    // Gets the animation variable's final value, after all currently scheduled animations have finished
    UI_CHECKRETURN HRESULT
    GetFinalValue
    (
        [out, retval, annotation("_Out_")] DOUBLE *finalValue                      // The final value
    );

    UI_CHECKRETURN HRESULT
    GetFinalVectorValue
    (
        [out, annotation("_Out_writes_(cDimension)")] DOUBLE *finalValue,          // The final value
                             [in, annotation("_In_")] UINT cDimension              // Number of animated values                                  
    );

    // Gets the animation variable's value before the most recent update
    UI_CHECKRETURN HRESULT
    GetPreviousValue
    (
        [out, retval, annotation("_Out_")] DOUBLE *previousValue                   // The previous value
    );

    UI_CHECKRETURN HRESULT
    GetPreviousVectorValue
    (
        [out, annotation("_Out_writes_(cDimension)")] DOUBLE *previousValue,       // The previous value
                             [in, annotation("_In_")] UINT cDimension              // Number of animated values                                  
    );

    // Gets the animation variable's current value, converted to INT32
    UI_CHECKRETURN HRESULT
    GetIntegerValue
    (
        [out, retval, annotation("_Out_")] INT32 *value                            // The animation variable's current value, converted to INT32 
    );

    // Gets the animation variable's current value, converted to INT32
    UI_CHECKRETURN HRESULT
    GetIntegerVectorValue
    (
        [out, annotation("_Out_writes_(cDimension)")] INT32 *value,                // The animation variable's current value, converted to INT32 
                             [in, annotation("_In_")] UINT cDimension              // Number of animated values                                  
    );

    // Gets the animation variable's final value, converted to INT32
    UI_CHECKRETURN HRESULT
    GetFinalIntegerValue
    (
        [out, retval, annotation("_Out_")] INT32 *finalValue                       // The animation variable's final value, converted to INT32
    );

    UI_CHECKRETURN HRESULT
    GetFinalIntegerVectorValue
    (
        [out, annotation("_Out_writes_(cDimension)")] INT32 *finalValue,           // The animation variable's final value, converted to INT32
                             [in, annotation("_In_")] UINT cDimension              // Number of animated values                                  
    );

    // Gets the animation variable's value before the most recent update, converted to INT32
    UI_CHECKRETURN HRESULT
    GetPreviousIntegerValue
    (
        [out, retval, annotation("_Out_")] INT32 *previousValue                    // The animation variable's previous value, converted to INT32
    );

    UI_CHECKRETURN HRESULT
    GetPreviousIntegerVectorValue
    (
        [out, annotation("_Out_writes_(cDimension)")] INT32 *previousValue,        // The animation variable's previous value, converted to INT32
                             [in, annotation("_In_")] UINT cDimension              // Number of animated values                                  
    );

    // Gets the storyboard that is currently animating the variable
    UI_CHECKRETURN HRESULT
    GetCurrentStoryboard
    (
        [out, retval, annotation("_Outptr_")] IUIAnimationStoryboard2 **storyboard       // The current storyboard, or NULL if no storyboard is currently animating the variable
    );

    // Sets the lower bound (floor) for the animation variable's value
    UI_CHECKRETURN HRESULT
    SetLowerBound
    (
        [in, annotation("_In_")] DOUBLE bound                                      // The lower bound
    );                                                                        

    UI_CHECKRETURN HRESULT
    SetLowerBoundVector
    (                   
        [out, annotation("_In_reads_(cDimension)")] const DOUBLE *bound,         // The lower bound
                             [in, annotation("_In_")] UINT cDimension              // Number of animated values                                  
    );                                                                  

    // Sets the upper bound (ceiling) for the animation variable's value
    UI_CHECKRETURN HRESULT
    SetUpperBound
    (
        [in, annotation("_In_")] DOUBLE bound                                      // The upper bound
    );

    UI_CHECKRETURN HRESULT
    SetUpperBoundVector
    (                                                                   
        [out, annotation("_In_reads_(cDimension)")] const DOUBLE *bound,         // The upper bound
                             [in, annotation("_In_")] UINT cDimension              // Number of animated values      
    );

    // Specifies a rounding mode for the animation variable
    UI_CHECKRETURN HRESULT
    SetRoundingMode
    (
        [in, annotation("_In_")] UI_ANIMATION_ROUNDING_MODE mode                   // A rounding mode for the animation variable
    );
    
    // Sets the animation variable's object/ID tag
    UI_CHECKRETURN HRESULT
    SetTag
    (
        [in, unique, annotation("_In_opt_")] IUnknown *object,                     // The tag object
                    [in, annotation("_In_")] UINT32 id                             // The tag ID
    );
    
    // Gets the animation variable's object/ID tag
    UI_CHECKRETURN HRESULT
    GetTag
    (
        [out, annotation("_Outptr_opt_")] IUnknown **object,                    // The tag object
              [out, annotation("_Out_opt_")] UINT32 *id                            // The tag ID
    );

    // Specifies a handler for value updates
    UI_CHECKRETURN HRESULT
    SetVariableChangeHandler
    (
                 [in, unique, annotation("_In_opt_")] IUIAnimationVariableChangeHandler2 *handler,          // A handler for animation variable value updates
        [in, defaultvalue(FALSE), annotation("_In_")] BOOL fRegisterForNextAnimationEvent                   // Register this variable's events to be incorporated into next event time
    );

    // Specifies a handler for value updates; values are converted to INT32
    UI_CHECKRETURN HRESULT
    SetVariableIntegerChangeHandler
    (
                 [in, unique, annotation("_In_opt_")] IUIAnimationVariableIntegerChangeHandler2 *handler,   // A handler for animation variable integer value updates
        [in, defaultvalue(FALSE), annotation("_In_")] BOOL fRegisterForNextAnimationEvent                   // Register this variable's events to be incorporated into next event time
    );

    // Specifies a handler for to receive notifications that an animation variable's scheduled animation has been changed
    // due to some scheduling action that was taken
    UI_CHECKRETURN HRESULT
    SetVariableCurveChangeHandler
    (
        [in, unique, annotation("_In_opt_")] IUIAnimationVariableCurveChangeHandler2 *handler               // A handler for animation variable curve change events
    );
};

// Returned by interpolators in GetDimension to indicate that this interpolator's dimension
// value has not yet been determined
const UINT UI_ANIMATION_DIMENSION_UNKNOWN = (UINT)(-1);

[
    local,
    object,
    uuid(62FF9123-A85A-4e9b-A218-435A93E268FD),
    helpstring("IUIAnimationTransition2 Interface"),
    pointer_default(unique)
]
interface IUIAnimationTransition2 : IUnknown
{
    // Gets the animation variable's current value
    UI_CHECKRETURN HRESULT
    GetDimension
    (
        [out, retval, annotation("_Out_")] UINT *dimension                 // The number of dimensions animated by the transition
    );

    // Forces the transition to start at a given initial value
    UI_CHECKRETURN HRESULT
    SetInitialValue
    (
        [in, annotation("_In_")] DOUBLE value                              // The initial value
    );
    
    // Forces the transition to start at a given initial value
    UI_CHECKRETURN HRESULT
    SetInitialVectorValue
    (
         [in, annotation("_In_reads_(cDimension)")] const DOUBLE *value,   // The initial value
                            [in, annotation("_In_")] UINT cDimension       // Number of animated values
    );
    
    // Forces the transition to start with a given initial velocity
    UI_CHECKRETURN HRESULT
    SetInitialVelocity
    (
        [in, annotation("_In_")] DOUBLE velocity                           // The initial velocity
    );

    // Forces the transition to start with a given initial velocity
    UI_CHECKRETURN HRESULT
    SetInitialVectorVelocity
    (
         [in, annotation("_In_reads_(cDimension)")] const DOUBLE *velocity,  // The initial velocity
                            [in, annotation("_In_")] UINT cDimension         // Number of animated values
    );

    // Determines whether a transition's duration is currently known
    UI_CHECKRETURN HRESULT
    IsDurationKnown
    (
    );
    
    // Gets the transition's duration
    UI_CHECKRETURN HRESULT
    GetDuration
    (
        [out, retval, annotation("_Out_")] UI_ANIMATION_SECONDS *duration  // The duration
    );
};

// Defines methods for handling animation manager status change events
[
    local,
    object,
    uuid(F6E022BA-BFF3-42EC-9033-E073F33E83C3),
    helpstring("IUIAnimationManagerEventHandler2 Interface"),
    pointer_default(unique)
]
interface IUIAnimationManagerEventHandler2 : IUnknown
{
    // Handles OnManagerStatusChanged events, which occur when the animation manager's status changes
    UI_CHECKRETURN HRESULT
    OnManagerStatusChanged
    (
        [in, annotation("_In_")] UI_ANIMATION_MANAGER_STATUS newStatus,                     // The new status
        [in, annotation("_In_")] UI_ANIMATION_MANAGER_STATUS previousStatus                 // The previous status
    );
};

[
    local,
    object,
    uuid(63ACC8D2-6EAE-4bb0-B879-586DD8CFBE42),
    helpstring("IUIAnimationVariableChangeHandler2 Interface"),
    pointer_default(unique)
]
interface IUIAnimationVariableChangeHandler2 : IUnknown
{
    // Handles OnValueChanged events, which occur when an animation variable's value changes; receives value updates as DOUBLE
    UI_CHECKRETURN HRESULT
    OnValueChanged
    (
                           [in, annotation("_In_")] IUIAnimationStoryboard2 *storyboard,   // The storyboard that is animating the variable
                           [in, annotation("_In_")] IUIAnimationVariable2 *variable,       // The animation variable that was updated
        [in, annotation("_In_reads_(cDimension)")] DOUBLE *newValue,                      // The new value
        [in, annotation("_In_reads_(cDimension)")] DOUBLE *previousValue,                 // The previous value
                           [in, annotation("_In_")] UINT cDimension                        // Number of animated values
    );
};

[
    local,
    object,
    uuid(829B6CF1-4F3A-4412-AE09-B243EB4C6B58),
    helpstring("IUIAnimationVariableIntegerChangeHandler2 Interface"),
    pointer_default(unique)
]
interface IUIAnimationVariableIntegerChangeHandler2 : IUnknown
{
    // Handles OnIntegerValueChanged events, which occur when an animation variable's rounded value changes; receives value updates as INT32
    UI_CHECKRETURN HRESULT
    OnIntegerValueChanged
    (
                            [in, annotation("_In_")] IUIAnimationStoryboard2 *storyboard,      // The storyboard that is animating the variable 
                            [in, annotation("_In_")] IUIAnimationVariable2 *variable,          // The animation variable that was updated
         [in, annotation("_In_reads_(cDimension)")] INT32 *newValue,                          // The new rounded value
         [in, annotation("_In_reads_(cDimension)")] INT32 *previousValue,                     // The previous rounded value
                            [in, annotation("_In_")] UINT cDimension                           // Number of animated values
    );                                                              
};

[
    local,
    object,
    uuid(72895E91-0145-4C21-9192-5AAB40EDDF80),
    helpstring("IUIAnimationVariableCurveChangeHandler2 Interface"),
    pointer_default(unique)
]
interface IUIAnimationVariableCurveChangeHandler2 : IUnknown
{
    // Handles curve change events which occur when the scheduled animation for an animation variable is altered due to some scheduling action
    UI_CHECKRETURN HRESULT
    OnCurveChanged
    (
        [in, annotation("_In_")] IUIAnimationVariable2 *variable                              // The animation variable whose curve has been updated
    );                                                              
};

// Defines methods for handling animation storyboard update events
[
    local,
    object,
    uuid(BAC5F55A-BA7C-414C-B599-FBF850F553C6),
    helpstring("IUIAnimationStoryboardEventHandler Interface"),
    pointer_default(unique)
]
interface IUIAnimationStoryboardEventHandler2  : IUnknown
{
    // Handles OnStoryboardStatusChanged events, which occur when a storyboard's status changes
    UI_CHECKRETURN HRESULT
    OnStoryboardStatusChanged
    (
        [in, annotation("_In_")] IUIAnimationStoryboard2 *storyboard,                       // The storyboard that changed status
        [in, annotation("_In_")] UI_ANIMATION_STORYBOARD_STATUS newStatus,                  // The new status
        [in, annotation("_In_")] UI_ANIMATION_STORYBOARD_STATUS previousStatus              // The previous status 
    );
    
    // Handles OnStoryboardUpdated events, which occur when a storyboard is updated
    UI_CHECKRETURN HRESULT
    OnStoryboardUpdated
    (
        [in, annotation("_In_")] IUIAnimationStoryboard2 *storyboard                        // The storyboard that was updated
    );
};

// This value will be passed into IUIAnimationLoopIterationChangeHandler2::OnLoopIterationChanged's
// oldIterationCount parameter to indicate that this is the first time a given loop has been entered
const UINT32 UI_ANIMATION_ITERATION_NONE = (UINT32)-1;

// Defines methods for handling storyboard loop iteration events
[
    local,
    object,
    uuid(2D3B15A4-4762-47AB-A030-B23221DF3AE0),
    helpstring("IUIAnimationLoopIterationChangeHandler2 Interface"),
    pointer_default(unique)
]
interface IUIAnimationLoopIterationChangeHandler2  : IUnknown
{
    // Handles loop iteration change events, which occur when a loop within a storyboard begins a new iteration
    UI_CHECKRETURN HRESULT
    OnLoopIterationChanged
    (
        [in, annotation("_In_")] IUIAnimationStoryboard2 *storyboard,  // The storyboard to which the loop belongs
        [in, annotation("_In_")] UINT_PTR id,                          // The ID of the loop
        [in, annotation("_In_")] UINT32 newIterationCount,             // The new loop iteration count
        [in, annotation("_In_")] UINT32 oldIterationCount              // The old loop iteration count
    );
};

// Defines a priority comparison that the animation manager uses to resolve scheduling conflicts
[
    local,
    object,
    uuid(5B6D7A37-4621-467C-8B05-70131DE62DDB),
    helpstring("IUIAnimationPriorityComparison2 Interface"),
    pointer_default(unique)
]
interface IUIAnimationPriorityComparison2 : IUnknown
{
    // Determines the relative priority between a scheduled storyboard and a new storyboard
    UI_CHECKRETURN HRESULT
    HasPriority
    (
        [in, annotation("_In_")] IUIAnimationStoryboard2 *scheduledStoryboard,               // The currently scheduled storyboard
        [in, annotation("_In_")] IUIAnimationStoryboard2 *newStoryboard,                     // The new storyboard that is in scheduling conflict with scheduledStoryboard
        [in, annotation("_In_")] UI_ANIMATION_PRIORITY_EFFECT priorityEffect                // The effect on newStoryboard if scheduledStoryboard has priority
    );
};

// Defines a library of standard transitions
[
    local,
    object,
    uuid(03CFAE53-9580-4ee3-B363-2ECE51B4AF6A),
    helpstring("IUIAnimationTransitionLibrary2 Interface"),
    pointer_default(unique)
]
interface IUIAnimationTransitionLibrary2 : IUnknown
{
    // Creates a scalar instantaneous transition
    UI_CHECKRETURN HRESULT
    CreateInstantaneousTransition
    (
                        [in, annotation("_In_")] DOUBLE finalValue,                         // The final value this transition leads to when applied to an animation variable
        [out, retval, annotation("_Outptr_")] IUIAnimationTransition2 **transition       // The new instantaneous transition
    );

    // Creates a vector instantaneous transition
    UI_CHECKRETURN HRESULT
    CreateInstantaneousVectorTransition
    (
        [in, annotation("_In_reads_(cDimension)")] const DOUBLE *finalValue,                // The final value this transition leads to when applied to an animation variable
                           [in, annotation("_In_")] UINT cDimension,                        // Number of animated values
           [out, retval, annotation("_Outptr_")] IUIAnimationTransition2 **transition       // The new instantaneous transition
    );

    // Creates a constant-value transition
    UI_CHECKRETURN HRESULT
    CreateConstantTransition
    (
                        [in, annotation("_In_")] UI_ANIMATION_SECONDS duration,             // The transition duration
        [out, retval, annotation("_Outptr_")] IUIAnimationTransition2 **transition       // The new constant-value transition
    );

    // Creates a scalar discrete transition
    UI_CHECKRETURN HRESULT
    CreateDiscreteTransition
    (
                        [in, annotation("_In_")] UI_ANIMATION_SECONDS delay,                // The delay before the variable changes value
                        [in, annotation("_In_")] DOUBLE finalValue,                         // The final value this transition leads to when applied to an animation variable
                        [in, annotation("_In_")] UI_ANIMATION_SECONDS hold,                 // The hold time at the final value
        [out, retval, annotation("_Outptr_")] IUIAnimationTransition2 **transition       // The new discrete transition
    );

    // Creates a vector discrete transition
    UI_CHECKRETURN HRESULT
    CreateDiscreteVectorTransition
    (
                            [in, annotation("_In_")] UI_ANIMATION_SECONDS delay,            // The delay before the variable changes value
         [in, annotation("_In_reads_(cDimension)")] const DOUBLE *finalValue,               // The final value this transition leads to when applied to an animation variable
                            [in, annotation("_In_")] UINT cDimension,                       // Number of animated values
                            [in, annotation("_In_")] UI_ANIMATION_SECONDS hold,             // The hold time at the final value
            [out, retval, annotation("_Outptr_")] IUIAnimationTransition2 **transition   // The new discrete transition
    );

    // Creates a scalar linear transition
    UI_CHECKRETURN HRESULT
    CreateLinearTransition
    (
                        [in, annotation("_In_")] UI_ANIMATION_SECONDS duration,             // The transition duration
                        [in, annotation("_In_")] DOUBLE finalValue,                         // The final value this transition leads to when applied to an animation variable
        [out, retval, annotation("_Outptr_")] IUIAnimationTransition2 **transition       // The new linear transition
    );

    // Creates a vector linear transition
    UI_CHECKRETURN HRESULT
    CreateLinearVectorTransition
    (
                           [in, annotation("_In_")] UI_ANIMATION_SECONDS duration,         // The transition duration
        [in, annotation("_In_reads_(cDimension)")] const DOUBLE *finalValue,               // The final value this transition leads to when applied to an animation variable
                           [in, annotation("_In_")] UINT cDimension,                       // Number of animated values
           [out, retval, annotation("_Outptr_")] IUIAnimationTransition2 **transition   // The new linear transition
    );
    
    // Creates a scalar linear transition with a given speed
    UI_CHECKRETURN HRESULT
    CreateLinearTransitionFromSpeed
    (
                        [in, annotation("_In_")] DOUBLE speed,                              // The speed, in units/second, at which the variable will transition to the final value
                        [in, annotation("_In_")] DOUBLE finalValue,                         // The final value this transition leads to when applied to an animation variable
        [out, retval, annotation("_Outptr_")] IUIAnimationTransition2 **transition       // The new linear transition
    );

    // Creates a vector linear transition with a given speed
    UI_CHECKRETURN HRESULT
    CreateLinearVectorTransitionFromSpeed
    (
                           [in, annotation("_In_")] DOUBLE speed,                              // The speed, in units/second, at which the variable will transition to the final value (cartesian length)
        [in, annotation("_In_reads_(cDimension)")] const DOUBLE *finalValue,                   // The final value this transition leads to when applied to an animation variable
                           [in, annotation("_In_")] UINT cDimension,                           // Number of animated values
           [out, retval, annotation("_Outptr_")] IUIAnimationTransition2 **transition          // The new linear transition
    );

    // Creates a scalar sinusoidal transition with an amplitude determined by its initial velocity
    UI_CHECKRETURN HRESULT
    CreateSinusoidalTransitionFromVelocity
    (
                        [in, annotation("_In_")] UI_ANIMATION_SECONDS duration,             // The transition duration
                        [in, annotation("_In_")] UI_ANIMATION_SECONDS period,               // The duration of each cycle
        [out, retval, annotation("_Outptr_")] IUIAnimationTransition2 **transition          // The new sinusoidal transition
    );

    // Creates a scalar sinusoidal transition with a given range of oscillation
    UI_CHECKRETURN HRESULT
    CreateSinusoidalTransitionFromRange
    (
                        [in, annotation("_In_")] UI_ANIMATION_SECONDS duration,             // The transition duration
                        [in, annotation("_In_")] DOUBLE minimumValue,                       // The value at each trough of the sine wave
                        [in, annotation("_In_")] DOUBLE maximumValue,                       // The value at each peak of the sine wave
                        [in, annotation("_In_")] UI_ANIMATION_SECONDS period,               // The duration of each cycle
                        [in, annotation("_In_")] UI_ANIMATION_SLOPE slope,                  // The slope at the start of the transition
        [out, retval, annotation("_Outptr_")] IUIAnimationTransition2 **transition          // The new sinusoidal transition
    );

    // Creates a scalar accelerate-decelerate transition
    UI_CHECKRETURN HRESULT
    CreateAccelerateDecelerateTransition
    (
                        [in, annotation("_In_")] UI_ANIMATION_SECONDS duration,             // The transition duration
                        [in, annotation("_In_")] DOUBLE finalValue,                         // The final value this transition leads to when applied to an animation variable
                        [in, annotation("_In_")] DOUBLE accelerationRatio,                  // The fraction of the duration to spend accelerating (0 to 1)
                        [in, annotation("_In_")] DOUBLE decelerationRatio,                  // The fraction of the duration to spend decelerating (0 to 1)
        [out, retval, annotation("_Outptr_")] IUIAnimationTransition2 **transition       // The new accelerate-decelerate transition
    );

    // Creates a reversal transition
    UI_CHECKRETURN HRESULT
    CreateReversalTransition
    (
                        [in, annotation("_In_")] UI_ANIMATION_SECONDS duration,             // The transition duration
        [out, retval, annotation("_Outptr_")] IUIAnimationTransition2 **transition       // The new reversal transition
    );

    // Creates a scalar cubic transition
    UI_CHECKRETURN HRESULT
    CreateCubicTransition
    (
                        [in, annotation("_In_")] UI_ANIMATION_SECONDS duration,             // The transition duration
                        [in, annotation("_In_")] DOUBLE finalValue,                         // The final value this transition leads to when applied to an animation variable
                        [in, annotation("_In_")] DOUBLE finalVelocity,                      // The final velocity, in units/second
        [out, retval, annotation("_Outptr_")] IUIAnimationTransition2 **transition       // The new cubic transition
    );

    // Creates a vector cubic transition
    UI_CHECKRETURN HRESULT
    CreateCubicVectorTransition
    (
                           [in, annotation("_In_")] UI_ANIMATION_SECONDS duration,         // The transition duration
        [in, annotation("_In_reads_(cDimension)")] const DOUBLE *finalValue,               // The final value this transition leads to when applied to an animation variable
        [in, annotation("_In_reads_(cDimension)")] const DOUBLE *finalVelocity,            // The final velocity, in units/second
                           [in, annotation("_In_")] UINT cDimension,                       // Number of animated values
           [out, retval, annotation("_Outptr_")] IUIAnimationTransition2 **transition      // The new cubic transition
    );
    
    // Creates a scalar smooth-stop transition
    UI_CHECKRETURN HRESULT
    CreateSmoothStopTransition
    (
                        [in, annotation("_In_")] UI_ANIMATION_SECONDS maximumDuration,      // The maximum duration for the transition
                        [in, annotation("_In_")] DOUBLE finalValue,                         // The final value this transition leads to when applied to an animation variable
        [out, retval, annotation("_Outptr_")] IUIAnimationTransition2 **transition          // The new smooth-stop transition
    );

    // Creates a scalar parabolic transition with a given acceleration    
    UI_CHECKRETURN HRESULT
    CreateParabolicTransitionFromAcceleration
    (
                        [in, annotation("_In_")] DOUBLE finalValue,                         // The final value this transition leads to when applied to an animation variable
                        [in, annotation("_In_")] DOUBLE finalVelocity,                      // The final velocity, in units/second
                        [in, annotation("_In_")] DOUBLE acceleration,                       // The rate of change of the velocity, in units/second^2
        [out, retval, annotation("_Outptr_")] IUIAnimationTransition2 **transition       // The new parabolic transition
    );

    // Creates a scalar cubic bezier linear transition
    UI_CHECKRETURN HRESULT
    CreateCubicBezierLinearTransition
    (
                [in, annotation("_In_")] UI_ANIMATION_SECONDS duration,                     // Duration of the transition
                [in, annotation("_In_")] DOUBLE finalValue,                                 // The final value this transition leads to when applied to an animation variable
                [in, annotation("_In_")] DOUBLE x1,                                         // Time transformation Bezier point 1 X value
                [in, annotation("_In_")] DOUBLE y1,                                         // Time transformation Bezier point 1 Y value
                [in, annotation("_In_")] DOUBLE x2,                                         // Time transformation Bezier point 2 X value
                [in, annotation("_In_")] DOUBLE y2,                                         // Time transformation Bezier point 2 Y value
        [out, annotation("_Outptr_")] IUIAnimationTransition2 **ppTransition             // New cubic bezier linear transition
    );

    // Creates a vector cubic bezier linear transition
    UI_CHECKRETURN HRESULT
    CreateCubicBezierLinearVectorTransition
    (
                           [in, annotation("_In_")] UI_ANIMATION_SECONDS duration,          // Duration of the transition
        [in, annotation("_In_reads_(cDimension)")] const DOUBLE *finalValue,                // The final value this transition leads to when applied to an animation variable
                           [in, annotation("_In_")] UINT cDimension,                        // Number of animated values
                           [in, annotation("_In_")] DOUBLE x1,                              // Time transformation Bezier point 1 X value
                           [in, annotation("_In_")] DOUBLE y1,                              // Time transformation Bezier point 1 Y value
                           [in, annotation("_In_")] DOUBLE x2,                              // Time transformation Bezier point 2 X value
                           [in, annotation("_In_")] DOUBLE y2,                              // Time transformation Bezier point 2 Y value
                   [out, annotation("_Outptr_")] IUIAnimationTransition2 **ppTransition  // New cubic bezier linear transition
    );

};

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Interpolator API

// Defines an interface for interpolators to propagate their curve information back to WAM
[
    local,
    object,
    uuid(BAB20D63-4361-45DA-A24F-AB8508846B5B),
    helpstring("IUIAnimationPrimitiveInterpolation Interface"),
    pointer_default(unique)
]
interface IUIAnimationPrimitiveInterpolation : IUnknown
{
    // Adds a cubic polynomial segment to the animation function.
    UI_CHECKRETURN HRESULT
    AddCubic
    (
        [in, annotation("_In_")] UINT dimension,                        // The current vector dimension to which to add the cubic
        [in, annotation("_In_")] UI_ANIMATION_SECONDS beginOffset,      // The begin offset for the cubic (0 corresponding to beginning of interpolator)
        [in, annotation("_In_")] FLOAT constantCoefficient,             // Cubic polynomial constant coefficient
        [in, annotation("_In_")] FLOAT linearCoefficient,               // Cubic polynomial linear coefficient
        [in, annotation("_In_")] FLOAT quadraticCoefficient,            // Cubic polynomial quadratic coefficient
        [in, annotation("_In_")] FLOAT cubicCoefficient                 // Cubic polynomial cubic coefficient
    );

    // Adds a sinusoidal segment to the animation function.
    // Defined by the function Y(t) = bias + amplitude*sin(360*frequency*t + phase)
    // Where 'sin' is the sin of an angle specified in degrees (e.g. sin(n + 360) == sin(n) for any real number 'n')
    HRESULT
    AddSinusoidal
    (
        [in, annotation("_In_")] UINT dimension,                      // The current vector dimension to which to add the cubic
        [in, annotation("_In_")] UI_ANIMATION_SECONDS beginOffset,    // The begin offset for the sinusoidal (0 corresponding to beginning of interpolator)
        [in, annotation("_In_")] FLOAT bias,            // The constant 'bias' in the sinusoidal function
        [in, annotation("_In_")] FLOAT amplitude,       // The constant 'amplitude' factor in the sinusoidal function
        [in, annotation("_In_")] FLOAT frequency,       // The constant 'frequency' in the sinusoidal function
        [in, annotation("_In_")] FLOAT phase            // The constant 'phase' in the sinusoidal function
    );
};

// Defines methods for creating a custom interpolator
[
    local,
    object,
    uuid(EA76AFF8-EA22-4a23-A0EF-A6A966703518),
    helpstring("IUIAnimationInterpolator2 Interface"),
    pointer_default(unique)
]
interface IUIAnimationInterpolator2 : IUnknown
{
    // Gets the animation variable's current value
    UI_CHECKRETURN HRESULT
    GetDimension
    (
        [out, retval, annotation("_Out_")] UINT *dimension                         // The number of dimensions animated by the interpolator
    );

    // Sets the interpolator's initial value and velocity
    UI_CHECKRETURN HRESULT
    SetInitialValueAndVelocity
    (
        [in, annotation("_In_reads_(cDimension)")] DOUBLE *initialValue,           // The initial value
        [in, annotation("_In_reads_(cDimension)")] DOUBLE *initialVelocity,        // The initial velocity
                           [in, annotation("_In_")] UINT cDimension                 // Number of animated values
    );
    
    // Sets the interpolator's duration
    UI_CHECKRETURN HRESULT
    SetDuration
    (
        [in, annotation("_In_")] UI_ANIMATION_SECONDS duration                      // The interpolator duration
    );
    
    // Gets the interpolator's duration
    UI_CHECKRETURN HRESULT
    GetDuration
    (
        [out, retval, annotation("_Out_")] UI_ANIMATION_SECONDS *duration           // The interpolator duration
    );

    // Gets the final value to which the interpolator leads
    UI_CHECKRETURN HRESULT
    GetFinalValue
    (
        [out, annotation("_Out_writes_(cDimension)")] DOUBLE *value,               // The final value
                             [in, annotation("_In_")] UINT cDimension              // Number of animated values
    ); 
    
    // Interpolates the value at a given offset
    UI_CHECKRETURN HRESULT
    InterpolateValue
    (
                             [in, annotation("_In_")] UI_ANIMATION_SECONDS offset,       // The offset
        [out, annotation("_Out_writes_(cDimension)")] DOUBLE *value,                     // The interpolated value
                             [in, annotation("_In_")] UINT cDimension                    // Number of animated values
    );
    
    // Interpolates the velocity at a given offset
    UI_CHECKRETURN HRESULT
    InterpolateVelocity
    (
                             [in, annotation("_In_")] UI_ANIMATION_SECONDS offset,          // The offset
        [out, annotation("_Out_writes_(cDimension)")] DOUBLE *velocity,                     // The interpolated velocity
                             [in, annotation("_In_")] UINT cDimension                       // Number of animated values
    );

    // Generates a primitive interpolation of the animation specified by the interpolator
    UI_CHECKRETURN HRESULT
    GetPrimitiveInterpolation
    (
        [in, annotation("_In_")] IUIAnimationPrimitiveInterpolation *interpolation,         // The interpolation object
        [in, annotation("_In_")] UINT cDimension                                            // Number of animated values
    );

    // Get's the interpolator's dependencies
    UI_CHECKRETURN HRESULT
    GetDependencies
    (
        [out, annotation("_Out_")] UI_ANIMATION_DEPENDENCIES *initialValueDependencies,           // The aspects of the interpolator that depend on its initial value
        [out, annotation("_Out_")] UI_ANIMATION_DEPENDENCIES *initialVelocityDependencies,        // The aspects of the interpolator that depend on its initial velocity
        [out, annotation("_Out_")] UI_ANIMATION_DEPENDENCIES *durationDependencies                // The aspects of the interpolator that depend on its duration
    );

 };

// Defines methods for creating transitions from custom interpolators
[
    local,
    object,
    uuid(937D4916-C1A6-42d5-88D8-30344D6EFE31),
    helpstring("IUIAnimationTransitionFactory2 Interface"),
    pointer_default(unique)
]
interface IUIAnimationTransitionFactory2 : IUnknown
{
    // Creates a transition from a custom interpolator
    UI_CHECKRETURN HRESULT
    CreateTransition
    (
                        [in, annotation("_In_")] IUIAnimationInterpolator2 *interpolator,         // The interpolator to create a transition from
        [out, retval, annotation("_Outptr_")] IUIAnimationTransition2 **transition             // The new transition
    );
};

// Defines a storyboard, which combines animation variables and transitions to define an animation
[
    local,
    object, 
    uuid(AE289CD2-12D4-4945-9419-9E41BE034DF2),
    helpstring("IUIAnimationStoryboard2 Interface"),
    pointer_default(unique)
]
interface IUIAnimationStoryboard2 : IUnknown
{
    // Adds a transition to the storyboard
    UI_CHECKRETURN HRESULT
    AddTransition
    (
        [in, annotation("_In_")] IUIAnimationVariable2 *variable,                            // The animation variable to transition
        [in, annotation("_In_")] IUIAnimationTransition2 *transition                         // The transition to apply to the variable
    );
    
    // Adds a keyfame offset from an existing keyframe
    UI_CHECKRETURN HRESULT
    AddKeyframeAtOffset
    (
                  [in, annotation("_In_")] UI_ANIMATION_KEYFRAME existingKeyframe,          // An existing keyframe
                  [in, annotation("_In_")] UI_ANIMATION_SECONDS offset,                     // The offset from existingKeyframe at which to add keyframe
        [out, retval, annotation("_Out_")] UI_ANIMATION_KEYFRAME *keyframe                  // The new keyframe
    );
    
    // Adds a keyfame at the end of a specified transition
    UI_CHECKRETURN HRESULT
    AddKeyframeAfterTransition
    (
                  [in, annotation("_In_")] IUIAnimationTransition2 *transition,              // The transition to add a keyframe after
        [out, retval, annotation("_Out_")] UI_ANIMATION_KEYFRAME *keyframe                  // The new keyframe
    );
    
    // Adds a transition that starts at a specified keyframe
    UI_CHECKRETURN HRESULT
    AddTransitionAtKeyframe
    (
        [in, annotation("_In_")] IUIAnimationVariable2 *variable,                            // The animation variable to transition
        [in, annotation("_In_")] IUIAnimationTransition2 *transition,                        // The transition to apply to the variable
        [in, annotation("_In_")] UI_ANIMATION_KEYFRAME startKeyframe                        // A keyframe that specifies the beginning of the new transition
    );
    
    // Adds a transition between two keyframes
    UI_CHECKRETURN HRESULT
    AddTransitionBetweenKeyframes
    (
        [in, annotation("_In_")] IUIAnimationVariable2 *variable,                            // The animation variable to transition
        [in, annotation("_In_")] IUIAnimationTransition2 *transition,                        // The transition to apply to the variable
        [in, annotation("_In_")] UI_ANIMATION_KEYFRAME startKeyframe,                       // A keyframe that specifies the beginning of the new transition
        [in, annotation("_In_")] UI_ANIMATION_KEYFRAME endKeyframe                          // A keyframe that specifies the end of the new transition
    );
    
    // Creates a play cycle between two specified keyframes
    UI_CHECKRETURN HRESULT
    RepeatBetweenKeyframes
    (
        [in, annotation("_In_")] UI_ANIMATION_KEYFRAME startKeyframe,                                  // Start keyframe identifier
        [in, annotation("_In_")] UI_ANIMATION_KEYFRAME endKeyframe,                                    // End keyframe identifier
        [in, annotation("_In_")] DOUBLE cRepetition,                                                   // The repetition count
        [in, annotation("_In_")] UI_ANIMATION_REPEAT_MODE repeatMode,                                  // The repeat mode (normal/alternate)
        [in, defaultvalue(0),
             annotation("_In_opt_")] IUIAnimationLoopIterationChangeHandler2 *pIterationChangeHandler, // The iteration change callback
        [in, defaultvalue(0),
             annotation("_In_")] UINT_PTR id,                                                          // The ID of this loop to pass to iteration change callback
        [in, defaultvalue(0),
             annotation("_In_")] BOOL fRegisterForNextAnimationEvent                                   // Register loop iteration change for next animation event time
    );
    
    // Directs the storyboard to hold an animation variable at its final value until the storyboard ends
    UI_CHECKRETURN HRESULT
    HoldVariable
    (
        [in, annotation("_In_")] IUIAnimationVariable2 *variable                             // The animation variable to hold
    );
    
    // Sets the longest acceptable delay before the storyboard plays
    UI_CHECKRETURN HRESULT
    SetLongestAcceptableDelay
    (
        [in, annotation("_In_")] UI_ANIMATION_SECONDS delay                                 // The longest acceptable delay before the storyboard plays
    );

    // Set the offset into the storyboard at which to start when scheduled
    UI_CHECKRETURN HRESULT
    SetSkipDuration
    (
        [in, annotation("_In_")] UI_ANIMATION_SECONDS secondsDuration                       // Duration to skip
    );
    
    // Directs the storyboard to schedule for play
    UI_CHECKRETURN HRESULT
    Schedule
    (
            [in, annotation("_In_")] UI_ANIMATION_SECONDS timeNow,                          // The current time
        [out, defaultvalue(0),
            annotation("_Out_opt_")] UI_ANIMATION_SCHEDULING_RESULT *schedulingResult       // The result of the scheduling request
    );
    
    // Directs the storyboard to conclude
    UI_CHECKRETURN HRESULT
    Conclude
    (
    );
    
    // Directs the storyboard to finish playing within a specified amount of time
    UI_CHECKRETURN HRESULT
    Finish
    (
        [in, annotation("_In_")] UI_ANIMATION_SECONDS completionDeadline                    // The maximum time the storyboard has to finish playing
    );
    
    // Directs the storyboard to abandon playing
    UI_CHECKRETURN HRESULT
    Abandon
    (
    );
    
    // Sets the storyboard's object/ID tag
    UI_CHECKRETURN HRESULT
    SetTag
    (
        [in, unique, annotation("_In_opt_")] IUnknown *object,                              // The tag object
                    [in, annotation("_In_")] UINT32 id                                      // The tag ID
    );
    
    // Gets the storyboard's object/ID tag
    UI_CHECKRETURN HRESULT
    GetTag
    (
        [out, annotation("_Outptr_opt_")] IUnknown **object,                             // The tag object
              [out, annotation("_Out_opt_")] UINT32 *id                                     // The tag ID
    );
    
    // Gets the storyboard's status
    UI_CHECKRETURN HRESULT
    GetStatus
    (
        [out, retval, annotation("_Out_")] UI_ANIMATION_STORYBOARD_STATUS *status           // The storyboard's status
    );
    
    // Gets time elapsed since the storyboard started playing
    UI_CHECKRETURN HRESULT
    GetElapsedTime
    (
        [out, annotation("_Out_")] UI_ANIMATION_SECONDS *elapsedTime                        // Time elapsed since the storyboard started playing 
    );
    
    // Specifies a handler for storyboard status and update events
    UI_CHECKRETURN HRESULT
    SetStoryboardEventHandler
    (
                 [in, unique, annotation("_In_opt_")] IUIAnimationStoryboardEventHandler2 *handler,       // A handler for storyboard status and update events
        [in, defaultvalue(FALSE), annotation("_In_")] BOOL fRegisterStatusChangeForNextAnimationEvent,    // Register storyboard event handler's "OnStoryboardStatusChanged" events for next animation event time
        [in, defaultvalue(FALSE), annotation("_In_")] BOOL fRegisterUpdateForNextAnimationEvent           // Register storyboard event handler's "OnStoryboardUpdated" events for next animation event time
    );

}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Type Library

[
    uuid(44CA24DB-1A92-4149-BAB5-FB14D64B401E),
    version(1.0),
    helpstring("UIAnimation 1.0 Type Library")
]
library UIAnimation
{
    importlib("stdole32.tlb");

    [
        uuid(4C1FC63A-695C-47E8-A339-1A194BE3D0B8),
        helpstring("UIAnimationManager Class")
    ]
    coclass UIAnimationManager
    {
        [default] interface IUIAnimationManager;
    };

    [
        uuid(D25D8842-8884-4A4A-B321-091314379BDD),
        helpstring("UIAnimationManager2 Class")
    ]
    coclass UIAnimationManager2
    {
        [default] interface IUIAnimationManager2;
    };

    [
        uuid(1D6322AD-AA85-4EF5-A828-86D71067D145),
        helpstring("UIAnimationTransitionLibrary Class")
    ]
    coclass UIAnimationTransitionLibrary
    {
        [default] interface IUIAnimationTransitionLibrary;
    };

    [
        uuid(812F944A-C5C8-4CD9-B0A6-B3DA802F228D),
        helpstring("UIAnimationTransitionLibrary2 Class")
    ]
    coclass UIAnimationTransitionLibrary2
    {
        [default] interface IUIAnimationTransitionLibrary2;
    };

    [
        uuid(8A9B1CDD-FCD7-419c-8B44-42FD17DB1887),
        helpstring("UIAnimationTransitionFactory Class")
    ]
    coclass UIAnimationTransitionFactory
    {
        [default] interface IUIAnimationTransitionFactory;
    };

    [
        uuid(84302F97-7F7B-4040-B190-72AC9D18E420),
        helpstring("UIAnimationTransitionFactory2 Class")
    ]
    coclass UIAnimationTransitionFactory2
    {
        [default] interface IUIAnimationTransitionFactory2;
    };

    [
        uuid(BFCD4A0C-06B6-4384-B768-0DAA792C380E),
        helpstring("UIAnimationTimer Class")
    ]
    coclass UIAnimationTimer
    {
        [default] interface IUIAnimationTimer;
    };
};

#undef UI_CHECKRETURN
