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

Side by Side Diff: ui/android/animation_utils.h

Issue 1419123002: android: move overscroll effects to ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix exports for component build Created 5 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
« no previous file with comments | « ui/android/DEPS ('k') | ui/android/edge_effect.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CONTENT_BROWSER_ANDROID_ANIMATION_UTILS_H_ 5 #ifndef UI_ANDROID_ANIMATION_UTILS_H_
6 #define CONTENT_BROWSER_ANDROID_ANIMATION_UTILS_H_ 6 #define UI_ANDROID_ANIMATION_UTILS_H_
7 7
8 namespace content { 8 namespace ui {
9 9
10 template <typename T> 10 template <typename T>
11 T Lerp(T a, T b, T t) { 11 T Lerp(T a, T b, T t) {
12 return a + (b - a) * t; 12 return a + (b - a) * t;
13 } 13 }
14 14
15 template <typename T> 15 template <typename T>
16 T Clamp(T value, T low, T high) { 16 T Clamp(T value, T low, T high) {
17 return value < low ? low : (value > high ? high : value); 17 return value < low ? low : (value > high ? high : value);
18 } 18 }
19 19
20 template <typename T> 20 template <typename T>
21 T Damp(T input, T factor) { 21 T Damp(T input, T factor) {
22 T result; 22 T result;
23 if (factor == 1) { 23 if (factor == 1) {
24 result = 1 - (1 - input) * (1 - input); 24 result = 1 - (1 - input) * (1 - input);
25 } else { 25 } else {
26 result = 1 - std::pow(1 - input, 2 * factor); 26 result = 1 - std::pow(1 - input, 2 * factor);
27 } 27 }
28 return result; 28 return result;
29 } 29 }
30 30
31 } // namespace content 31 } // namespace ui
32 32
33 #endif // CONTENT_BROWSER_ANDROID_ANIMATION_UTILS_H_ 33 #endif // UI_ANDROID_ANIMATION_UTILS_H_
OLDNEW
« no previous file with comments | « ui/android/DEPS ('k') | ui/android/edge_effect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698