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

Side by Side Diff: content/browser/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 | « no previous file | content/browser/android/content_view_core_impl.h » ('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 2014 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 CONTENT_BROWSER_ANDROID_ANIMATION_UTILS_H_
6 #define CONTENT_BROWSER_ANDROID_ANIMATION_UTILS_H_
7
8 namespace content {
9
10 template <typename T>
11 T Lerp(T a, T b, T t) {
12 return a + (b - a) * t;
13 }
14
15 template <typename T>
16 T Clamp(T value, T low, T high) {
17 return value < low ? low : (value > high ? high : value);
18 }
19
20 template <typename T>
21 T Damp(T input, T factor) {
22 T result;
23 if (factor == 1) {
24 result = 1 - (1 - input) * (1 - input);
25 } else {
26 result = 1 - std::pow(1 - input, 2 * factor);
27 }
28 return result;
29 }
30
31 } // namespace content
32
33 #endif // CONTENT_BROWSER_ANDROID_ANIMATION_UTILS_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/android/content_view_core_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698