diff --git a/examples/fitness/lib/main.dart b/examples/fitness/lib/main.dart index a4d40d1b2ac9282b4f335c672e9ac0a5e508c311..740ac9e79cfbcc0036a9611c2b79775d639a2518 100644 --- a/examples/fitness/lib/main.dart +++ b/examples/fitness/lib/main.dart @@ -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'; diff --git a/examples/rendering/spinning_flex.dart b/examples/rendering/spinning_flex.dart index d217c325a6084536eaeec63a2e4daa5235c4114d..b2fc6e894f8ec3ba3f40969f525b2c5523cbd97d 100644 --- a/examples/rendering/spinning_flex.dart +++ b/examples/rendering/spinning_flex.dart @@ -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'; diff --git a/examples/stocks/lib/main.dart b/examples/stocks/lib/main.dart index ba81c856ac6c48ddb6164c41ad0c7ca8a46082db..1962baa424ff9d4184ef7402cd9c5a13950d795f 100644 --- a/examples/stocks/lib/main.dart +++ b/examples/stocks/lib/main.dart @@ -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'; diff --git a/examples/widgets/card_collection.dart b/examples/widgets/card_collection.dart index b81da2807c5523e4b542e7f42f88fd5e8e17ed50..a0bbb3cd03d485e4baab6272db6a80f4262b56d7 100644 --- a/examples/widgets/card_collection.dart +++ b/examples/widgets/card_collection.dart @@ -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 { diff --git a/examples/widgets/pageable_list.dart b/examples/widgets/pageable_list.dart index 881cff510714b30d247ce1ec07298f470ae2a0e8..a62630698afe0b40b30b73fbc711f84d1b87c70c 100644 --- a/examples/widgets/pageable_list.dart +++ b/examples/widgets/pageable_list.dart @@ -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 { diff --git a/examples/widgets/progress_indicator.dart b/examples/widgets/progress_indicator.dart index a9be0488044ff25cfe73c188a5ba0eaf6ca0f275..1adc5dd22858814a4253f7a62d4979ac8c37b879 100644 --- a/examples/widgets/progress_indicator.dart +++ b/examples/widgets/progress_indicator.dart @@ -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'; diff --git a/examples/widgets/spinning_mixed.dart b/examples/widgets/spinning_mixed.dart index 44a20b37532d5708950379f06acc152e421b21ea..2a2463bf55ad09b91ad4bdd2d8d586b00eb533f7 100644 --- a/examples/widgets/spinning_mixed.dart +++ b/examples/widgets/spinning_mixed.dart @@ -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'; diff --git a/sky/packages/sky/lib/README.md b/sky/packages/sky/lib/README.md index c52ef87186dacaf0baf682564671a6d4b9a09b5a..1b27173276c67f29b3cacdee7f4369ee27e3b66c 100644 --- a/sky/packages/sky/lib/README.md +++ b/sky/packages/sky/lib/README.md @@ -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/) directory, -which provide core primitives for animating values, and in the [gestures/](gestures/) +Above this layer is the [animation](animation.dart) library, +which provides 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/) -directory, using a reactive framework. They use data given in the +Widgets are provided by the files in the [widgets](widgets.dart) +library, 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 summarising all this: +Here is a diagram summarizing all this: +-----------------------------+ ------ | YOUR APP | | +----------------------+---+ - | | widgets/ (theme/) | | + | | widgets (theme/) | | | ++---------------------++ | - | | rendering/ | | Dart + | | rendering | | Dart | |---------+------------+ | | | | painting/ | | +-+ +------------+ | - | gestures/ | animation/ | | + | gestures/ | animation | | +-----------+---+--------+ | | base/ | mojo/ | +------------+--+-+----+------+ ------- diff --git a/sky/packages/sky/lib/animation.dart b/sky/packages/sky/lib/animation.dart new file mode 100644 index 0000000000000000000000000000000000000000..6a8b2869b2016bc266b5cd69e3a61d40112cbb53 --- /dev/null +++ b/sky/packages/sky/lib/animation.dart @@ -0,0 +1,19 @@ +// 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'; diff --git a/sky/packages/sky/lib/animation/direction.dart b/sky/packages/sky/lib/animation/direction.dart deleted file mode 100644 index 1a72ed771f90c9b596ce7a24c27272cf383cde6f..0000000000000000000000000000000000000000 --- a/sky/packages/sky/lib/animation/direction.dart +++ /dev/null @@ -1,8 +0,0 @@ -// 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 -} diff --git a/sky/packages/sky/lib/base/debug.dart b/sky/packages/sky/lib/base/debug.dart index ae396dfd4927a82409bc5b2fe3559e026ad9e974..53e02ae9d919851cd1f1c73a3e47e4d846c6e83b 100644 --- a/sky/packages/sky/lib/base/debug.dart +++ b/sky/packages/sky/lib/base/debug.dart @@ -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; diff --git a/sky/packages/sky/lib/base/scheduler.dart b/sky/packages/sky/lib/base/scheduler.dart deleted file mode 100644 index c0e0ecea8a887b3836d205a518507448b02a3368..0000000000000000000000000000000000000000 --- a/sky/packages/sky/lib/base/scheduler.dart +++ /dev/null @@ -1,88 +0,0 @@ -// 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 _persistentCallbacks = new List(); -Map _transientCallbacks = new LinkedHashMap(); -final Set _removedIds = new Set(); - -/// 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 callbacks = _transientCallbacks; - _transientCallbacks = new Map(); - - 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; -} diff --git a/sky/packages/sky/lib/painting/README.md b/sky/packages/sky/lib/painting/README.md index 64967d7d8f024e1764aa57c844f010a03d79265c..ed05e995f643a96ea42c4863fb73389f0bad5341 100644 --- a/sky/packages/sky/lib/painting/README.md +++ b/sky/packages/sky/lib/painting/README.md @@ -1,3 +1,3 @@ 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. diff --git a/sky/packages/sky/lib/painting/radial_reaction.dart b/sky/packages/sky/lib/painting/radial_reaction.dart index 69663d00b1264905feecf903cad9dfaf30ee264a..0e4aa0034c9a0e4286f4bdc6a1f171023264a262 100644 --- a/sky/packages/sky/lib/painting/radial_reaction.dart +++ b/sky/packages/sky/lib/painting/radial_reaction.dart @@ -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); diff --git a/sky/packages/sky/lib/animation/README.md b/sky/packages/sky/lib/src/animation/README.md similarity index 51% rename from sky/packages/sky/lib/animation/README.md rename to sky/packages/sky/lib/src/animation/README.md index 55f96cae9ef7ed1f26c83ff12fab37f37f856d5f..6b2ebb3a0aa411479cee7428310b0209a4a7c847 100644 --- a/sky/packages/sky/lib/animation/README.md +++ b/sky/packages/sky/lib/src/animation/README.md @@ -1,2 +1,2 @@ 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. diff --git a/sky/packages/sky/lib/animation/animated_simulation.dart b/sky/packages/sky/lib/src/animation/animated_simulation.dart similarity index 97% rename from sky/packages/sky/lib/animation/animated_simulation.dart rename to sky/packages/sky/lib/src/animation/animated_simulation.dart index b3278e20762448d2abe0abacd054e7e44aa6152b..18ce06fc88eb7231223419ca3c9246663a0c61c6 100644 --- a/sky/packages/sky/lib/animation/animated_simulation.dart +++ b/sky/packages/sky/lib/src/animation/animated_simulation.dart @@ -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; diff --git a/sky/packages/sky/lib/animation/animated_value.dart b/sky/packages/sky/lib/src/animation/animated_value.dart similarity index 94% rename from sky/packages/sky/lib/animation/animated_value.dart rename to sky/packages/sky/lib/src/animation/animated_value.dart index 02cc3b3b8c39880025f6fcd748654ac65eb0edb2..7f9877d911c4da913aa869cce9a8d2836b7cbfc3 100644 --- a/sky/packages/sky/lib/animation/animated_value.dart +++ b/sky/packages/sky/lib/src/animation/animated_value.dart @@ -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); diff --git a/sky/packages/sky/lib/animation/animation_performance.dart b/sky/packages/sky/lib/src/animation/animation_performance.dart similarity index 96% rename from sky/packages/sky/lib/animation/animation_performance.dart rename to sky/packages/sky/lib/src/animation/animation_performance.dart index 700f572cdc3d2144fba6743475526c5d266b8919..af0c1744590e2cd3de4d2243a129f6dad9adb273 100644 --- a/sky/packages/sky/lib/animation/animation_performance.dart +++ b/sky/packages/sky/lib/src/animation/animation_performance.dart @@ -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 diff --git a/sky/packages/sky/lib/animation/curves.dart b/sky/packages/sky/lib/src/animation/curves.dart similarity index 91% rename from sky/packages/sky/lib/animation/curves.dart rename to sky/packages/sky/lib/src/animation/curves.dart index b16c1388e49c689e20881f77bdb66dc3a4ce0e28..5e9cb6892e1f3400cc8fd8c41761d35eb00cae60 100644 --- a/sky/packages/sky/lib/animation/curves.dart +++ b/sky/packages/sky/lib/src/animation/curves.dart @@ -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(); diff --git a/sky/packages/sky/lib/animation/forces.dart b/sky/packages/sky/lib/src/animation/forces.dart similarity index 87% rename from sky/packages/sky/lib/animation/forces.dart rename to sky/packages/sky/lib/src/animation/forces.dart index 6353c8afc43de25dbdc3e31002026b9e5376686a..8c57978015fbfdf7195d2fd58fc81107285d5212 100644 --- a/sky/packages/sky/lib/animation/forces.dart +++ b/sky/packages/sky/lib/src/animation/forces.dart @@ -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 ); diff --git a/sky/packages/sky/lib/src/animation/scheduler.dart b/sky/packages/sky/lib/src/animation/scheduler.dart new file mode 100644 index 0000000000000000000000000000000000000000..999ba8900825c123aebef165ac54d1106ee760e5 --- /dev/null +++ b/sky/packages/sky/lib/src/animation/scheduler.dart @@ -0,0 +1,95 @@ +// 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 _persistentCallbacks = new List(); + Map _transientCallbacks = new LinkedHashMap(); + final Set _removedIds = new Set(); + + /// 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 callbacks = _transientCallbacks; + _transientCallbacks = new Map(); + + 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._(); diff --git a/sky/packages/sky/lib/animation/scroll_behavior.dart b/sky/packages/sky/lib/src/animation/scroll_behavior.dart similarity index 100% rename from sky/packages/sky/lib/animation/scroll_behavior.dart rename to sky/packages/sky/lib/src/animation/scroll_behavior.dart diff --git a/sky/packages/sky/lib/animation/timeline.dart b/sky/packages/sky/lib/src/animation/timeline.dart similarity index 97% rename from sky/packages/sky/lib/animation/timeline.dart rename to sky/packages/sky/lib/src/animation/timeline.dart index 33073493f6aab04f7cb5693779ec6c5ee346394b..294c918930d656f849623a07df851bf73fee18ff 100644 --- a/sky/packages/sky/lib/animation/timeline.dart +++ b/sky/packages/sky/lib/src/animation/timeline.dart @@ -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 { diff --git a/sky/packages/sky/lib/src/rendering/README.md b/sky/packages/sky/lib/src/rendering/README.md index 91ba8a2ab9b4e4c42cec1507e20a84f5e6a6830a..ff864f2d00b91052235e884e02b9260a45853372 100644 --- a/sky/packages/sky/lib/src/rendering/README.md +++ b/sky/packages/sky/lib/src/rendering/README.md @@ -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) diff --git a/sky/packages/sky/lib/src/rendering/object.dart b/sky/packages/sky/lib/src/rendering/object.dart index 0977c1f3ec5fad1bd792aab38ed778799002e04d..886769038d466f295def2760acaa642e181595e6 100644 --- a/sky/packages/sky/lib/src/rendering/object.dart +++ b/sky/packages/sky/lib/src/rendering/object.dart @@ -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'; diff --git a/sky/packages/sky/lib/src/rendering/sky_binding.dart b/sky/packages/sky/lib/src/rendering/sky_binding.dart index bb714d584fd30dfc4124ff27ef4f00d9c8433584..d5ce39530a9fd5ecf480bfd38d10accfa99a8178 100644 --- a/sky/packages/sky/lib/src/rendering/sky_binding.dart +++ b/sky/packages/sky/lib/src/rendering/sky_binding.dart @@ -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(); diff --git a/sky/packages/sky/lib/src/rendering/toggleable.dart b/sky/packages/sky/lib/src/rendering/toggleable.dart index c42d1d8201225c08718ca1cb234f7b00618de402..71673f933d46d3f0fdc3828a613ee2c136b0674c 100644 --- a/sky/packages/sky/lib/src/rendering/toggleable.dart +++ b/sky/packages/sky/lib/src/rendering/toggleable.dart @@ -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'; diff --git a/sky/packages/sky/lib/src/rendering/view.dart b/sky/packages/sky/lib/src/rendering/view.dart index 0292be3ef4ff2042f8e27cf2a98252f7cadef4ae..943f0957f4bd7581936949ef7075dbe2b8094e37 100644 --- a/sky/packages/sky/lib/src/rendering/view.dart +++ b/sky/packages/sky/lib/src/rendering/view.dart @@ -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'; diff --git a/sky/packages/sky/lib/src/widgets/README.md b/sky/packages/sky/lib/src/widgets/README.md index 3deaa763df256753c53a847de829ce45a3bfaf10..0fcb964681f772a4c436651cbb778c8a5d79ed3c 100644 --- a/sky/packages/sky/lib/src/widgets/README.md +++ b/sky/packages/sky/lib/src/widgets/README.md @@ -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) diff --git a/sky/packages/sky/lib/src/widgets/animated_component.dart b/sky/packages/sky/lib/src/widgets/animated_component.dart index 2088a4d6a1f9aafb998b1bc73986bf97d37f99b0..f23d884fd33149d4946e3628ee8f113936769ba0 100644 --- a/sky/packages/sky/lib/src/widgets/animated_component.dart +++ b/sky/packages/sky/lib/src/widgets/animated_component.dart @@ -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 { diff --git a/sky/packages/sky/lib/src/widgets/animated_container.dart b/sky/packages/sky/lib/src/widgets/animated_container.dart index a2db6bb20a5c8daa115564e84b31044983b88d24..744f1b65273634b7ee6a8c669416d15e640afb98 100644 --- a/sky/packages/sky/lib/src/widgets/animated_container.dart +++ b/sky/packages/sky/lib/src/widgets/animated_container.dart @@ -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'; diff --git a/sky/packages/sky/lib/src/widgets/dialog.dart b/sky/packages/sky/lib/src/widgets/dialog.dart index 2db1f1cebc1e570fc8c576191a8be6ab69e7376d..713b63577c3c6f7bc26e7897ba1999df6ef1423f 100644 --- a/sky/packages/sky/lib/src/widgets/dialog.dart +++ b/sky/packages/sky/lib/src/widgets/dialog.dart @@ -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'; diff --git a/sky/packages/sky/lib/src/widgets/dismissable.dart b/sky/packages/sky/lib/src/widgets/dismissable.dart index a84827572d7dac39f10d15c61e00333cff1e464e..7425cdb0a9a695cfd28fa042a28d9da28505e2cf 100644 --- a/sky/packages/sky/lib/src/widgets/dismissable.dart +++ b/sky/packages/sky/lib/src/widgets/dismissable.dart @@ -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'; diff --git a/sky/packages/sky/lib/src/widgets/drawer.dart b/sky/packages/sky/lib/src/widgets/drawer.dart index feb2a029660598f8184384256e4eb7b39700a3eb..d6f3ce6ea2ef9c503f7503a72b537a14a5bc653b 100644 --- a/sky/packages/sky/lib/src/widgets/drawer.dart +++ b/sky/packages/sky/lib/src/widgets/drawer.dart @@ -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 diff --git a/sky/packages/sky/lib/src/widgets/framework.dart b/sky/packages/sky/lib/src/widgets/framework.dart index 25138bfe588e5c24e821a7d8acd6e7b25608126b..3f982b72ed4e6cbe3c5b9039c0df74419f91e796 100644 --- a/sky/packages/sky/lib/src/widgets/framework.dart +++ b/sky/packages/sky/lib/src/widgets/framework.dart @@ -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'; diff --git a/sky/packages/sky/lib/src/widgets/ink_well.dart b/sky/packages/sky/lib/src/widgets/ink_well.dart index 584491212c94a2be2567d3801282a2683e48be6e..503956610d5f2d6951e2ce6415330e55ba68bb23 100644 --- a/sky/packages/sky/lib/src/widgets/ink_well.dart +++ b/sky/packages/sky/lib/src/widgets/ink_well.dart @@ -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'; diff --git a/sky/packages/sky/lib/src/widgets/mimic_overlay.dart b/sky/packages/sky/lib/src/widgets/mimic_overlay.dart index f4958d6ab012bfb385c767a2a0261321f9352aa3..9c7c742db31dd4773137b026fff30f06c8bb74c6 100644 --- a/sky/packages/sky/lib/src/widgets/mimic_overlay.dart +++ b/sky/packages/sky/lib/src/widgets/mimic_overlay.dart @@ -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'; diff --git a/sky/packages/sky/lib/src/widgets/navigator.dart b/sky/packages/sky/lib/src/widgets/navigator.dart index 8fa3a1107fff081cbaf7c7a50b1d29679ec35513..07e97a7732cda880c00c95640953d6985bfd42b2 100644 --- a/sky/packages/sky/lib/src/widgets/navigator.dart +++ b/sky/packages/sky/lib/src/widgets/navigator.dart @@ -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'; diff --git a/sky/packages/sky/lib/src/widgets/popup_menu.dart b/sky/packages/sky/lib/src/widgets/popup_menu.dart index f08d7b7d97ca23038a156653925a7cfda1483e17..49185d08cd548ba58c0c2113944faa643211a6a1 100644 --- a/sky/packages/sky/lib/src/widgets/popup_menu.dart +++ b/sky/packages/sky/lib/src/widgets/popup_menu.dart @@ -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; diff --git a/sky/packages/sky/lib/src/widgets/progress_indicator.dart b/sky/packages/sky/lib/src/widgets/progress_indicator.dart index 3688e43d4002409c5969c5580629df39a2ec3363..6a7b683411f4a5d8acae41ca22c6417eb66a5f3d 100644 --- a/sky/packages/sky/lib/src/widgets/progress_indicator.dart +++ b/sky/packages/sky/lib/src/widgets/progress_indicator.dart @@ -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'; diff --git a/sky/packages/sky/lib/src/widgets/scrollable.dart b/sky/packages/sky/lib/src/widgets/scrollable.dart index 6789534cd09ec551146d94da68613f2cc3cec21f..b803fa55eabe9d500b6810100affab5506ddad9c 100644 --- a/sky/packages/sky/lib/src/widgets/scrollable.dart +++ b/sky/packages/sky/lib/src/widgets/scrollable.dart @@ -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'; diff --git a/sky/packages/sky/lib/src/widgets/snack_bar.dart b/sky/packages/sky/lib/src/widgets/snack_bar.dart index 2e5a521a94e78664ed7bf7536becc4adf0ca9c3e..eae0ae8920fbd96fa09c9ae245f7fdbda00b594a 100644 --- a/sky/packages/sky/lib/src/widgets/snack_bar.dart +++ b/sky/packages/sky/lib/src/widgets/snack_bar.dart @@ -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); diff --git a/sky/packages/sky/lib/src/widgets/tabs.dart b/sky/packages/sky/lib/src/widgets/tabs.dart index 804efe3ad75b46247bf18264db0fab47245796b3..3a3d8fce7d9cd56bceda65a0f66125e0757dac70 100644 --- a/sky/packages/sky/lib/src/widgets/tabs.dart +++ b/sky/packages/sky/lib/src/widgets/tabs.dart @@ -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'; diff --git a/sky/packages/sky/lib/src/widgets/transitions.dart b/sky/packages/sky/lib/src/widgets/transitions.dart index d94a6b721fa6cf36b9a3bb3cfd8bfd2dd80b44df..35e431ef61faf78f8ec509ed7be8322ff1293e6e 100644 --- a/sky/packages/sky/lib/src/widgets/transitions.dart +++ b/sky/packages/sky/lib/src/widgets/transitions.dart @@ -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 diff --git a/sky/unit/test/base/scheduler_test.dart b/sky/unit/test/animation/scheduler_test.dart similarity index 95% rename from sky/unit/test/base/scheduler_test.dart rename to sky/unit/test/animation/scheduler_test.dart index a49379734ce172412495ceddbdb420c6e8d170b2..380de02bb3e751f1b1d2505ecba8b78661c00eb6 100644 --- a/sky/unit/test/base/scheduler_test.dart +++ b/sky/unit/test/animation/scheduler_test.dart @@ -1,4 +1,4 @@ -import 'package:sky/base/scheduler.dart' as scheduler; +import 'package:sky/animation.dart'; import 'package:test/test.dart'; void main() { diff --git a/sky/unit/test/widget/widget_tester.dart b/sky/unit/test/widget/widget_tester.dart index ae1da3f2d46c8036f92bd2ea4979f87518fead76..356f45b307486c4a790fa09bf993a1b47926e349 100644 --- a/sky/unit/test/widget/widget_tester.dart +++ b/sky/unit/test/widget/widget_tester.dart @@ -1,8 +1,8 @@ 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'; diff --git a/skysprites/lib/skysprites.dart b/skysprites/lib/skysprites.dart index 3bb57b1d2f4b4dc75030e2109b26f663e3e2b9fe..9d300e7f5c7b272b820b804ee979eba11c8208e2 100644 --- a/skysprites/lib/skysprites.dart +++ b/skysprites/lib/skysprites.dart @@ -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';