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 "ui/app_list/views/pulsing_block_view.h" | 5 #include "ui/app_list/views/pulsing_block_view.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 ui::LayerAnimationElement::CreateOpacityElement( | 43 ui::LayerAnimationElement::CreateOpacityElement( |
44 kAnimationOpacity[i], | 44 kAnimationOpacity[i], |
45 base::TimeDelta::FromMilliseconds(kAnimationDurationInMs))); | 45 base::TimeDelta::FromMilliseconds(kAnimationDurationInMs))); |
46 transform_sequence->AddElement( | 46 transform_sequence->AddElement( |
47 ui::LayerAnimationElement::CreateTransformElement( | 47 ui::LayerAnimationElement::CreateTransformElement( |
48 gfx::GetScaleTransform(local_bounds.CenterPoint(), | 48 gfx::GetScaleTransform(local_bounds.CenterPoint(), |
49 kAnimationScale[i]), | 49 kAnimationScale[i]), |
50 base::TimeDelta::FromMilliseconds(kAnimationDurationInMs))); | 50 base::TimeDelta::FromMilliseconds(kAnimationDurationInMs))); |
51 } | 51 } |
52 | 52 |
53 ui::LayerAnimationElement::AnimatableProperties opacity_properties; | |
54 opacity_properties.insert(ui::LayerAnimationElement::OPACITY); | |
55 opacity_sequence->AddElement( | 53 opacity_sequence->AddElement( |
56 ui::LayerAnimationElement::CreatePauseElement( | 54 ui::LayerAnimationElement::CreatePauseElement( |
57 opacity_properties, | 55 ui::LayerAnimationElement::OPACITY, |
58 base::TimeDelta::FromMilliseconds(kAnimationDurationInMs))); | 56 base::TimeDelta::FromMilliseconds(kAnimationDurationInMs))); |
59 | 57 |
60 ui::LayerAnimationElement::AnimatableProperties transform_properties; | |
61 transform_properties.insert(ui::LayerAnimationElement::TRANSFORM); | |
62 transform_sequence->AddElement( | 58 transform_sequence->AddElement( |
63 ui::LayerAnimationElement::CreatePauseElement( | 59 ui::LayerAnimationElement::CreatePauseElement( |
64 transform_properties, | 60 ui::LayerAnimationElement::TRANSFORM, |
65 base::TimeDelta::FromMilliseconds(kAnimationDurationInMs))); | 61 base::TimeDelta::FromMilliseconds(kAnimationDurationInMs))); |
66 | 62 |
67 std::vector<ui::LayerAnimationSequence*> animations; | 63 std::vector<ui::LayerAnimationSequence*> animations; |
68 animations.push_back(opacity_sequence.release()); | 64 animations.push_back(opacity_sequence.release()); |
69 animations.push_back(transform_sequence.release()); | 65 animations.push_back(transform_sequence.release()); |
70 layer->GetAnimator()->ScheduleTogether(animations); | 66 layer->GetAnimator()->ScheduleTogether(animations); |
71 } | 67 } |
72 | 68 |
73 } // namespace | 69 } // namespace |
74 | 70 |
(...skipping 22 matching lines...) Expand all Loading... |
97 SchedulePulsingAnimation(layer()); | 93 SchedulePulsingAnimation(layer()); |
98 } | 94 } |
99 | 95 |
100 void PulsingBlockView::OnPaint(gfx::Canvas* canvas) { | 96 void PulsingBlockView::OnPaint(gfx::Canvas* canvas) { |
101 gfx::Rect rect(GetContentsBounds()); | 97 gfx::Rect rect(GetContentsBounds()); |
102 rect.ClampToCenteredSize(gfx::Size(kBlockSize, kBlockSize)); | 98 rect.ClampToCenteredSize(gfx::Size(kBlockSize, kBlockSize)); |
103 canvas->FillRect(rect, kBlockColor); | 99 canvas->FillRect(rect, kBlockColor); |
104 } | 100 } |
105 | 101 |
106 } // namespace app_list | 102 } // namespace app_list |
OLD | NEW |