From b23b62af5924b4aef5b64b4d7de421a7a1ff9c14 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Thu, 5 Mar 2015 10:16:19 -0800 Subject: [PATCH] Fix the drawer curve to match Android This CL changes the duration of the drawer animation to match the values used by the Android framework. R=eseidel@chromium.org Review URL: https://codereview.chromium.org/976193002 --- examples/fn/widgets/drawer.dart | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/examples/fn/widgets/drawer.dart b/examples/fn/widgets/drawer.dart index ab7277d64e..282310c53e 100644 --- a/examples/fn/widgets/drawer.dart +++ b/examples/fn/widgets/drawer.dart @@ -2,8 +2,8 @@ part of widgets; const double _kWidth = 256.0; const double _kMinFlingVelocity = 0.4; -const double _kMinAnimationDurationMS = 246.0; -const double _kMaxAnimationDurationMS = 600.0; +const double _kBaseSettleDurationMS = 246.0; +const double _kMaxSettleDurationMS = 600.0; const Cubic _kAnimationCurve = easeOut; class DrawerAnimation { @@ -73,10 +73,8 @@ class DrawerAnimation { void _animateToPosition(double targetPosition) { double distance = (targetPosition - _position).abs(); - double duration = math.max( - _kMinAnimationDurationMS, - _kMaxAnimationDurationMS * distance / _kWidth); - + double targetDuration = distance / _kWidth * _kBaseSettleDurationMS; + double duration = math.min(targetDuration, _kMaxSettleDurationMS); _animate(duration, _position, targetPosition, _kAnimationCurve); }