Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Side by Side Diff: sky/specs/animation.md

Issue 931333002: Specs: update the run loop and timer stuff to use the new model with task filters, priorities, and … (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | sky/specs/elements.md » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 external void _addTask({ TimerCallback callback, Duration budget, int bits, int priority, Queue queue });
8 // see (runloop.md)[runloop.md] for the semantics of tasks and queues
9 // _addTask() does the zone magic on callback
10
11 external final Queue get _idleQueue;
12 external final Queue get _paintQueue;
13 external final Queue get _nextPaintQueue;
14
7 class AnimationTimer extends Timer { 15 class AnimationTimer extends Timer {
8 external factory whenIdle(TimerCallback callback, { double budget: 1.0 }); 16 factory whenIdle(TimerCallback callback, { Duration budget: 1.0 }) {
9 // calls callback next time the system is idle 17 if (budget.inMilliseconds > 1.0)
10 // - if budget is in the range 0.0 < budget <= 1.0, then callback is 18 budget = new Duration(milliseconds: 1.0);
11 // guaranteed to have that many milliseconds before being killed 19 _addTask(callback: callback, budget: budget, bits: IdleTask, priority: IdleP riority, queue: _idleQueue);
12 // - if budget <= 0.0, then the callback could be killed [at any time](script. md). 20 }
13 // - if budget > 1.0, then it is treated as 1.0.
14 21
15 external factory beforePaint(TimerCallback callback, { int priority: 0 }); 22 factory beforePaint(TimerCallback callback, { int priority: 0 }) {
16 // runs this timeout before this frame's layout/paint phases begin 23 _addTask(callback: callback, budget: new Duration(milliseconds: 1.0), bits: PaintTask, priority: priority, queue: _paintQueue);
17 external factory nextFrame(TimerCallback callback, { int priority: 0 }); 24 }
18 // runs this timeout right away
19 25
20 // for beforePaint and nextFrame, the callbacks are first sorted by 26 factory nextFrame(TimerCallback callback, { int priority: 0 }) {
21 // priority, and then run in decreasing order of priority, 27 _addTask(callback: callback, budget: new Duration(milliseconds: 1.0), bits: PaintTask, priority: priority, queue: _nextPaintQueue);
22 // tie-breaking by registration time, earliest first. 28 }
23
24 // once there is no more time for callbacks this frame, the Timers
25 // are all canceled, so isActive will become false
26
27 } 29 }
28 ``` 30 ```
29 31
30 32
31 Easing Functions 33 Easing Functions
32 ---------------- 34 ----------------
33 35
34 ```dart 36 ```dart
35 // part of the framework, not dart:sky 37 // part of the framework, not dart:sky
36 38
(...skipping 10 matching lines...) Expand all
47 ``` 49 ```
48 50
49 If you want to have two animations simultaneously, e.g. two 51 If you want to have two animations simultaneously, e.g. two
50 transforms, then you can add to the RenderNode's overrideStyles a 52 transforms, then you can add to the RenderNode's overrideStyles a
51 StyleValue that combines other StyleValues, e.g. a 53 StyleValue that combines other StyleValues, e.g. a
52 "TransformStyleValueCombinerStyleValue", and then add to it the 54 "TransformStyleValueCombinerStyleValue", and then add to it the
53 regular animated StyleValues, e.g. multiple 55 regular animated StyleValues, e.g. multiple
54 "AnimatedTransformStyleValue" objects. A framework API could make 56 "AnimatedTransformStyleValue" objects. A framework API could make
55 setting all that up easy, given the right underlying StyleValue 57 setting all that up easy, given the right underlying StyleValue
56 classes. 58 classes.
OLDNEW
« no previous file with comments | « no previous file | sky/specs/elements.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698