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

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

Issue 1142853006: [Specs] Remove all the obsolete specs. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 7 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 | « sky/specs/README.md ('k') | sky/specs/builtins.md » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 Animation API
2 =============
3
4 ```dart
5 typedef void TimerCallback();
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
15 class AnimationTimer extends Timer {
16 factory whenIdle(TimerCallback callback, { Duration budget: 1.0 }) {
17 if (budget.inMilliseconds > 1.0)
18 budget = new Duration(milliseconds: 1.0);
19 _addTask(callback: callback, budget: budget, bits: IdleTask, priority: IdleP riority, queue: _idleQueue);
20 }
21
22 factory beforePaint(TimerCallback callback, { int priority: 0 }) {
23 _addTask(callback: callback, budget: new Duration(milliseconds: 1.0), bits: PaintTask, priority: priority, queue: _paintQueue);
24 }
25
26 factory nextFrame(TimerCallback callback, { int priority: 0 }) {
27 _addTask(callback: callback, budget: new Duration(milliseconds: 1.0), bits: PaintTask, priority: priority, queue: _nextPaintQueue);
28 }
29 }
30 ```
31
32
33 Easing Functions
34 ----------------
35
36 ```dart
37 // part of the framework, not dart:sky
38
39 typedef void AnimationCallback();
40
41 abstract class EasingFunction {
42 EasingFunction({double duration: 0.0, AnimationCallback completionCallback: nu ll });
43 double getFactor(Float time);
44 // calls completionCallback if time >= duration
45 // then returns a number ostensibly in the range 0.0 to 1.0
46 // (but it could in practice go outside this range, e.g. for
47 // animation styles that overreach then come back)
48 }
49 ```
50
51 If you want to have two animations simultaneously, e.g. two
52 transforms, then you can add to the RenderNode's overrideStyles a
53 StyleValue that combines other StyleValues, e.g. a
54 "TransformStyleValueCombinerStyleValue", and then add to it the
55 regular animated StyleValues, e.g. multiple
56 "AnimatedTransformStyleValue" objects. A framework API could make
57 setting all that up easy, given the right underlying StyleValue
58 classes.
OLDNEW
« no previous file with comments | « sky/specs/README.md ('k') | sky/specs/builtins.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698