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

Side by Side Diff: app/multi_animation.h

Issue 3041006: Tweaks the pinned background tab title change animation per Nicholas's (Closed)
Patch Set: Created 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | app/multi_animation.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef APP_MULTI_ANIMATION_H_ 5 #ifndef APP_MULTI_ANIMATION_H_
6 #define APP_MULTI_ANIMATION_H_ 6 #define APP_MULTI_ANIMATION_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "app/animation.h" 10 #include "app/animation.h"
11 #include "app/tween.h" 11 #include "app/tween.h"
12 12
13 // MultiAnimation is an animation that consists of a number of sub animations. 13 // MultiAnimation is an animation that consists of a number of sub animations.
14 // To create a MultiAnimation pass in the parts, invoke Start() and the delegate 14 // To create a MultiAnimation pass in the parts, invoke Start() and the delegate
15 // is notified as the animation progresses. MultiAnimation runs until Stop is 15 // is notified as the animation progresses. MultiAnimation runs until Stop is
16 // invoked. 16 // invoked.
17 class MultiAnimation : public Animation { 17 class MultiAnimation : public Animation {
18 public: 18 public:
19 // Defines part of the animation. Each part consists of the following:
20 //
21 // time_ms: the time of the part.
22 // start_time_ms: the amount of time to offset this part by when calculating
23 // the percented completed.
24 // end_time_ms: the end time used to calculate the percentange completed.
25 //
26 // In most cases |start_time_ms| = 0 and |end_time_ms| = |time_ms|. But you
27 // can adjust the start/end for different effects. For example, to run a part
28 // for 200ms with a % between .25 and .75 use the following three values: 200,
29 // 100, 400.
19 struct Part { 30 struct Part {
20 Part() : time_ms(0), type(Tween::ZERO) {} 31 Part() : time_ms(0), start_time_ms(0), end_time_ms(0), type(Tween::ZERO) {}
21 Part(int time_ms, Tween::Type type) : time_ms(time_ms), type(type) {} 32 Part(int time_ms, Tween::Type type)
33 : time_ms(time_ms),
34 start_time_ms(0),
35 end_time_ms(time_ms),
36 type(type) {}
22 37
23 int time_ms; 38 int time_ms;
39 int start_time_ms;
40 int end_time_ms;
24 Tween::Type type; 41 Tween::Type type;
25 }; 42 };
26 43
27 typedef std::vector<Part> Parts; 44 typedef std::vector<Part> Parts;
28 45
29 explicit MultiAnimation(const Parts& parts); 46 explicit MultiAnimation(const Parts& parts);
30 47
31 // Returns the current value. The current value for a MultiAnimation is 48 // Returns the current value. The current value for a MultiAnimation is
32 // determined from the tween type of the current part. 49 // determined from the tween type of the current part.
33 virtual double GetCurrentValue() const { return current_value_; } 50 virtual double GetCurrentValue() const { return current_value_; }
(...skipping 20 matching lines...) Expand all
54 // Current value for the animation. 71 // Current value for the animation.
55 double current_value_; 72 double current_value_;
56 73
57 // Index of the current part. 74 // Index of the current part.
58 size_t current_part_index_; 75 size_t current_part_index_;
59 76
60 DISALLOW_COPY_AND_ASSIGN(MultiAnimation); 77 DISALLOW_COPY_AND_ASSIGN(MultiAnimation);
61 }; 78 };
62 79
63 #endif // APP_MULTI_ANIMATION_H_ 80 #endif // APP_MULTI_ANIMATION_H_
OLDNEW
« no previous file with comments | « no previous file | app/multi_animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698