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

Side by Side Diff: app/tween.h

Issue 1961001: Refactors animation to allow for cleaner subclassing. I'm doing this (Closed)
Patch Set: Incorporated review feedback Created 10 years, 7 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 | « app/throb_animation.cc ('k') | app/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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef APP_TWEEN_H_
6 #define APP_TWEEN_H_
7
8 #include "base/logging.h"
9
10 namespace gfx {
11 class Rect;
12 }
13
14 class Tween {
15 public:
16 enum Type {
17 LINEAR, // Linear.
18 EASE_OUT, // Fast in, slow out (default).
19 EASE_IN, // Slow in, fast out.
20 EASE_IN_OUT, // Slow in and out, fast in the middle.
21 FAST_IN_OUT, // Fast in and out, slow in the middle.
22 EASE_OUT_SNAP, // Fast in, slow out, snap to final value.
23 ZERO, // Returns a value of 0 always.
24 };
25
26 // Returns the value based on the tween type. |state| is from 0-1.
27 static double CalculateValue(Type type, double state);
28
29 // Conveniences for getting a value between a start and end point.
30 static double ValueBetween(double value, double start, double target);
31 static int ValueBetween(double value, int start, int target);
32 static gfx::Rect ValueBetween(double value,
33 const gfx::Rect& start_bounds,
34 const gfx::Rect& target_bounds);
35
36 private:
37 Tween();
38 ~Tween();
39
40 DISALLOW_COPY_AND_ASSIGN(Tween);
41 };
42
43 #endif // APP_TWEEN_H_
OLDNEW
« no previous file with comments | « app/throb_animation.cc ('k') | app/tween.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698