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

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

Issue 2335643002: Add VR Shell animation classes and unit test. (Closed)
Patch Set: Add VR Shell animation classes and unit test. Created 4 years, 3 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 namespace vr_shell {
10 namespace easing {
11
12 CubicBezier::CubicBezier(double p1x, double p1y, double p2x, double p2y)
13 : bezier_(p1x, p1y, p2x, p2y) {}
14
15 double CubicBezier::CalculateValue(double state) {
16 return bezier_.Solve(state);
David Trainor- moved to gerrit 2016/09/14 21:43:29 Do we want to DCHECK or clamp state for all of the
cjgrant 2016/09/16 17:47:07 I refactored this to let the check live in the bas
17 }
18
19 EaseIn::EaseIn(double power) : power_(power) {}
20 double EaseIn::CalculateValue(double state) {
21 return pow(state, power_);
22 }
23
24 EaseOut::EaseOut(double power) : power_(power) {}
25 double EaseOut::CalculateValue(double state) {
26 return 1.0 - pow(1.0 - state, power_);
27 }
28
29 double Linear::CalculateValue(double state) {
30 return state;
31 }
32
33 } // namespace easing
34 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698