29 Commits

Author SHA1 Message Date
Hixie
878336e8a2 [Effen] Make the drawer not be included in the build output when the drawer is not shown.
This is a prerequisite to dropping 'display:none'.
Included in this CL is making AnimatedValue able to animate more than one field.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1126333006
2015-05-14 09:44:22 -07:00
Hixie
8c4d2556e6 [Effen] fix some dart warnings (mostly unused imports)
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1104233003
2015-04-27 10:54:26 -07:00
Hixie
a2e1ec82f5 [Effen] Tapping on a menu while it's closing should not make it instantly disappear.
This tries to make the menu controller more careful about the state
transitions it goes through, in particular, not firing off animations
while we're already closing (since that used to trigger the "we're
done animating" callback which then closes the menu forcibly).

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1074883005
2015-04-23 13:20:39 -07:00
Hixie
830f8bf0f7 [Effen] Prevent scrolling past the bottom of a scrollable list.
- make the ScrollBehavior instance long-lived, rather than recreating
  it each time we update the list contents.
- have OverscrollBehavior track the total height of the contents and
  the height of the scrollable region, so that it can determine when
  to stop scrolling down.
- teach OverscrollBehavior about how to determine when to stop
  scrolling down, and how to bounce when it's too far down.
- replace the 'energy' concept in Particles with a method that sets
  the energy and direction at the same time, instead of assuming that
  the direction is always positive when setting energy.
- make FixedHeightScrollable lists track the number of items in the
  list and have them update their ScrollBehavior regarding this
  information as it changes.
- track how many items are currently showing in the list stock list.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1097373002
2015-04-21 13:20:30 -07:00
Hixie
1b76bf43d1 [Effen] Reduce splashes when scrolling.
Pipe the remaining time for an animation all the way out to the AnimatedValue.
Make splashes abortable, which causes them to continue to fade but no longer grow, by having them fade in 100ms or however long the animation was still going to go for, whichever is quickest.
Make Scrollables support objects registering with them to be told when scrolling happens.
Make UINode support subclasses being informed when _remove() was called.
Hook all that together to make splashes go away when scrolling by having them register with any ancestor Scrollables such that when those scroll, all the splashes get aborted. Unregister when removed.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1092423003
2015-04-20 15:51:24 -07:00
Hixie
33e9822625 [Effen] implement bounce back behaviour for lists.
Turns out this is
actually three simulations in a row, so we now have a system that can
transition from one to another.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1100583002
2015-04-20 11:44:45 -07:00
Hixie
8c8ad532f4 [Effen] fix typo in animation code (impluse => impulse)
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1076963002
2015-04-09 16:03:09 -07:00
Adam Barth
f2ce04fb3d Menu in StocksApp should animate out
This CL teaches PopupMenu how to animate out as well as in. Also, I've changed
the PopupMenuItem animations to be driven from the PopupMenu itself, which
makes it easier to run the animation in reverse when closing the menu.

TBR=rafaelw@chromium.org

Review URL: https://codereview.chromium.org/1033913002
2015-03-25 10:40:29 -07:00
Rafael Weinstein
86dc24f938 [Effen] Add AnimatedComponent base class
This patch adds a base AnimatedComponent from which most components that animated should derive. It takes care of listening & unlistening from the animations during did(Un)mount as well as binding the animated value to a private field and scheduling the component for build.

Note that this patch removes the did(Un)mount overridable methods from Component and replaces them with a callback mechanism which is less brittle.

BUG=
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1027633003
2015-03-16 03:18:17 -07:00
Adam Barth
10d63a0744 Begin work on the PopupMenu entrance animation
This CL also refactors how animations work, particularly for the Drawer. I've
renamed DrawerAnimation to DrawerController and switched it from being an
Animation to having an Animation. I've also renamed Animation to AnimatedValue
to capture the idea that the class actually presents the value being animated.
Finally, I've factored AnimatedValueListener out of Drawer so that it can be
used by PopupMenuItem as well.

Finally, I've added a scheduleBuild convienence function to Component instead
of having to call setState(() {}), which has come up a couple times.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1016093002
2015-03-18 11:31:07 -07:00
Adam Barth
6eb32909c4 Fix some checked mode errors in drawer.dart
We need to use the more generic type Curve. Also, added an assert to catch this
earlier.

TBR=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1017463002
2015-03-16 12:56:18 -07:00
Adam Barth
9cae912b49 Make Sky's drawer match Material Design spec
This CL makes the drawer the correct size and use the correct animation curve.
Also, remove the hard-coded z-index values now that hit testing works again.
This CL adjusts the mask's opacity to match the drawer in Gmail.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1012463003
2015-03-16 10:16:45 -07:00
Adam Barth
c385c6abdc Remove the "min velocity" hack from ParticleClimbingRamp
Previously, we had a problem with this physics simulation not actually hitting
the edge of the box and causing the scrollable contents to fall back down. To
avoid that problem, we enforced a minimum velocity for the particle to ensure
that it always hit the edge of the box. However, when that min velocity kicked
in, the results were visually unappealing.

This CL fixes the underlying problem. The fix is to apply the impluse from
gravity after updating the particle's position. In that way, we slightly over
estimate the particle's position in every step of the simulation, ensuring that
we don't miss the edge of the box due to errors in our simulation. With this
change, we no longer need the min velocity hack.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1008423002
2015-03-16 09:15:53 -07:00
Adam Barth
85d02799fd Improve Sky's Scrollable physics
We now use a physics simulationt to drive the scroll fling. We're also closer
to integrating fling into overscroll.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1004363002
2015-03-13 15:57:41 -07:00
Adam Barth
a8aeed8a0d Add missing import 2015-03-13 10:15:36 -07:00
Adam Barth
1eb13d0112 Organize sky/framework/animation
This CL cleans up the sky/framework/animation as follows:

1) I've moved code that's used only by the custom elements framework into
   sky/framework/elements/animation. This code is based on AnimationDelegates
   rather than Streams.
2) Rename ScrollCurve to ScrollBehavior because it encapsulates more behavior
   than just a curve.
3) Make the Generator interface explicit and mark subclasses as actual
   subclasses.
4) Move Simulation into generators.dart because it implements the Generator
   interface.
5) Move Animation out of generators.dart because it does not implement the
   Generator interface.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1001373002
2015-03-13 10:04:56 -07:00
Adam Barth
06bfddff81 Drive overscroll animations with a physics simulation
This CL uses a simple physics simulation to drive overscroll animations.
We model settling the overscroll as a particle climbing a hill, which
gives us a pleasing parabolic trajectory.

This CL also includes machinery for spring-based simulations. We'll use
these to drive the drawer animation.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/999423004
2015-03-13 09:31:10 -07:00
Adam Barth
70aa7795c7 Scrollable should settle back to 0.0
This CL teaches Scrollable how to settle back to a scroll offset of 0.0 after a
fling or a scroll. There's still some room for improvement:

1) Some of this logic should be factored out into the scroll curve object.
2) We don't produce the correct animation curves when we fling into the
   overscroll region because we wait for the fling velocity to reach zero
   before we start the settling animation.

R=ojan@chromium.org, eseidel@chromium.org

Review URL: https://codereview.chromium.org/1005753002
2015-03-12 14:33:37 -07:00
Adam Barth
52d2d67754 Implement an OverscrollCurve for Scrollable
When using OverscrollCurve, we continue to scroll beyond the top of the
scrollable area but the scroll delta is reduced by 2x. A future CL will add an
animation at gesturescrollend to relax back to scroll position 0.0.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1002953003
2015-03-12 13:08:44 -07:00
Adam Barth
7cb9edebe1 Factor ScrollCurve out of Scrollable
Intead of hard-coding the notion of bounded scrolling into Scrollable, this CL
factors out a ScrollCurve class that applies the bounds. In the future, we'll
refine this mechanism to implement overflow scrolling.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1005633002
2015-03-12 10:36:09 -07:00
Adam Barth
111a25a569 Rename fling-curve.dart to fling_curve.dart
We're using underscores as word separators per Dart style.

TBR=eseidel@chromium.org

Review URL: https://codereview.chromium.org/998373002
2015-03-12 09:40:43 -07:00
Adam Barth
deb2f1b757 Fix errors in Sky detected by Dart analyzer
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1000863002
2015-03-11 22:04:22 -07:00
Rafael Weinstein
c7573c12a0 Add initialDelay to AnimationGenerator and add Animation class.
This patch allows for an initial delay before an animation begins and also adds an Animation class which encapsulates a value which is long-lived, can be explicitly set and also animated from its current value to another value.

BUG=
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/994143002
2015-03-10 12:22:15 -07:00
Adam Barth
270d658ad9 Sometimes the drawer doesn't fully close
The AnimationGenerator didn't always generate the |end| value because of
floating point rounding. This CL causes it to always generate |end| at the end.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/983893002
2015-03-05 15:53:22 -08:00
Hixie
37c27faae4 fix the hang when clicking the drawer in the stocks app
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/980043005
2015-03-05 15:46:21 -08:00
Adam Barth
ca60f330e9 Move animationgenerator.dart to sky/framework/animation/generator.dart
That's where it belongs.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/979283002
2015-03-05 11:40:35 -08:00
Adam Barth
4df0891248 Organize sky/framework a bit
- Removed out-of-date README.md
- Moved fling-curve into the animation directory because it's part of the
  animation behavior of the system.
- Moved view-configuration into the theme directory because it's a collection
  of constants similar in flavor to the colors and the shadows. Eventually
  we'll want to make the theme configurable and have these all together will
  hopefully make that easier.
- Moved dom-serializer into tests/resources because it is used only by tests.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/980423002
2015-03-05 09:59:50 -08:00
Adam Barth
e2c18721ff Port sky-drawer to Dart
Also, port the "appish" example to exercise the drawer.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/942413002
2015-02-23 08:30:58 -08:00
Adam Barth
16c4b41391 This CL adds an "appish" example to the Sky examples, including a drawer widget.
R=eseidel@chromium.org, esprehn@chromium.org

Review URL: https://codereview.chromium.org/886723002
2015-01-29 11:21:39 -08:00