| OLD | NEW |
| 1 Animation API | 1 Animation API |
| 2 ============= | 2 ============= |
| 3 | 3 |
| 4 ```dart | 4 ```dart |
| 5 typedef void TimerCallback(); | 5 typedef void TimerCallback(); |
| 6 | 6 |
| 7 class AnimationTimer extends Timer { | 7 class AnimationTimer extends Timer { |
| 8 external factory whenIdle(TimerCallback callback, { double budget: 1.0 }); | 8 external factory whenIdle(TimerCallback callback, { double budget: 1.0 }); |
| 9 // calls callback next time the system is idle | 9 // calls callback next time the system is idle |
| 10 // - if budget is in the range 0.0 < budget <= 1.0, then callback is | 10 // - if budget is in the range 0.0 < budget <= 1.0, then callback is |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // are all canceled, so isActive will become false | 25 // are all canceled, so isActive will become false |
| 26 | 26 |
| 27 } | 27 } |
| 28 ``` | 28 ``` |
| 29 | 29 |
| 30 | 30 |
| 31 Easing Functions | 31 Easing Functions |
| 32 ---------------- | 32 ---------------- |
| 33 | 33 |
| 34 ```dart | 34 ```dart |
| 35 // part of the framework, not sky:core | 35 // part of the framework, not dart:sky |
| 36 | 36 |
| 37 typedef void AnimationCallback(); | 37 typedef void AnimationCallback(); |
| 38 | 38 |
| 39 abstract class EasingFunction { | 39 abstract class EasingFunction { |
| 40 EasingFunction({double duration: 0.0, AnimationCallback completionCallback: nu
ll }); | 40 EasingFunction({double duration: 0.0, AnimationCallback completionCallback: nu
ll }); |
| 41 double getFactor(Float time); | 41 double getFactor(Float time); |
| 42 // calls completionCallback if time >= duration | 42 // calls completionCallback if time >= duration |
| 43 // then returns a number ostensibly in the range 0.0 to 1.0 | 43 // then returns a number ostensibly in the range 0.0 to 1.0 |
| 44 // (but it could in practice go outside this range, e.g. for | 44 // (but it could in practice go outside this range, e.g. for |
| 45 // animation styles that overreach then come back) | 45 // animation styles that overreach then come back) |
| 46 } | 46 } |
| 47 ``` | 47 ``` |
| 48 | 48 |
| 49 If you want to have two animations simultaneously, e.g. two | 49 If you want to have two animations simultaneously, e.g. two |
| 50 transforms, then you can add to the RenderNode's overrideStyles a | 50 transforms, then you can add to the RenderNode's overrideStyles a |
| 51 StyleValue that combines other StyleValues, e.g. a | 51 StyleValue that combines other StyleValues, e.g. a |
| 52 "TransformStyleValueCombinerStyleValue", and then add to it the | 52 "TransformStyleValueCombinerStyleValue", and then add to it the |
| 53 regular animated StyleValues, e.g. multiple | 53 regular animated StyleValues, e.g. multiple |
| 54 "AnimatedTransformStyleValue" objects. A framework API could make | 54 "AnimatedTransformStyleValue" objects. A framework API could make |
| 55 setting all that up easy, given the right underlying StyleValue | 55 setting all that up easy, given the right underlying StyleValue |
| 56 classes. | 56 classes. |
| OLD | NEW |