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

Side by Side Diff: app/throb_animation.cc

Issue 1575011: Adds AnimationContainer, which can be used to group a set of (Closed)
Patch Set: Incorporated review feedback Created 10 years, 8 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "app/throb_animation.h" 5 #include "app/throb_animation.h"
6 6
7 static const int kDefaultThrobDurationMS = 400; 7 static const int kDefaultThrobDurationMS = 400;
8 8
9 ThrobAnimation::ThrobAnimation(AnimationDelegate* target) 9 ThrobAnimation::ThrobAnimation(AnimationDelegate* target)
10 : SlideAnimation(target), 10 : SlideAnimation(target),
(...skipping 25 matching lines...) Expand all
36 void ThrobAnimation::Show() { 36 void ThrobAnimation::Show() {
37 ResetForSlide(); 37 ResetForSlide();
38 SlideAnimation::Show(); 38 SlideAnimation::Show();
39 } 39 }
40 40
41 void ThrobAnimation::Hide() { 41 void ThrobAnimation::Hide() {
42 ResetForSlide(); 42 ResetForSlide();
43 SlideAnimation::Hide(); 43 SlideAnimation::Hide();
44 } 44 }
45 45
46 void ThrobAnimation::Step() { 46 void ThrobAnimation::Step(base::TimeTicks time_now) {
47 Animation::Step(); 47 Animation::Step(time_now);
48
48 if (!IsAnimating() && throbbing_) { 49 if (!IsAnimating() && throbbing_) {
49 // Were throbbing a finished a cycle. Start the next cycle unless we're at 50 // Were throbbing a finished a cycle. Start the next cycle unless we're at
50 // the end of the cycles, in which case we stop. 51 // the end of the cycles, in which case we stop.
51 cycles_remaining_--; 52 cycles_remaining_--;
52 if (IsShowing()) { 53 if (IsShowing()) {
53 // We want to stop hidden, hence this doesn't check cycles_remaining_. 54 // We want to stop hidden, hence this doesn't check cycles_remaining_.
54 SlideAnimation::Hide(); 55 SlideAnimation::Hide();
55 } else if (cycles_remaining_ > 0) { 56 } else if (cycles_remaining_ > 0) {
56 SlideAnimation::Show(); 57 SlideAnimation::Show();
57 } else { 58 } else {
58 // We're done throbbing. 59 // We're done throbbing.
59 throbbing_ = false; 60 throbbing_ = false;
60 } 61 }
61 } 62 }
62 } 63 }
63 64
64 void ThrobAnimation::ResetForSlide() { 65 void ThrobAnimation::ResetForSlide() {
65 SlideAnimation::SetSlideDuration(slide_duration_); 66 SlideAnimation::SetSlideDuration(slide_duration_);
66 cycles_remaining_ = 0; 67 cycles_remaining_ = 0;
67 throbbing_ = false; 68 throbbing_ = false;
68 } 69 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698