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

Side by Side Diff: chrome/browser/ui/autofill/loading_animation.cc

Issue 23531053: ui/base/animation -> ui/gfx/animation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge 2 trunk Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/ui/autofill/loading_animation.h" 5 #include "chrome/browser/ui/autofill/loading_animation.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/base/animation/tween.h" 8 #include "ui/gfx/animation/tween.h"
9 9
10 namespace autofill { 10 namespace autofill {
11 11
12 // Duration of one cycle of the animation. 12 // Duration of one cycle of the animation.
13 static const int kDurationMs = 1800; 13 static const int kDurationMs = 1800;
14 14
15 // The frame rate of the animation. 15 // The frame rate of the animation.
16 static const int kHertz = 60; 16 static const int kHertz = 60;
17 17
18 LoadingAnimation::LoadingAnimation(ui::AnimationDelegate* delegate) 18 LoadingAnimation::LoadingAnimation(gfx::AnimationDelegate* delegate)
19 : LinearAnimation(kDurationMs, kHertz, delegate), 19 : LinearAnimation(kDurationMs, kHertz, delegate),
20 first_cycle_(true) {} 20 first_cycle_(true) {}
21 21
22 LoadingAnimation::~LoadingAnimation() {} 22 LoadingAnimation::~LoadingAnimation() {}
23 23
24 void LoadingAnimation::Step(base::TimeTicks time_now) { 24 void LoadingAnimation::Step(base::TimeTicks time_now) {
25 LinearAnimation::Step(time_now); 25 LinearAnimation::Step(time_now);
26 26
27 if (!is_animating()) { 27 if (!is_animating()) {
28 first_cycle_ = false; 28 first_cycle_ = false;
29 Start(); 29 Start();
30 } 30 }
31 } 31 }
32 32
33 double LoadingAnimation::GetCurrentValueForDot(size_t dot_i) { 33 double LoadingAnimation::GetCurrentValueForDot(size_t dot_i) {
34 double base_value = ui::LinearAnimation::GetCurrentValue(); 34 double base_value = gfx::LinearAnimation::GetCurrentValue();
35 35
36 const double kSecondDotDelayMs = 100.0; 36 const double kSecondDotDelayMs = 100.0;
37 const double kThirdDotDelayMs = 300.0; 37 const double kThirdDotDelayMs = 300.0;
38 if (dot_i == 1) 38 if (dot_i == 1)
39 base_value -= kSecondDotDelayMs / kDurationMs; 39 base_value -= kSecondDotDelayMs / kDurationMs;
40 else if (dot_i == 2) 40 else if (dot_i == 2)
41 base_value -= kThirdDotDelayMs / kDurationMs; 41 base_value -= kThirdDotDelayMs / kDurationMs;
42 42
43 if (base_value < 0.0) 43 if (base_value < 0.0)
44 base_value = first_cycle_ ? 0.0 : base_value + 1.0; 44 base_value = first_cycle_ ? 0.0 : base_value + 1.0;
45 45
46 double value = ui::Tween::CalculateValue(ui::Tween::EASE_OUT, base_value); 46 double value = gfx::Tween::CalculateValue(gfx::Tween::EASE_OUT, base_value);
47 47
48 static AnimationFrame animation_frames[] = { 48 static AnimationFrame animation_frames[] = {
49 { 0.0, 0.0 }, 49 { 0.0, 0.0 },
50 { 0.55, 0.0 }, 50 { 0.55, 0.0 },
51 { 0.6, -1.0 }, 51 { 0.6, -1.0 },
52 { 0.8, 0.3 }, 52 { 0.8, 0.3 },
53 { 0.9, -0.2 }, 53 { 0.9, -0.2 },
54 { 0.95, 0.1 }, 54 { 0.95, 0.1 },
55 { 1.0, 0.0 }, 55 { 1.0, 0.0 },
56 }; 56 };
(...skipping 13 matching lines...) Expand all
70 NOTREACHED(); 70 NOTREACHED();
71 return 0.0; 71 return 0.0;
72 } 72 }
73 73
74 void LoadingAnimation::Reset() { 74 void LoadingAnimation::Reset() {
75 Stop(); 75 Stop();
76 first_cycle_ = true; 76 first_cycle_ = true;
77 } 77 }
78 78
79 } // namespace autofill 79 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698