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

Unified Diff: ash/wm/window_animations.cc

Issue 10800020: Add brightness/grayscale animations and use them for OOBE boot transition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove test change Created 8 years, 5 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/window_animations.cc
diff --git a/ash/wm/window_animations.cc b/ash/wm/window_animations.cc
index 8faaef550236a3fc11f09f0ac14ddaf637257169..e18a4756a2203e3e98fb5387634f71d4e306cc90 100644
--- a/ash/wm/window_animations.cc
+++ b/ash/wm/window_animations.cc
@@ -69,6 +69,15 @@ const int kDefaultAnimationDurationForMenuMS = 150;
const float kCrossFadeDurationMinMs = 100.f;
const float kCrossFadeDurationMaxMs = 400.f;
+// Durations for the brightness/grayscale fade animation, in milliseconds.
+const int kBrightnessGrayscaleFadeDurationMs = 2000;
sky 2012/07/19 19:22:19 This is a really long time. Are you sure we want 2
Nikita (slow) 2012/07/19 20:47:09 Yes, that what it should look like according to mo
Nikita (slow) 2012/07/20 18:21:29 Confirmed with UX.
+
+// Brightness/grayscale values for hide/show window animations.
+const float kWindowAnimation_HideBrightness = 1.f;
+const float kWindowAnimation_HideGrayscale = 1.f;
+const float kWindowAnimation_ShowBrightness = 0.f;
+const float kWindowAnimation_ShowGrayscale = 0.f;
+
const float kWindowAnimation_HideOpacity = 0.f;
const float kWindowAnimation_ShowOpacity = 1.f;
const float kWindowAnimation_TranslateFactor = -0.025f;
@@ -465,6 +474,36 @@ void AnimateHideWindow_Minimize(aura::Window* window) {
AddLayerAnimationsForMinimize(window, false);
}
+void AnimateShowWindow_BrightnessGrayscale(aura::Window* window) {
+ window->layer()->set_delegate(window);
+ window->layer()->SetOpacity(kWindowAnimation_ShowOpacity);
+ window->layer()->SetLayerBrightness(kWindowAnimation_HideBrightness);
+ window->layer()->SetLayerGrayscale(kWindowAnimation_HideGrayscale);
+
+ window->layer()->SetVisible(true);
+
+ scoped_ptr<ui::LayerAnimationSequence> brightness_sequence(
+ new ui::LayerAnimationSequence());
+ scoped_ptr<ui::LayerAnimationSequence> grayscale_sequence(
+ new ui::LayerAnimationSequence());
+
+ brightness_sequence->AddElement(
+ ui::LayerAnimationElement::CreateBrightnessElement(
+ kWindowAnimation_ShowBrightness,
+ base::TimeDelta::FromMilliseconds(
+ kBrightnessGrayscaleFadeDurationMs)));
+ grayscale_sequence->AddElement(
+ ui::LayerAnimationElement::CreateGrayscaleElement(
+ kWindowAnimation_ShowGrayscale,
+ base::TimeDelta::FromMilliseconds(
+ kBrightnessGrayscaleFadeDurationMs)));
+
+ std::vector<ui::LayerAnimationSequence*> animations;
+ animations.push_back(brightness_sequence.release());
+ animations.push_back(grayscale_sequence.release());
+ window->layer()->GetAnimator()->ScheduleTogether(animations);
+}
+
bool AnimateShowWindow(aura::Window* window) {
if (!HasWindowVisibilityAnimationTransition(window, ANIMATE_SHOW))
return false;
@@ -485,6 +524,9 @@ bool AnimateShowWindow(aura::Window* window) {
case WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE:
AnimateShowWindow_Minimize(window);
return true;
+ case WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE:
sky 2012/07/19 19:22:19 What about the hide case?
Nikita (slow) 2012/07/19 20:47:09 Yes, I might refactor code a bit to support revers
Nikita (slow) 2012/07/20 18:21:29 Done.
+ AnimateShowWindow_BrightnessGrayscale(window);
+ return true;
default:
NOTREACHED();
return false;

Powered by Google App Engine
This is Rietveld 408576698