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

Side by Side Diff: ui/base/animation/tween.h

Issue 8247009: Explicit animation support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix VS2010 Created 9 years, 1 month 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
« no previous file with comments | « no previous file | ui/base/animation/tween.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 UI_BASE_ANIMATION_TWEEN_H_ 5 #ifndef UI_BASE_ANIMATION_TWEEN_H_
6 #define UI_BASE_ANIMATION_TWEEN_H_ 6 #define UI_BASE_ANIMATION_TWEEN_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "ui/base/ui_export.h" 10 #include "ui/base/ui_export.h"
11 #include "ui/gfx/rect.h"
11 12
12 namespace gfx { 13 #if !defined(OS_MACOSX)
13 class Rect; 14 #include "ui/gfx/transform.h"
14 } 15 #endif
15 16
16 namespace ui { 17 namespace ui {
17 18
18 class UI_EXPORT Tween { 19 class UI_EXPORT Tween {
19 public: 20 public:
20 enum Type { 21 enum Type {
21 LINEAR, // Linear. 22 LINEAR, // Linear.
22 EASE_OUT, // Fast in, slow out (default). 23 EASE_OUT, // Fast in, slow out (default).
23 EASE_IN, // Slow in, fast out. 24 EASE_IN, // Slow in, fast out.
24 EASE_IN_OUT, // Slow in and out, fast in the middle. 25 EASE_IN_OUT, // Slow in and out, fast in the middle.
25 FAST_IN_OUT, // Fast in and out, slow in the middle. 26 FAST_IN_OUT, // Fast in and out, slow in the middle.
26 EASE_OUT_SNAP, // Fast in, slow out, snap to final value. 27 EASE_OUT_SNAP, // Fast in, slow out, snap to final value.
27 ZERO, // Returns a value of 0 always. 28 ZERO, // Returns a value of 0 always.
28 }; 29 };
29 30
30 // Returns the value based on the tween type. |state| is from 0-1. 31 // Returns the value based on the tween type. |state| is from 0-1.
31 static double CalculateValue(Type type, double state); 32 static double CalculateValue(Type type, double state);
32 33
33 // Conveniences for getting a value between a start and end point. 34 // Conveniences for getting a value between a start and end point.
34 static double ValueBetween(double value, double start, double target); 35 static double ValueBetween(double value, double start, double target);
35 static int ValueBetween(double value, int start, int target); 36 static int ValueBetween(double value, int start, int target);
36 static gfx::Rect ValueBetween(double value, 37 static gfx::Rect ValueBetween(double value,
37 const gfx::Rect& start_bounds, 38 const gfx::Rect& start_bounds,
38 const gfx::Rect& target_bounds); 39 const gfx::Rect& target_bounds);
40 #if !defined(OS_MACOSX)
41 static Transform ValueBetween(double value,
42 const Transform& start_transform,
43 const Transform& target_transform);
44 #endif
39 45
40 private: 46 private:
41 Tween(); 47 Tween();
42 ~Tween(); 48 ~Tween();
43 49
44 DISALLOW_COPY_AND_ASSIGN(Tween); 50 DISALLOW_COPY_AND_ASSIGN(Tween);
45 }; 51 };
46 52
47 } // namespace ui 53 } // namespace ui
48 54
49 #endif // UI_BASE_ANIMATION_TWEEN_H_ 55 #endif // UI_BASE_ANIMATION_TWEEN_H_
OLDNEW
« no previous file with comments | « no previous file | ui/base/animation/tween.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698