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

Unified Diff: ui/base/animation/tween.cc

Issue 23531053: ui/base/animation -> ui/gfx/animation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge 2 trunk Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/animation/tween.h ('k') | ui/compositor/float_animation_curve_adapter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/animation/tween.cc
diff --git a/ui/base/animation/tween.cc b/ui/base/animation/tween.cc
deleted file mode 100644
index ac6fa261fd532014b2a62637d8f09c0cec71f916..0000000000000000000000000000000000000000
--- a/ui/base/animation/tween.cc
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/base/animation/tween.h"
-
-#include <math.h>
-
-#if defined(OS_WIN)
-#include <float.h>
-#endif
-
-#include "base/logging.h"
-
-namespace ui {
-
-// static
-double Tween::CalculateValue(Tween::Type type, double state) {
- DCHECK_GE(state, 0);
- DCHECK_LE(state, 1);
-
- switch (type) {
- case EASE_IN:
- return pow(state, 2);
-
- case EASE_IN_2:
- return pow(state, 4);
-
- case EASE_IN_OUT:
- if (state < 0.5)
- return pow(state * 2, 2) / 2.0;
- return 1.0 - (pow((state - 1.0) * 2, 2) / 2.0);
-
- case FAST_IN_OUT:
- return (pow(state - 0.5, 3) + 0.125) / 0.25;
-
- case LINEAR:
- return state;
-
- case EASE_OUT_SNAP:
- state = 0.95 * (1.0 - pow(1.0 - state, 2));
- return state;
-
- case EASE_OUT:
- return 1.0 - pow(1.0 - state, 2);
-
- case SMOOTH_IN_OUT:
- return sin(state);
-
- case ZERO:
- return 0;
- }
-
- NOTREACHED();
- return state;
-}
-
-// static
-double Tween::ValueBetween(double value, double start, double target) {
- return start + (target - start) * value;
-}
-
-// static
-int Tween::ValueBetween(double value, int start, int target) {
- if (start == target)
- return start;
- double delta = static_cast<double>(target - start);
- if (delta < 0)
- delta--;
- else
- delta++;
-#if defined(OS_WIN)
- return start + static_cast<int>(value * _nextafter(delta, 0));
-#else
- return start + static_cast<int>(value * nextafter(delta, 0));
-#endif
-}
-
-// static
-gfx::Rect Tween::ValueBetween(double value,
- const gfx::Rect& start_bounds,
- const gfx::Rect& target_bounds) {
- return gfx::Rect(ValueBetween(value, start_bounds.x(), target_bounds.x()),
- ValueBetween(value, start_bounds.y(), target_bounds.y()),
- ValueBetween(value, start_bounds.width(),
- target_bounds.width()),
- ValueBetween(value, start_bounds.height(),
- target_bounds.height()));
-}
-
-// static
-gfx::Transform Tween::ValueBetween(double value,
- const gfx::Transform& start_transform,
- const gfx::Transform& end_transform) {
- if (value >= 1.0)
- return end_transform;
- if (value <= 0.0)
- return start_transform;
-
- gfx::Transform to_return = end_transform;
- to_return.Blend(start_transform, value);
-
- return to_return;
-}
-
-} // namespace ui
« no previous file with comments | « ui/base/animation/tween.h ('k') | ui/compositor/float_animation_curve_adapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698