Update TODO_Animation.md

This commit is contained in:
Zihan Chen
2017-12-11 10:24:20 -08:00
committed by GitHub
parent 8243cfc3a8
commit b8f8453902

View File

@@ -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 <instance> to write a function:
- `func <NAME>(start: T, end: T, target: T): IGuiGraphicsAnimationInterpolation^;`
- `func <NAME>(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();`