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

Side by Side Diff: chrome/browser/android/vr_shell/easing.cc

Issue 2966793002: NOT FOR REVIEW - convert to cc animation
Patch Set: switch to transform operations Created 3 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
OLDNEW
(Empty)
1 // Copyright 2016 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 #include "chrome/browser/android/vr_shell/easing.h"
6
7 #include <cmath>
8
9 #include "base/logging.h"
10
11 namespace vr_shell {
12 namespace easing {
13
14 double Easing::CalculateValue(double input) {
15 DCHECK(input >= 0.0 && input <= 1.0);
16 return CalculateValueImpl(input);
17 }
18
19 CubicBezier::CubicBezier(double p1x, double p1y, double p2x, double p2y)
20 : bezier_(p1x, p1y, p2x, p2y) {}
21
22 double CubicBezier::CalculateValueImpl(double state) {
23 return bezier_.Solve(state);
24 }
25
26 EaseIn::EaseIn(double power) : power_(power) {}
27 double EaseIn::CalculateValueImpl(double state) {
28 return pow(state, power_);
29 }
30
31 EaseOut::EaseOut(double power) : power_(power) {}
32 double EaseOut::CalculateValueImpl(double state) {
33 return 1.0 - pow(1.0 - state, power_);
34 }
35
36 EaseInOut::EaseInOut(double power) : ease_in_(power) {}
37 double EaseInOut::CalculateValueImpl(double state) {
38 if (state < 0.5) {
39 return ease_in_.CalculateValueImpl(state * 2) / 2;
40 } else {
41 return 1.0 - ease_in_.CalculateValueImpl((1.0 - state) * 2) / 2;
42 }
43 }
44
45 double Linear::CalculateValueImpl(double state) {
46 return state;
47 }
48
49 } // namespace easing
50 } // namespace vr_shell
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/easing.h ('k') | chrome/browser/android/vr_shell/ui_elements/button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698