Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2860)

Unified Diff: ash/wm/overview/scoped_overview_animation_settings_aura.cc

Issue 2239233002: [ash-md] Fades overview header in and out (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [ash-md] Fades overview header in and out (fixed a new test assertion) Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/wm/overview/scoped_overview_animation_settings_aura.cc
diff --git a/ash/wm/overview/scoped_overview_animation_settings_aura.cc b/ash/wm/overview/scoped_overview_animation_settings_aura.cc
index 994d85497de04427c9b147aac6ea099c4584bc38..d6b4cc950b57b99981f7319db0d41d751c7b771c 100644
--- a/ash/wm/overview/scoped_overview_animation_settings_aura.cc
+++ b/ash/wm/overview/scoped_overview_animation_settings_aura.cc
@@ -8,6 +8,8 @@
#include "base/time/time.h"
#include "ui/aura/window.h"
#include "ui/compositor/layer.h"
+#include "ui/compositor/layer_animation_observer.h"
+#include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/gfx/animation/tween.h"
namespace ash {
@@ -15,7 +17,7 @@ namespace ash {
namespace {
// The time duration for transformation animations.
-const int kTransitionMilliseconds = 200;
+const int kTransitionMilliseconds = 300;
// The time duration for fading out when closing an item. Only used with
// Material Design.
@@ -26,17 +28,24 @@ const int kCloseFadeOutMillisecondsMd = 50;
const int kCloseScaleMillisecondsMd = 100;
// The time duration for widgets to fade in.
-const int kFadeInMilliseconds = 80;
+const int kFadeInMilliseconds = 60;
+
+// The time duration for widgets to fade out.
+const int kFadeOutDelayMilliseconds = kTransitionMilliseconds * 1 / 5;
+const int kFadeOutMilliseconds = kTransitionMilliseconds * 3 / 5;
base::TimeDelta GetAnimationDuration(OverviewAnimationType animation_type) {
+ const bool material = ash::MaterialDesignController::IsOverviewMaterial();
switch (animation_type) {
case OVERVIEW_ANIMATION_NONE:
return base::TimeDelta();
case OVERVIEW_ANIMATION_ENTER_OVERVIEW_MODE_FADE_IN:
- return base::TimeDelta::FromMilliseconds(kFadeInMilliseconds);
+ return base::TimeDelta::FromMilliseconds(
+ material ? kFadeInMilliseconds : kTransitionMilliseconds);
+ case OVERVIEW_ANIMATION_EXIT_OVERVIEW_MODE_FADE_OUT:
+ return base::TimeDelta::FromMilliseconds(kFadeOutMilliseconds);
case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS:
case OVERVIEW_ANIMATION_RESTORE_WINDOW:
- case OVERVIEW_ANIMATION_HIDE_WINDOW:
return base::TimeDelta::FromMilliseconds(kTransitionMilliseconds);
case OVERVIEW_ANIMATION_CLOSING_SELECTOR_ITEM:
return base::TimeDelta::FromMilliseconds(kCloseScaleMillisecondsMd);
@@ -52,44 +61,57 @@ base::TimeDelta GetAnimationDuration(OverviewAnimationType animation_type) {
ScopedOverviewAnimationSettingsAura::ScopedOverviewAnimationSettingsAura(
OverviewAnimationType animation_type,
aura::Window* window)
- : animation_settings_(window->layer()->GetAnimator()) {
+ : animation_settings_(new ui::ScopedLayerAnimationSettings(
+ window->layer()->GetAnimator())) {
+ const bool material = ash::MaterialDesignController::IsOverviewMaterial();
switch (animation_type) {
case OVERVIEW_ANIMATION_NONE:
- animation_settings_.SetPreemptionStrategy(
+ animation_settings_->SetPreemptionStrategy(
ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS);
break;
case OVERVIEW_ANIMATION_ENTER_OVERVIEW_MODE_FADE_IN:
+ if (material) {
+ animation_settings_->SetTweenType(gfx::Tween::EASE_IN);
+ } else {
+ window->layer()->GetAnimator()->SchedulePauseForProperties(
+ GetAnimationDuration(OverviewAnimationType::
+ OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS),
+ ui::LayerAnimationElement::OPACITY);
+ }
+ animation_settings_->SetPreemptionStrategy(
+ ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS);
+ break;
+ case OVERVIEW_ANIMATION_EXIT_OVERVIEW_MODE_FADE_OUT:
window->layer()->GetAnimator()->SchedulePauseForProperties(
- GetAnimationDuration(
- OverviewAnimationType::OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS),
+ base::TimeDelta::FromMilliseconds(kFadeOutDelayMilliseconds),
ui::LayerAnimationElement::OPACITY);
- animation_settings_.SetPreemptionStrategy(
+ animation_settings_->SetTweenType(gfx::Tween::EASE_OUT);
+ animation_settings_->SetPreemptionStrategy(
ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS);
break;
case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS:
case OVERVIEW_ANIMATION_RESTORE_WINDOW:
- animation_settings_.SetPreemptionStrategy(
+ animation_settings_->SetPreemptionStrategy(
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
- animation_settings_.SetTweenType(
- ash::MaterialDesignController::IsOverviewMaterial()
- ? gfx::Tween::EASE_IN_2
- : gfx::Tween::FAST_OUT_SLOW_IN);
+ animation_settings_->SetTweenType(
+ material ? gfx::Tween::EASE_OUT : gfx::Tween::FAST_OUT_SLOW_IN);
break;
case OVERVIEW_ANIMATION_CLOSING_SELECTOR_ITEM:
case OVERVIEW_ANIMATION_CLOSE_SELECTOR_ITEM:
- animation_settings_.SetPreemptionStrategy(
+ animation_settings_->SetPreemptionStrategy(
ui::LayerAnimator::ENQUEUE_NEW_ANIMATION);
- animation_settings_.SetTweenType(gfx::Tween::EASE_OUT);
- break;
- case OVERVIEW_ANIMATION_HIDE_WINDOW:
- animation_settings_.SetPreemptionStrategy(
- ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
+ animation_settings_->SetTweenType(gfx::Tween::EASE_OUT);
break;
}
- animation_settings_.SetTransitionDuration(
+ animation_settings_->SetTransitionDuration(
GetAnimationDuration(animation_type));
}
ScopedOverviewAnimationSettingsAura::~ScopedOverviewAnimationSettingsAura() {}
+void ScopedOverviewAnimationSettingsAura::AddObserver(
+ ui::ImplicitAnimationObserver* observer) {
+ animation_settings_->AddObserver(observer);
+}
+
} // namespace ash
« no previous file with comments | « ash/wm/overview/scoped_overview_animation_settings_aura.h ('k') | ash/wm/overview/window_selector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698