Index: ash/wm/window_animations.cc |
=================================================================== |
--- ash/wm/window_animations.cc (revision 127567) |
+++ ash/wm/window_animations.cc (working copy) |
@@ -4,7 +4,6 @@ |
#include "ash/wm/window_animations.h" |
-#include "ash/animation_timings.h" |
#include "ash/ash_switches.h" |
#include "ash/launcher/launcher.h" |
#include "ash/shell.h" |
@@ -73,10 +72,10 @@ |
const float kWindowAnimation_HideOpacity = 0.f; |
const float kWindowAnimation_ShowOpacity = 1.f; |
-const float kWindowAnimation_TranslateX = 3.f; |
-const float kWindowAnimation_TranslateY = -12.f; |
-const float kWindowAnimation_ScaleFactor = .95f; |
+const float kWindowAnimation_TranslateFactor = -0.025f; |
+const float kWindowAnimation_ScaleFactor = 1.05f; |
const float kWindowAnimation_MinimizeRotate = -5.f; |
+ |
const float kWindowAnimation_Vertical_TranslateY = 15.f; |
// Amount windows are scaled during workspace animations. |
@@ -184,14 +183,6 @@ |
DISALLOW_COPY_AND_ASSIGN(WorkspaceHidingWindowAnimationObserver); |
}; |
-base::TimeDelta GetAnimationDurationForWindow(aura::Window* window) { |
- int duration = |
- window->GetProperty(internal::kWindowVisibilityAnimationDurationKey); |
- if (duration > 0) |
- return TimeDelta::FromInternalValue(duration); |
- return TimeDelta::FromMilliseconds(kStandardTransitionDuration); |
-} |
- |
// Shows a window using an animation, animating its opacity from 0.f to 1.f, and |
// its transform from |start_transform| to |end_transform|. |
void AnimateShowWindowCommon(aura::Window* window, |
@@ -204,7 +195,11 @@ |
{ |
// Property sets within this scope will be implicitly animated. |
ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); |
- settings.SetTransitionDuration(GetAnimationDurationForWindow(window)); |
+ int duration = |
+ window->GetProperty(internal::kWindowVisibilityAnimationDurationKey); |
+ if (duration > 0) |
+ settings.SetTransitionDuration(TimeDelta::FromInternalValue(duration)); |
+ |
window->layer()->SetTransform(end_transform); |
window->layer()->SetOpacity(kWindowAnimation_ShowOpacity); |
} |
@@ -220,7 +215,11 @@ |
ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); |
settings.AddObserver(new HidingWindowAnimationObserver(window)); |
- settings.SetTransitionDuration(GetAnimationDurationForWindow(window)); |
+ int duration = |
+ window->GetProperty(internal::kWindowVisibilityAnimationDurationKey); |
+ if (duration > 0) |
+ settings.SetTransitionDuration(TimeDelta::FromInternalValue(duration)); |
+ |
window->layer()->SetOpacity(kWindowAnimation_HideOpacity); |
window->layer()->SetTransform(end_transform); |
} |
@@ -230,8 +229,9 @@ |
ui::Transform transform; |
transform.ConcatScale(kWindowAnimation_ScaleFactor, |
kWindowAnimation_ScaleFactor); |
- transform.ConcatTranslate(kWindowAnimation_TranslateX, |
- kWindowAnimation_TranslateY); |
+ transform.ConcatTranslate( |
+ kWindowAnimation_TranslateFactor * window->bounds().width(), |
+ kWindowAnimation_TranslateFactor * window->bounds().height()); |
AnimateShowWindowCommon(window, transform, ui::Transform()); |
} |
@@ -239,10 +239,9 @@ |
ui::Transform transform; |
transform.ConcatScale(kWindowAnimation_ScaleFactor, |
kWindowAnimation_ScaleFactor); |
- // Window keeps dropping vertically when hidden (i.e. doesn't reverse |
- // direction) |
- transform.ConcatTranslate(kWindowAnimation_TranslateX, |
- -kWindowAnimation_TranslateY); |
+ transform.ConcatTranslate( |
+ kWindowAnimation_TranslateFactor * window->bounds().width(), |
+ kWindowAnimation_TranslateFactor * window->bounds().height()); |
AnimateHideWindowCommon(window, transform); |
} |
@@ -300,8 +299,6 @@ |
{ |
// Property sets within this scope will be implicitly animated. |
ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); |
- settings.SetTransitionDuration( |
- TimeDelta::FromMilliseconds(kSlowTransitionDuration)); |
window->layer()->SetTransform(ui::Transform()); |
// Opacity animates only during the first half of the animation. |
@@ -325,8 +322,6 @@ |
{ |
// Property sets within this scope will be implicitly animated. |
ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); |
- settings.SetTransitionDuration( |
- TimeDelta::FromMilliseconds(kSlowTransitionDuration)); |
// Add an observer that sets visibility of the layer to false once animation |
// completes. |
settings.AddObserver(new WorkspaceHidingWindowAnimationObserver(window)); |