OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/wm/window_animations.h" | 5 #include "ash/wm/window_animations.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <vector> | 10 #include <vector> |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 namespace { | 65 namespace { |
66 | 66 |
67 const int kDefaultAnimationDurationForMenuMS = 150; | 67 const int kDefaultAnimationDurationForMenuMS = 150; |
68 | 68 |
69 // Durations for the cross-fade animation, in milliseconds. | 69 // Durations for the cross-fade animation, in milliseconds. |
70 const float kCrossFadeDurationMinMs = 100.f; | 70 const float kCrossFadeDurationMinMs = 100.f; |
71 const float kCrossFadeDurationMaxMs = 400.f; | 71 const float kCrossFadeDurationMaxMs = 400.f; |
72 | 72 |
73 // Durations for the brightness/grayscale fade animation, in milliseconds. | 73 // Durations for the brightness/grayscale fade animation, in milliseconds. |
74 const int kBrightnessGrayscaleFadeDurationMs = 2000; | 74 const int kBrightnessGrayscaleFadeDurationMs = 1000; |
75 | 75 |
76 // Brightness/grayscale values for hide/show window animations. | 76 // Brightness/grayscale values for hide/show window animations. |
77 const float kWindowAnimation_HideBrightnessGrayscale = 1.f; | 77 const float kWindowAnimation_HideBrightnessGrayscale = 1.f; |
78 const float kWindowAnimation_ShowBrightnessGrayscale = 0.f; | 78 const float kWindowAnimation_ShowBrightnessGrayscale = 0.f; |
79 | 79 |
80 const float kWindowAnimation_HideOpacity = 0.f; | 80 const float kWindowAnimation_HideOpacity = 0.f; |
81 const float kWindowAnimation_ShowOpacity = 1.f; | 81 const float kWindowAnimation_ShowOpacity = 1.f; |
82 const float kWindowAnimation_TranslateFactor = -0.025f; | 82 const float kWindowAnimation_TranslateFactor = -0.025f; |
83 const float kWindowAnimation_ScaleFactor = 1.05f; | 83 const float kWindowAnimation_ScaleFactor = 1.05f; |
84 const float kWindowAnimation_MinimizeRotate = -5.f; | 84 const float kWindowAnimation_MinimizeRotate = -5.f; |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 settings.SetTransitionDuration( | 499 settings.SetTransitionDuration( |
500 base::TimeDelta::FromMilliseconds(kBrightnessGrayscaleFadeDurationMs)); | 500 base::TimeDelta::FromMilliseconds(kBrightnessGrayscaleFadeDurationMs)); |
501 if (!show) | 501 if (!show) |
502 settings.AddObserver(new HidingWindowAnimationObserver(window)); | 502 settings.AddObserver(new HidingWindowAnimationObserver(window)); |
503 | 503 |
504 scoped_ptr<ui::LayerAnimationSequence> brightness_sequence( | 504 scoped_ptr<ui::LayerAnimationSequence> brightness_sequence( |
505 new ui::LayerAnimationSequence()); | 505 new ui::LayerAnimationSequence()); |
506 scoped_ptr<ui::LayerAnimationSequence> grayscale_sequence( | 506 scoped_ptr<ui::LayerAnimationSequence> grayscale_sequence( |
507 new ui::LayerAnimationSequence()); | 507 new ui::LayerAnimationSequence()); |
508 | 508 |
509 brightness_sequence->AddElement( | 509 scoped_ptr<ui::LayerAnimationElement> brightness_element( |
510 ui::LayerAnimationElement::CreateBrightnessElement( | 510 ui::LayerAnimationElement::CreateBrightnessElement( |
511 end_value, | 511 end_value, |
512 base::TimeDelta::FromMilliseconds( | 512 base::TimeDelta::FromMilliseconds( |
513 kBrightnessGrayscaleFadeDurationMs))); | 513 kBrightnessGrayscaleFadeDurationMs))); |
514 grayscale_sequence->AddElement( | 514 brightness_element->set_tween_type(ui::Tween::EASE_OUT); |
| 515 brightness_sequence->AddElement(brightness_element.release()); |
| 516 |
| 517 scoped_ptr<ui::LayerAnimationElement> grayscale_element( |
515 ui::LayerAnimationElement::CreateGrayscaleElement( | 518 ui::LayerAnimationElement::CreateGrayscaleElement( |
516 end_value, | 519 end_value, |
517 base::TimeDelta::FromMilliseconds( | 520 base::TimeDelta::FromMilliseconds( |
518 kBrightnessGrayscaleFadeDurationMs))); | 521 kBrightnessGrayscaleFadeDurationMs))); |
| 522 grayscale_element->set_tween_type(ui::Tween::EASE_OUT); |
| 523 grayscale_sequence->AddElement(grayscale_element.release()); |
519 | 524 |
520 std::vector<ui::LayerAnimationSequence*> animations; | 525 std::vector<ui::LayerAnimationSequence*> animations; |
521 animations.push_back(brightness_sequence.release()); | 526 animations.push_back(brightness_sequence.release()); |
522 animations.push_back(grayscale_sequence.release()); | 527 animations.push_back(grayscale_sequence.release()); |
523 window->layer()->GetAnimator()->ScheduleTogether(animations); | 528 window->layer()->GetAnimator()->ScheduleTogether(animations); |
524 if (!show) { | 529 if (!show) { |
525 window->layer()->SetOpacity(kWindowAnimation_HideOpacity); | 530 window->layer()->SetOpacity(kWindowAnimation_HideOpacity); |
526 window->layer()->SetVisible(false); | 531 window->layer()->SetVisible(false); |
527 } | 532 } |
528 } | 533 } |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 AnimateHideWindow(window); | 859 AnimateHideWindow(window); |
855 } | 860 } |
856 } | 861 } |
857 | 862 |
858 void SetDelayedOldLayerDeletionInCrossFadeForTest(bool value) { | 863 void SetDelayedOldLayerDeletionInCrossFadeForTest(bool value) { |
859 delayed_old_layer_deletion_in_cross_fade_for_test_ = value; | 864 delayed_old_layer_deletion_in_cross_fade_for_test_ = value; |
860 } | 865 } |
861 | 866 |
862 } // namespace internal | 867 } // namespace internal |
863 } // namespace ash | 868 } // namespace ash |
OLD | NEW |