Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
9ef7ebe7
E
engine
项目概览
weixin_43355755
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9ef7ebe7
编写于
9月 08, 2015
作者:
A
Adam Barth
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1076 from abarth/docs_animation
Introduce package:sky/animation.dart
上级
87e56381
ef880695
变更
47
隐藏空白更改
内联
并排
Showing
47 changed file
with
193 addition
and
234 deletion
+193
-234
examples/fitness/lib/main.dart
examples/fitness/lib/main.dart
+1
-0
examples/rendering/spinning_flex.dart
examples/rendering/spinning_flex.dart
+1
-1
examples/stocks/lib/main.dart
examples/stocks/lib/main.dart
+1
-0
examples/widgets/card_collection.dart
examples/widgets/card_collection.dart
+1
-0
examples/widgets/pageable_list.dart
examples/widgets/pageable_list.dart
+1
-0
examples/widgets/progress_indicator.dart
examples/widgets/progress_indicator.dart
+1
-3
examples/widgets/spinning_mixed.dart
examples/widgets/spinning_mixed.dart
+1
-1
sky/packages/sky/lib/README.md
sky/packages/sky/lib/README.md
+15
-16
sky/packages/sky/lib/animation.dart
sky/packages/sky/lib/animation.dart
+19
-0
sky/packages/sky/lib/animation/direction.dart
sky/packages/sky/lib/animation/direction.dart
+0
-8
sky/packages/sky/lib/base/debug.dart
sky/packages/sky/lib/base/debug.dart
+0
-3
sky/packages/sky/lib/base/scheduler.dart
sky/packages/sky/lib/base/scheduler.dart
+0
-88
sky/packages/sky/lib/painting/README.md
sky/packages/sky/lib/painting/README.md
+2
-2
sky/packages/sky/lib/painting/radial_reaction.dart
sky/packages/sky/lib/painting/radial_reaction.dart
+1
-3
sky/packages/sky/lib/src/animation/README.md
sky/packages/sky/lib/src/animation/README.md
+1
-1
sky/packages/sky/lib/src/animation/animated_simulation.dart
sky/packages/sky/lib/src/animation/animated_simulation.dart
+1
-1
sky/packages/sky/lib/src/animation/animated_value.dart
sky/packages/sky/lib/src/animation/animated_value.dart
+5
-3
sky/packages/sky/lib/src/animation/animation_performance.dart
...packages/sky/lib/src/animation/animation_performance.dart
+3
-6
sky/packages/sky/lib/src/animation/curves.dart
sky/packages/sky/lib/src/animation/curves.dart
+0
-18
sky/packages/sky/lib/src/animation/forces.dart
sky/packages/sky/lib/src/animation/forces.dart
+6
-3
sky/packages/sky/lib/src/animation/scheduler.dart
sky/packages/sky/lib/src/animation/scheduler.dart
+95
-0
sky/packages/sky/lib/src/animation/scroll_behavior.dart
sky/packages/sky/lib/src/animation/scroll_behavior.dart
+0
-0
sky/packages/sky/lib/src/animation/timeline.dart
sky/packages/sky/lib/src/animation/timeline.dart
+2
-1
sky/packages/sky/lib/src/rendering/README.md
sky/packages/sky/lib/src/rendering/README.md
+5
-5
sky/packages/sky/lib/src/rendering/object.dart
sky/packages/sky/lib/src/rendering/object.dart
+1
-1
sky/packages/sky/lib/src/rendering/sky_binding.dart
sky/packages/sky/lib/src/rendering/sky_binding.dart
+2
-3
sky/packages/sky/lib/src/rendering/toggleable.dart
sky/packages/sky/lib/src/rendering/toggleable.dart
+1
-3
sky/packages/sky/lib/src/rendering/view.dart
sky/packages/sky/lib/src/rendering/view.dart
+1
-1
sky/packages/sky/lib/src/widgets/README.md
sky/packages/sky/lib/src/widgets/README.md
+5
-5
sky/packages/sky/lib/src/widgets/animated_component.dart
sky/packages/sky/lib/src/widgets/animated_component.dart
+1
-1
sky/packages/sky/lib/src/widgets/animated_container.dart
sky/packages/sky/lib/src/widgets/animated_container.dart
+1
-3
sky/packages/sky/lib/src/widgets/dialog.dart
sky/packages/sky/lib/src/widgets/dialog.dart
+1
-2
sky/packages/sky/lib/src/widgets/dismissable.dart
sky/packages/sky/lib/src/widgets/dismissable.dart
+1
-3
sky/packages/sky/lib/src/widgets/drawer.dart
sky/packages/sky/lib/src/widgets/drawer.dart
+1
-5
sky/packages/sky/lib/src/widgets/framework.dart
sky/packages/sky/lib/src/widgets/framework.dart
+1
-1
sky/packages/sky/lib/src/widgets/ink_well.dart
sky/packages/sky/lib/src/widgets/ink_well.dart
+2
-6
sky/packages/sky/lib/src/widgets/mimic_overlay.dart
sky/packages/sky/lib/src/widgets/mimic_overlay.dart
+1
-3
sky/packages/sky/lib/src/widgets/navigator.dart
sky/packages/sky/lib/src/widgets/navigator.dart
+1
-3
sky/packages/sky/lib/src/widgets/popup_menu.dart
sky/packages/sky/lib/src/widgets/popup_menu.dart
+1
-4
sky/packages/sky/lib/src/widgets/progress_indicator.dart
sky/packages/sky/lib/src/widgets/progress_indicator.dart
+1
-3
sky/packages/sky/lib/src/widgets/scrollable.dart
sky/packages/sky/lib/src/widgets/scrollable.dart
+1
-5
sky/packages/sky/lib/src/widgets/snack_bar.dart
sky/packages/sky/lib/src/widgets/snack_bar.dart
+1
-5
sky/packages/sky/lib/src/widgets/tabs.dart
sky/packages/sky/lib/src/widgets/tabs.dart
+2
-7
sky/packages/sky/lib/src/widgets/transitions.dart
sky/packages/sky/lib/src/widgets/transitions.dart
+2
-3
sky/unit/test/animation/scheduler_test.dart
sky/unit/test/animation/scheduler_test.dart
+1
-1
sky/unit/test/widget/widget_tester.dart
sky/unit/test/widget/widget_tester.dart
+1
-1
skysprites/lib/skysprites.dart
skysprites/lib/skysprites.dart
+1
-2
未找到文件。
examples/fitness/lib/main.dart
浏览文件 @
9ef7ebe7
...
...
@@ -5,6 +5,7 @@
library
fitness
;
import
'package:playfair/playfair.dart'
as
playfair
;
import
'package:sky/animation.dart'
;
import
'package:sky/painting/text_style.dart'
;
import
'package:sky/theme/colors.dart'
as
colors
;
import
'package:sky/widgets.dart'
;
...
...
examples/rendering/spinning_flex.dart
浏览文件 @
9ef7ebe7
...
...
@@ -4,7 +4,7 @@
import
'dart:sky'
as
sky
;
import
'package:sky/
base/scheduler.dart'
as
scheduler
;
import
'package:sky/
animation.dart'
;
import
'package:sky/rendering.dart'
;
import
'solid_color_box.dart'
;
...
...
examples/stocks/lib/main.dart
浏览文件 @
9ef7ebe7
...
...
@@ -9,6 +9,7 @@ import 'dart:sky' as sky;
import
'package:sky/theme/colors.dart'
as
colors
;
import
'package:sky/theme/typography.dart'
as
typography
;
import
'package:sky/animation.dart'
;
import
'package:sky/widgets.dart'
;
import
'stock_data.dart'
;
...
...
examples/widgets/card_collection.dart
浏览文件 @
9ef7ebe7
...
...
@@ -4,6 +4,7 @@
import
'package:sky/theme/colors.dart'
as
colors
;
import
'package:sky/theme/typography.dart'
as
typography
;
import
'package:sky/animation.dart'
;
import
'package:sky/widgets.dart'
;
class
CardModel
{
...
...
examples/widgets/pageable_list.dart
浏览文件 @
9ef7ebe7
...
...
@@ -3,6 +3,7 @@
// found in the LICENSE file.
import
'package:sky/theme/colors.dart'
;
import
'package:sky/animation.dart'
;
import
'package:sky/widgets.dart'
;
class
CardModel
{
...
...
examples/widgets/progress_indicator.dart
浏览文件 @
9ef7ebe7
...
...
@@ -2,9 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/animation.dart'
;
import
'package:sky/theme/colors.dart'
as
colors
;
import
'package:sky/widgets.dart'
;
...
...
examples/widgets/spinning_mixed.dart
浏览文件 @
9ef7ebe7
...
...
@@ -4,7 +4,7 @@
import
'dart:sky'
as
sky
;
import
'package:sky/
base/scheduler.dart'
as
scheduler
;
import
'package:sky/
animation.dart'
;
import
'package:sky/rendering.dart'
;
import
'package:sky/widgets.dart'
;
...
...
sky/packages/sky/lib/README.md
浏览文件 @
9ef7ebe7
...
...
@@ -5,31 +5,30 @@ Sky and Sky's SDK are designed as layered frameworks, where each layer
depends on the ones below it but could be replaced wholesale.
The bottom-most layer is the Sky Platform, which is exposed to Dart
code as
[
various `
``dart:``
` packages
](
https://api.dartlang.org/
)
,
including
`
``dart:sky``
`
.
code as
[
various `
dart:
` packages
](
https://api.dartlang.org/
)
,
including
`
dart:sky
`
.
The
[
base/
](
base/
)
directory contains libraries that extend these core
APIs to provide base classes for tree structures
(
[
base/node.dart
](
base/node.dart
)
), hit testing
(
[
base/hit_test.dart
](
base/hit_test.dart
)
), debugging
(
[
base/debug.dart
](
base/debug.dart
)
), and task scheduling
(
[
base/scheduler.dart
](
base/scheduler.dart
)
).
(
[
base/hit_test.dart
](
base/hit_test.dart
)
), and debugging
(
[
base/debug.dart
](
base/debug.dart
)
).
Above this
are the files in the
[
animation/
](
animation/
)
directo
ry,
which provide
core primitives for animating values, and in
the
[
gestures/
](
gestures/
)
Above this
layer is the
[
animation
](
animation.dart
)
libra
ry,
which provide
s core animation primitives, and
the
[
gestures/
](
gestures/
)
directory, which define a gesture recognition and disambiguation system.
The next layer consists of the files in the
[
painting/
](
painting/
)
directory,
which provide APIs related to drawing graphics. Some of the code here
uses the
[
animation
/
](
animation/
)
utilities mentioned above.
uses the
[
animation
](
animation.dart
)
utilities mentioned above.
Layout primitives are provided in the next layer, found in the
[
rendering
/
](
rendering/
)
directory. They use
```dart:sky``
`
and the
APIs exposed in
painting/
to provide a retained-mode layout and
[
rendering
](
rendering.dart
)
library. They use
`dart:sky
`
and the
APIs exposed in
[
painting/
](
painting/
)
to provide a retained-mode layout and
rendering model for applications or documents.
Widgets are provided by the files in the
[
widgets
/
](
widgets/
)
directo
ry, using a reactive framework. They use data given in the
Widgets are provided by the files in the
[
widgets
](
widgets.dart
)
libra
ry, using a reactive framework. They use data given in the
[
theme/
](
theme/
)
directory to select styles consistent with Material
Design.
...
...
@@ -38,18 +37,18 @@ anything that uses the Mojo IPC mechanism, typically as part of
wrapping host operating system features. Some of those Host APIs are
implemented in the host system's preferred language.
Here is a diagram summari
s
ing all this:
Here is a diagram summari
z
ing all this:
+-----------------------------+ ------
| YOUR APP |
| +----------------------+---+
| | widgets
/
(theme/) | |
| | widgets
(theme/) | |
| ++---------------------++ |
| | rendering
/
| | Dart
| | rendering
| | Dart
| |---------+------------+ |
| | | painting/ | |
+-+ +------------+ |
| gestures/ | animation
/
| |
| gestures/ | animation
| |
+-----------+---+--------+ |
| base/ | mojo/ |
+------------+--+-+----+------+ -------
...
...
sky/packages/sky/lib/animation.dart
0 → 100644
浏览文件 @
9ef7ebe7
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/// The Sky animation engine.
///
/// This library includes and re-exports all Sky animation classes.
library
animation
;
export
'package:sky/src/rendering/auto_layout.dart'
;
export
'src/animation/animated_simulation.dart'
;
export
'src/animation/animated_value.dart'
;
export
'src/animation/animation_performance.dart'
;
export
'src/animation/curves.dart'
;
export
'src/animation/forces.dart'
;
export
'src/animation/scheduler.dart'
;
export
'src/animation/scroll_behavior.dart'
;
export
'src/animation/timeline.dart'
;
sky/packages/sky/lib/animation/direction.dart
已删除
100644 → 0
浏览文件 @
87e56381
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
enum
Direction
{
forward
,
reverse
}
sky/packages/sky/lib/base/debug.dart
浏览文件 @
9ef7ebe7
...
...
@@ -40,6 +40,3 @@ const sky.Color debugPaintLayerBordersColor = const sky.Color(0xFFFF9800);
/// Causes RenderObjects to paint warnings when painting outside their bounds.
bool
debugPaintBoundsEnabled
=
false
;
/// Slows down animations by this factor to help in development.
double
timeDilation
=
1.0
;
sky/packages/sky/lib/base/scheduler.dart
已删除
100644 → 0
浏览文件 @
87e56381
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:collection'
;
import
'dart:sky'
as
sky
;
import
'package:sky/base/debug.dart'
;
/// A callback from the scheduler
///
/// The timeStamp is the number of milliseconds since the beginning of the
/// scheduler's epoch. Use timeStamp to determine how far to advance animation
/// timelines so that all the animations in the system are synchronized to a
/// common time base.
typedef
void
SchedulerCallback
(
double
timeStamp
);
bool
_haveScheduledVisualUpdate
=
false
;
int
_nextCallbackId
=
1
;
final
List
<
SchedulerCallback
>
_persistentCallbacks
=
new
List
<
SchedulerCallback
>();
Map
<
int
,
SchedulerCallback
>
_transientCallbacks
=
new
LinkedHashMap
<
int
,
SchedulerCallback
>();
final
Set
<
int
>
_removedIds
=
new
Set
<
int
>();
/// Called by the engine to produce a new frame.
///
/// This function first calls all the callbacks registered by
/// [requestAnimationFrame] and then calls all the callbacks registered by
/// [addPersistentFrameCallback], which typically drive the rendering pipeline.
void
beginFrame
(
double
timeStamp
)
{
timeStamp
/=
timeDilation
;
_haveScheduledVisualUpdate
=
false
;
Map
<
int
,
SchedulerCallback
>
callbacks
=
_transientCallbacks
;
_transientCallbacks
=
new
Map
<
int
,
SchedulerCallback
>();
callbacks
.
forEach
((
id
,
callback
)
{
if
(!
_removedIds
.
contains
(
id
))
callback
(
timeStamp
);
});
_removedIds
.
clear
();
for
(
SchedulerCallback
callback
in
_persistentCallbacks
)
callback
(
timeStamp
);
}
/// Registers [beginFrame] callback with the engine.
void
init
(
)
{
sky
.
view
.
setFrameCallback
(
beginFrame
);
}
/// Call callback every frame.
void
addPersistentFrameCallback
(
SchedulerCallback
callback
)
{
_persistentCallbacks
.
add
(
callback
);
}
/// Schedule a callback for the next frame.
///
/// The callback will be run prior to flushing the main rendering pipeline.
/// Typically, requestAnimationFrame is used to throttle writes into the
/// rendering pipeline until the system is ready to accept a new frame. For
/// example, if you wanted to tick through an animation, you should use
/// requestAnimation frame to determine when to tick the animation. The callback
/// is passed a timeStamp that you can use to determine how far along the
/// timeline to advance your animation.
///
/// Returns an id that can be used to unschedule this callback.
int
requestAnimationFrame
(
SchedulerCallback
callback
)
{
int
id
=
_nextCallbackId
++;
_transientCallbacks
[
id
]
=
callback
;
ensureVisualUpdate
();
return
id
;
}
/// Cancel the callback identified by id.
void
cancelAnimationFrame
(
int
id
)
{
_transientCallbacks
.
remove
(
id
);
_removedIds
.
add
(
id
);
}
/// Ensure that a frame will be produced after this function is called.
void
ensureVisualUpdate
(
)
{
if
(
_haveScheduledVisualUpdate
)
return
;
sky
.
view
.
scheduleFrame
();
_haveScheduledVisualUpdate
=
true
;
}
sky/packages/sky/lib/painting/README.md
浏览文件 @
9ef7ebe7
This directory contains painting-related libraries that only depend on
core Dart libraries,
../base/
*, and ../animation/*
. Note that
../animation/
*
depends on the Newton Dart library also
.
core Dart libraries,
`../base/*`
, and
[
animation.dart
](
../animation.dart
)
. Note
that
[
animation.dart
](
../animation.dart
)
depends on the Newton Dart library
.
sky/packages/sky/lib/painting/radial_reaction.dart
浏览文件 @
9ef7ebe7
...
...
@@ -6,9 +6,7 @@ import 'dart:async';
import
'dart:sky'
as
sky
;
import
'dart:sky'
show
Point
,
Offset
,
Color
,
Paint
;
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/animation.dart'
;
const
Duration
_kShowDuration
=
const
Duration
(
milliseconds:
300
);
const
Duration
_kHideDuration
=
const
Duration
(
milliseconds:
200
);
...
...
sky/packages/sky/lib/animation/README.md
→
sky/packages/sky/lib/
src/
animation/README.md
浏览文件 @
9ef7ebe7
This directory contains animation-related libraries that only depend
on core Dart libraries
, the Newton Dart library, and ../base/
*
.
on core Dart libraries
and the Newton Dart library
.
sky/packages/sky/lib/animation/animated_simulation.dart
→
sky/packages/sky/lib/
src/
animation/animated_simulation.dart
浏览文件 @
9ef7ebe7
...
...
@@ -5,7 +5,7 @@
import
'dart:async'
;
import
'package:newton/newton.dart'
;
import
'package:sky/
base/scheduler.dart'
as
scheduler
;
import
'package:sky/
src/animation/scheduler.dart'
;
const
double
_kSecondsPerMillisecond
=
1000.0
;
...
...
sky/packages/sky/lib/animation/animated_value.dart
→
sky/packages/sky/lib/
src/
animation/animated_value.dart
浏览文件 @
9ef7ebe7
...
...
@@ -4,10 +4,12 @@
import
"dart:sky"
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/animation/direction.dart'
;
import
'package:sky/src/animation/curves.dart'
;
export
'package:sky/animation/curves.dart'
show
Interval
;
enum
Direction
{
forward
,
reverse
}
abstract
class
AnimatedVariable
{
void
setProgress
(
double
t
,
Direction
direction
);
...
...
sky/packages/sky/lib/animation/animation_performance.dart
→
sky/packages/sky/lib/
src/
animation/animation_performance.dart
浏览文件 @
9ef7ebe7
...
...
@@ -4,12 +4,9 @@
import
'dart:async'
;
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/direction.dart'
;
import
'package:sky/animation/forces.dart'
;
import
'package:sky/animation/timeline.dart'
;
export
'package:sky/animation/direction.dart'
show
Direction
;
import
'package:sky/src/animation/animated_value.dart'
;
import
'package:sky/src/animation/forces.dart'
;
import
'package:sky/src/animation/timeline.dart'
;
enum
AnimationStatus
{
dismissed
,
// stoped at 0
...
...
sky/packages/sky/lib/animation/curves.dart
→
sky/packages/sky/lib/
src/
animation/curves.dart
浏览文件 @
9ef7ebe7
...
...
@@ -39,22 +39,6 @@ class Interval implements Curve {
}
}
class
ParabolicFall
implements
Curve
{
const
ParabolicFall
();
double
transform
(
double
t
)
{
return
-
t
*
t
+
1
;
}
}
class
ParabolicRise
implements
Curve
{
const
ParabolicRise
();
double
transform
(
double
t
)
{
return
-(
t
-
1
)*(
t
-
1
)
+
1
;
}
}
class
Cubic
implements
Curve
{
final
double
a
;
final
double
b
;
...
...
@@ -162,8 +146,6 @@ const Cubic ease = const Cubic(0.25, 0.1, 0.25, 1.0);
const
Cubic
easeIn
=
const
Cubic
(
0.42
,
0.0
,
1.0
,
1.0
);
const
Cubic
easeOut
=
const
Cubic
(
0.0
,
0.0
,
0.58
,
1.0
);
const
Cubic
easeInOut
=
const
Cubic
(
0.42
,
0.0
,
0.58
,
1.0
);
const
ParabolicRise
parabolicRise
=
const
ParabolicRise
();
const
ParabolicFall
parabolicFall
=
const
ParabolicFall
();
const
BounceInCurve
bounceIn
=
const
BounceInCurve
();
const
BounceOutCurve
bounceOut
=
const
BounceOutCurve
();
const
BounceInOutCurve
bounceInOut
=
const
BounceInOutCurve
();
...
...
sky/packages/sky/lib/animation/forces.dart
→
sky/packages/sky/lib/
src/
animation/forces.dart
浏览文件 @
9ef7ebe7
...
...
@@ -6,22 +6,25 @@ import 'package:newton/newton.dart';
// Base class for creating Simulations for the animation Timeline.
abstract
class
Force
{
const
Force
();
Simulation
release
(
double
position
,
double
velocity
);
}
class
SpringForce
extends
Force
{
SpringForce
(
this
.
spring
,
{
this
.
left
:
0.0
,
this
.
right
:
1.0
});
const
SpringForce
(
this
.
spring
,
{
this
.
left
:
0.0
,
this
.
right
:
1.0
});
final
SpringDescription
spring
;
// Where to put the spring's resting point when releasing left or right,
// respectively.
final
double
left
,
right
;
final
double
left
;
final
double
right
;
// We overshoot the target by this distance, but stop the simulation when
// the spring gets within this distance (regardless of how fast it's moving).
// This causes the spring to settle a bit faster than it otherwise would.
static
final
Tolerance
tolerance
=
new
Tolerance
(
static
const
Tolerance
tolerance
=
const
Tolerance
(
velocity:
double
.
INFINITY
,
distance:
0.01
);
...
...
sky/packages/sky/lib/src/animation/scheduler.dart
0 → 100644
浏览文件 @
9ef7ebe7
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:collection'
;
import
'dart:sky'
as
sky
;
/// Slows down animations by this factor to help in development.
double
timeDilation
=
1.0
;
/// A callback from the scheduler
///
/// The timeStamp is the number of milliseconds since the beginning of the
/// scheduler's epoch. Use timeStamp to determine how far to advance animation
/// timelines so that all the animations in the system are synchronized to a
/// common time base.
typedef
void
SchedulerCallback
(
double
timeStamp
);
/// Schedules callbacks to run in concert with the engine's animation system
class
Scheduler
{
/// Requires clients to use the [scheduler] singleton
Scheduler
.
_
()
{
sky
.
view
.
setFrameCallback
(
beginFrame
);
}
bool
_haveScheduledVisualUpdate
=
false
;
int
_nextCallbackId
=
1
;
final
List
<
SchedulerCallback
>
_persistentCallbacks
=
new
List
<
SchedulerCallback
>();
Map
<
int
,
SchedulerCallback
>
_transientCallbacks
=
new
LinkedHashMap
<
int
,
SchedulerCallback
>();
final
Set
<
int
>
_removedIds
=
new
Set
<
int
>();
/// Called by the engine to produce a new frame.
///
/// This function first calls all the callbacks registered by
/// [requestAnimationFrame] and then calls all the callbacks registered by
/// [addPersistentFrameCallback], which typically drive the rendering pipeline.
void
beginFrame
(
double
timeStamp
)
{
timeStamp
/=
timeDilation
;
_haveScheduledVisualUpdate
=
false
;
Map
<
int
,
SchedulerCallback
>
callbacks
=
_transientCallbacks
;
_transientCallbacks
=
new
Map
<
int
,
SchedulerCallback
>();
callbacks
.
forEach
((
id
,
callback
)
{
if
(!
_removedIds
.
contains
(
id
))
callback
(
timeStamp
);
});
_removedIds
.
clear
();
for
(
SchedulerCallback
callback
in
_persistentCallbacks
)
callback
(
timeStamp
);
}
/// Call callback every frame.
void
addPersistentFrameCallback
(
SchedulerCallback
callback
)
{
_persistentCallbacks
.
add
(
callback
);
}
/// Schedule a callback for the next frame.
///
/// The callback will be run prior to flushing the main rendering pipeline.
/// Typically, requestAnimationFrame is used to throttle writes into the
/// rendering pipeline until the system is ready to accept a new frame. For
/// example, if you wanted to tick through an animation, you should use
/// requestAnimation frame to determine when to tick the animation. The callback
/// is passed a timeStamp that you can use to determine how far along the
/// timeline to advance your animation.
///
/// Returns an id that can be used to unschedule this callback.
int
requestAnimationFrame
(
SchedulerCallback
callback
)
{
int
id
=
_nextCallbackId
++;
_transientCallbacks
[
id
]
=
callback
;
ensureVisualUpdate
();
return
id
;
}
/// Cancel the callback identified by id.
void
cancelAnimationFrame
(
int
id
)
{
_transientCallbacks
.
remove
(
id
);
_removedIds
.
add
(
id
);
}
/// Ensure that a frame will be produced after this function is called.
void
ensureVisualUpdate
()
{
if
(
_haveScheduledVisualUpdate
)
return
;
sky
.
view
.
scheduleFrame
();
_haveScheduledVisualUpdate
=
true
;
}
}
/// A singleton instance of Scheduler to coordinate all the callbacks.
final
Scheduler
scheduler
=
new
Scheduler
.
_
();
sky/packages/sky/lib/animation/scroll_behavior.dart
→
sky/packages/sky/lib/
src/
animation/scroll_behavior.dart
浏览文件 @
9ef7ebe7
文件已移动
sky/packages/sky/lib/animation/timeline.dart
→
sky/packages/sky/lib/
src/
animation/timeline.dart
浏览文件 @
9ef7ebe7
...
...
@@ -5,7 +5,8 @@
import
'dart:async'
;
import
'package:newton/newton.dart'
;
import
'package:sky/animation/animated_simulation.dart'
;
import
'package:sky/src/animation/animated_simulation.dart'
;
// Simple simulation that linearly varies from |begin| to |end| over |duration|.
class
TweenSimulation
extends
Simulation
{
...
...
sky/packages/sky/lib/src/rendering/README.md
浏览文件 @
9ef7ebe7
...
...
@@ -372,8 +372,8 @@ This can be quite useful in figuring out exactly what is going on when
working with the render tree.
```
dart
import
'package:sky/
src/rendering/sky_binding
.dart'
;
import
'package:sky/
base/scheduler.dart'
as
scheduler
;
import
'package:sky/
animation
.dart'
;
import
'package:sky/
rendering.dart'
;
scheduler
.
addPersistentFrameCallback
((
_
)
{
SkyBinding
.
instance
.
debugDumpRenderTree
();
...
...
@@ -384,6 +384,6 @@ scheduler.addPersistentFrameCallback((_) {
Dependencies
------------
*
[
`package:sky/base`
](
../base
)
*
[
`package:sky/mojo`
](
../mojo
)
*
[
`package:sky/animation
`
](
../mojo
)
*
[
`package:sky/base`
](
../
../
base
)
*
[
`package:sky/mojo`
](
../
../
mojo
)
*
[
`package:sky/animation
.dart`
](
../../animation.dart
)
sky/packages/sky/lib/src/rendering/object.dart
浏览文件 @
9ef7ebe7
...
...
@@ -6,10 +6,10 @@ import 'dart:math' as math;
import
'dart:sky'
as
sky
;
import
'dart:sky'
show
Point
,
Offset
,
Size
,
Rect
,
Color
,
Paint
,
Path
;
import
'package:sky/animation.dart'
;
import
'package:sky/base/debug.dart'
;
import
'package:sky/base/hit_test.dart'
;
import
'package:sky/base/node.dart'
;
import
'package:sky/base/scheduler.dart'
as
scheduler
;
import
'package:sky/src/rendering/layer.dart'
;
import
'package:vector_math/vector_math.dart'
;
...
...
sky/packages/sky/lib/src/rendering/sky_binding.dart
浏览文件 @
9ef7ebe7
...
...
@@ -4,9 +4,9 @@
import
'dart:sky'
as
sky
;
import
'package:sky/
base/pointer_router
.dart'
;
import
'package:sky/
animation
.dart'
;
import
'package:sky/base/hit_test.dart'
;
import
'package:sky/base/
scheduler.dart'
as
scheduler
;
import
'package:sky/base/
pointer_router.dart'
;
import
'package:sky/gestures/arena.dart'
;
import
'package:sky/src/rendering/box.dart'
;
import
'package:sky/src/rendering/object.dart'
;
...
...
@@ -45,7 +45,6 @@ class SkyBinding extends HitTestTarget {
sky
.
view
.
setEventCallback
(
_handleEvent
);
sky
.
view
.
setMetricsChangedCallback
(
_handleMetricsChanged
);
scheduler
.
init
();
if
(
renderViewOverride
==
null
)
{
_renderView
=
new
RenderView
(
child:
root
);
_renderView
.
attach
();
...
...
sky/packages/sky/lib/src/rendering/toggleable.dart
浏览文件 @
9ef7ebe7
...
...
@@ -4,9 +4,7 @@
import
'dart:sky'
as
sky
;
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/animation.dart'
;
import
'package:sky/src/rendering/box.dart'
;
import
'package:sky/src/rendering/object.dart'
;
import
'package:sky/src/rendering/proxy_box.dart'
;
...
...
sky/packages/sky/lib/src/rendering/view.dart
浏览文件 @
9ef7ebe7
...
...
@@ -4,7 +4,7 @@
import
'dart:sky'
as
sky
;
import
'package:sky/
base/scheduler.dart'
as
scheduler
;
import
'package:sky/
animation.dart'
;
import
'package:sky/src/rendering/layer.dart'
;
import
'package:sky/src/rendering/object.dart'
;
import
'package:sky/src/rendering/box.dart'
;
...
...
sky/packages/sky/lib/src/widgets/README.md
浏览文件 @
9ef7ebe7
...
...
@@ -500,8 +500,8 @@ Dependencies
------------
*
`package:vector_math`
*
[
`package:sky/animation
`
](
../animation
)
*
[
`package:sky/base`
](
../base
)
*
[
`package:sky/painting`
](
../painting
)
*
[
`package:sky/rendering
`
](
../rendering
)
*
[
`package:sky/theme`
](
../theme
)
*
[
`package:sky/animation
.dart`
](
../../animation.dart
)
*
[
`package:sky/base`
](
../
../
base
)
*
[
`package:sky/painting`
](
../
../
painting
)
*
[
`package:sky/rendering
.dart`
](
../../rendering.dart
)
*
[
`package:sky/theme`
](
../
../
theme
)
sky/packages/sky/lib/src/widgets/animated_component.dart
浏览文件 @
9ef7ebe7
...
...
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:sky/animation
/animation_performance
.dart'
;
import
'package:sky/animation.dart'
;
import
'package:sky/src/widgets/framework.dart'
;
abstract
class
AnimatedComponent
extends
StatefulComponent
{
...
...
sky/packages/sky/lib/src/widgets/animated_container.dart
浏览文件 @
9ef7ebe7
...
...
@@ -5,9 +5,7 @@
import
'dart:sky'
as
sky
;
import
'package:vector_math/vector_math.dart'
;
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/animation.dart'
;
import
'package:sky/painting/box_painter.dart'
;
import
'package:sky/src/widgets/animated_component.dart'
;
import
'package:sky/src/widgets/basic.dart'
;
...
...
sky/packages/sky/lib/src/widgets/dialog.dart
浏览文件 @
9ef7ebe7
...
...
@@ -4,8 +4,7 @@
import
'dart:async'
;
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/animation.dart'
;
import
'package:sky/theme/colors.dart'
as
colors
;
import
'package:sky/src/widgets/basic.dart'
;
import
'package:sky/src/widgets/default_text_style.dart'
;
...
...
sky/packages/sky/lib/src/widgets/dismissable.dart
浏览文件 @
9ef7ebe7
...
...
@@ -4,9 +4,7 @@
import
'dart:sky'
as
sky
;
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/animation.dart'
;
import
'package:sky/src/widgets/basic.dart'
;
import
'package:sky/src/widgets/transitions.dart'
;
import
'package:sky/src/widgets/framework.dart'
;
...
...
sky/packages/sky/lib/src/widgets/drawer.dart
浏览文件 @
9ef7ebe7
...
...
@@ -5,9 +5,7 @@
import
'dart:async'
;
import
'dart:sky'
as
sky
;
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/forces.dart'
;
import
'package:sky/animation.dart'
;
import
'package:sky/theme/colors.dart'
as
colors
;
import
'package:sky/theme/shadows.dart'
;
import
'package:sky/src/widgets/animated_container.dart'
;
...
...
@@ -19,8 +17,6 @@ import 'package:sky/src/widgets/scrollable.dart';
import
'package:sky/src/widgets/theme.dart'
;
import
'package:sky/src/widgets/transitions.dart'
;
export
'package:sky/animation/animation_performance.dart'
show
AnimationStatus
;
// TODO(eseidel): Draw width should vary based on device size:
// http://www.google.com/design/spec/layout/structure.html#structure-side-nav
...
...
sky/packages/sky/lib/src/widgets/framework.dart
浏览文件 @
9ef7ebe7
...
...
@@ -6,8 +6,8 @@ import 'dart:async';
import
'dart:collection'
;
import
'dart:sky'
as
sky
;
import
'package:sky/animation.dart'
;
import
'package:sky/base/hit_test.dart'
;
import
'package:sky/base/scheduler.dart'
as
scheduler
;
import
'package:sky/mojo/activity.dart'
;
import
'package:sky/src/rendering/box.dart'
;
import
'package:sky/src/rendering/object.dart'
;
...
...
sky/packages/sky/lib/src/widgets/ink_well.dart
浏览文件 @
9ef7ebe7
...
...
@@ -5,12 +5,8 @@
import
'dart:math'
as
math
;
import
'dart:sky'
as
sky
;
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/src/rendering/box.dart'
;
import
'package:sky/src/rendering/object.dart'
;
import
'package:sky/src/rendering/proxy_box.dart'
;
import
'package:sky/animation.dart'
;
import
'package:sky/rendering.dart'
;
import
'package:sky/src/widgets/basic.dart'
;
import
'package:sky/src/widgets/framework.dart'
;
...
...
sky/packages/sky/lib/src/widgets/mimic_overlay.dart
浏览文件 @
9ef7ebe7
...
...
@@ -2,9 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/animation.dart'
;
import
'package:sky/src/widgets/animated_component.dart'
;
import
'package:sky/src/widgets/basic.dart'
;
import
'package:sky/src/widgets/framework.dart'
;
...
...
sky/packages/sky/lib/src/widgets/navigator.dart
浏览文件 @
9ef7ebe7
...
...
@@ -2,9 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/animation.dart'
;
import
'package:sky/src/widgets/basic.dart'
;
import
'package:sky/src/widgets/focus.dart'
;
import
'package:sky/src/widgets/framework.dart'
;
...
...
sky/packages/sky/lib/src/widgets/popup_menu.dart
浏览文件 @
9ef7ebe7
...
...
@@ -4,8 +4,7 @@
import
'dart:sky'
as
sky
;
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation.dart'
;
import
'package:sky/painting/box_painter.dart'
;
import
'package:sky/theme/colors.dart'
;
import
'package:sky/theme/shadows.dart'
;
...
...
@@ -16,8 +15,6 @@ import 'package:sky/src/widgets/popup_menu_item.dart';
import
'package:sky/src/widgets/scrollable.dart'
;
import
'package:sky/src/widgets/transitions.dart'
;
export
'package:sky/animation/animation_performance.dart'
show
AnimationStatus
;
const
Duration
_kMenuDuration
=
const
Duration
(
milliseconds:
300
);
double
_kMenuCloseIntervalEnd
=
2.0
/
3.0
;
const
double
_kMenuWidthStep
=
56.0
;
...
...
sky/packages/sky/lib/src/widgets/progress_indicator.dart
浏览文件 @
9ef7ebe7
...
...
@@ -5,9 +5,7 @@
import
'dart:math'
as
math
;
import
'dart:sky'
as
sky
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/animation.dart'
;
import
'package:sky/src/widgets/basic.dart'
;
import
'package:sky/src/widgets/theme.dart'
;
import
'package:sky/src/widgets/framework.dart'
;
...
...
sky/packages/sky/lib/src/widgets/scrollable.dart
浏览文件 @
9ef7ebe7
...
...
@@ -7,11 +7,7 @@ import 'dart:math' as math;
import
'dart:sky'
as
sky
;
import
'package:newton/newton.dart'
;
import
'package:sky/animation/animated_simulation.dart'
;
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/animation/scroll_behavior.dart'
;
import
'package:sky/animation.dart'
;
import
'package:sky/gestures/constants.dart'
;
import
'package:sky/src/rendering/box.dart'
;
import
'package:sky/src/rendering/viewport.dart'
;
...
...
sky/packages/sky/lib/src/widgets/snack_bar.dart
浏览文件 @
9ef7ebe7
...
...
@@ -3,9 +3,7 @@
// found in the LICENSE file.
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/animation.dart'
;
import
'package:sky/painting/text_style.dart'
;
import
'package:sky/theme/typography.dart'
as
typography
;
import
'package:sky/src/widgets/basic.dart'
;
...
...
@@ -16,8 +14,6 @@ import 'package:sky/src/widgets/material.dart';
import
'package:sky/src/widgets/theme.dart'
;
import
'package:sky/src/widgets/transitions.dart'
;
export
'package:sky/animation/animation_performance.dart'
show
AnimationStatus
;
typedef
void
SnackBarDismissedCallback
(
);
const
Duration
_kSlideInDuration
=
const
Duration
(
milliseconds:
200
);
...
...
sky/packages/sky/lib/src/widgets/tabs.dart
浏览文件 @
9ef7ebe7
...
...
@@ -6,14 +6,9 @@ import 'dart:math' as math;
import
'dart:sky'
as
sky
;
import
'package:newton/newton.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/animation/scroll_behavior.dart'
;
import
'package:sky/animation.dart'
;
import
'package:sky/painting/text_style.dart'
;
import
'package:sky/src/rendering/box.dart'
;
import
'package:sky/src/rendering/object.dart'
;
import
'package:sky/src/rendering/viewport.dart'
;
import
'package:sky/rendering.dart'
;
import
'package:sky/theme/colors.dart'
as
colors
;
import
'package:sky/theme/typography.dart'
as
typography
;
import
'package:sky/src/widgets/basic.dart'
;
...
...
sky/packages/sky/lib/src/widgets/transitions.dart
浏览文件 @
9ef7ebe7
...
...
@@ -2,14 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation.dart'
;
import
'package:sky/src/widgets/animated_component.dart'
;
import
'package:sky/src/widgets/basic.dart'
;
import
'package:sky/src/widgets/framework.dart'
;
import
'package:vector_math/vector_math.dart'
;
export
'package:sky/animation
/direction
.dart'
show
Direction
;
export
'package:sky/animation.dart'
show
Direction
;
// A helper class to anchor widgets to one another. Pass an instance of this to
// a Transition, then use the build() method to create a child with the same
...
...
sky/unit/test/
base
/scheduler_test.dart
→
sky/unit/test/
animation
/scheduler_test.dart
浏览文件 @
9ef7ebe7
import
'package:sky/
base/scheduler.dart'
as
scheduler
;
import
'package:sky/
animation.dart'
;
import
'package:test/test.dart'
;
void
main
(
)
{
...
...
sky/unit/test/widget/widget_tester.dart
浏览文件 @
9ef7ebe7
import
'dart:sky'
as
sky
;
import
'package:sky/animation.dart'
;
import
'package:sky/rendering.dart'
;
import
'package:sky/widgets.dart'
;
import
'package:sky/base/scheduler.dart'
as
scheduler
;
import
'../engine/mock_events.dart'
;
...
...
skysprites/lib/skysprites.dart
浏览文件 @
9ef7ebe7
...
...
@@ -11,8 +11,7 @@ import 'dart:typed_data';
import
'dart:sky'
;
import
'package:mojo/core.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/base/scheduler.dart'
as
scheduler
;
import
'package:sky/animation.dart'
;
import
'package:sky/mojo/asset_bundle.dart'
;
import
'package:sky/mojo/shell.dart'
as
shell
;
import
'package:sky/painting/text_painter.dart'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录