From b8f84539029946f2ea3e6a65e21ab3187faedf93 Mon Sep 17 00:00:00 2001 From: Zihan Chen Date: Mon, 11 Dec 2017 10:24:20 -0800 Subject: [PATCH] Update TODO_Animation.md --- TODO_Animation.md | 56 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/TODO_Animation.md b/TODO_Animation.md index 1bb4ae54..abba96ec 100644 --- a/TODO_Animation.md +++ b/TODO_Animation.md @@ -1,11 +1,8 @@ ## Animation (continuation) ### Goal -- Implement Animation in GacUI XMl Resource -- Possible to provide state machine XML tags -- Animation can be aborted at any moment, and launch a new one if necessary -- Animation can change different part of the view model using different interpolation at the same time -- Using `IAsync` +- Provide XML-defined interpolation function +- Provide new animation API ### Demo - Download with round progress bar @@ -15,18 +12,41 @@ - Downloaded text fade in - Progress bar fly out -### Animation +### Feature -- Feature - - Can be canceled at any moment - - Can set a new start state or start from the current state -- Exit Condition - - Time based - - Condition based -- Playing Rate - - Realtime - - Frame animation with a fixed interval -- Composed animation -- With infinite looping +#### Interpolation function +A new xml tag will be added in to write a function: +- `func (start: T, end: T, target: T): IGuiGraphicsAnimationInterpolation^;` +- `func (start: T, end: T, target: U): IGuiGraphicsAnimationInterpolation^;` + - if T is a value type so it has to be change a property of type T in U -### XML +``` +interface IGuiGraphicsAnimationInterpolation +{ + func Interpolate(position: double):void; +} +``` + +#### API +- A group of new overloading functions are added in `GuiInstanceRootObject` which do + - Add animation to `root->GetControlHostInternal()->GetGraphicsHost()->GetAnimationManager()`, where `GetControlHostInternal` is a new protected abstract function. + - If the control host is not ready (e.g. the control has not been added to a window), then all animations will be kept and attach to the window later + - When the root object is deleted, all animations are stopped (set the internal flag so that the animation manager will remove them later) + - And has the following options: + - **interpolation object** + - **timed or infinite** + - for timed animation + - **a function** to convert passed total time to a double value + - default: `passed total time / total time` + - **a fomular** function to convert a double value from `[0..1]` to `[0..1]` to control the animation behavior + - for infinite animation + - **a function** to convert passed total time to a double value + - default: `passed total time` + - **end of animation notification** + - Stop an `IAsync` object + - Call a callback function + +#### Workflow +- Author calls animation APIs themselves to start an animation +- State machine or async coroutine is supported by "end of animation notification" +- Add `$Await GetApplication().DoEvents();`