summaryrefslogtreecommitdiffstats
path: root/ui/base/animation
diff options
context:
space:
mode:
authorvollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-24 14:44:19 +0000
committervollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-24 14:44:19 +0000
commitb4db93705d370c3e7d7964c114a6ac51bea635f0 (patch)
treed9d6509e212e5c97278225588984f396704545be /ui/base/animation
parent3c521f7ca5d09cba6153967e61e6327df0204b02 (diff)
downloadchromium_src-b4db93705d370c3e7d7964c114a6ac51bea635f0.zip
chromium_src-b4db93705d370c3e7d7964c114a6ac51bea635f0.tar.gz
chromium_src-b4db93705d370c3e7d7964c114a6ac51bea635f0.tar.bz2
Explicit animation support
High level description: - LayerPropertySetter is now LayerAnimator since it manages implicit/explicit animations and the animation queue. - LayerAnimationElement represents an animation curve. - LayerAnimationSequence owns a collection of elements. - The animator works as follows: o Has a queue of sequences and a collection of running sequences. o It knows the start time of each running sequence. o While there are running sequences, LayerAnimator::Step(base::TimeTicks now) is called periodically, and each of the running sequences are updated. BUG=None TEST=compositor_unittests, base_unittests Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=106768 Review URL: http://codereview.chromium.org/8247009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106915 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base/animation')
-rw-r--r--ui/base/animation/tween.cc43
-rw-r--r--ui/base/animation/tween.h12
2 files changed, 51 insertions, 4 deletions
diff --git a/ui/base/animation/tween.cc b/ui/base/animation/tween.cc
index 515ae57..a16bb18 100644
--- a/ui/base/animation/tween.cc
+++ b/ui/base/animation/tween.cc
@@ -11,7 +11,10 @@
#endif
#include "base/logging.h"
-#include "ui/gfx/rect.h"
+
+#if !defined(OS_MACOSX)
+#include "ui/gfx/interpolated_transform.h"
+#endif
namespace ui {
@@ -83,4 +86,42 @@ gfx::Rect Tween::ValueBetween(double value,
target_bounds.height()));
}
+#if !defined(OS_MACOSX)
+// static
+Transform Tween::ValueBetween(double value,
+ const Transform& start_transform,
+ const Transform& end_transform) {
+ Transform to_return;
+ gfx::Point start_translation, end_translation;
+ float start_rotation, end_rotation;
+ gfx::Point3f start_scale, end_scale;
+ if (InterpolatedTransform::FactorTRS(start_transform,
+ &start_translation,
+ &start_rotation,
+ &start_scale) &&
+ InterpolatedTransform::FactorTRS(end_transform,
+ &end_translation,
+ &end_rotation,
+ &end_scale)) {
+ to_return.SetScale(ValueBetween(value, start_scale.x(), end_scale.x()),
+ ValueBetween(value, start_scale.y(), end_scale.y()));
+ to_return.ConcatRotate(ValueBetween(value, start_rotation, end_rotation));
+ to_return.ConcatTranslate(
+ ValueBetween(value, start_translation.x(), end_translation.x()),
+ ValueBetween(value, start_translation.y(), end_translation.y()));
+ } else {
+ for (int row = 0; row < 4; ++row) {
+ for (int col = 0; col < 4; ++col) {
+ to_return.matrix().set(row, col,
+ ValueBetween(value,
+ start_transform.matrix().get(row, col),
+ end_transform.matrix().get(row, col)));
+ }
+ }
+ }
+
+ return to_return;
+}
+#endif
+
} // namespace ui
diff --git a/ui/base/animation/tween.h b/ui/base/animation/tween.h
index 6bde5dd..02c08c5 100644
--- a/ui/base/animation/tween.h
+++ b/ui/base/animation/tween.h
@@ -8,10 +8,11 @@
#include "base/basictypes.h"
#include "ui/base/ui_export.h"
+#include "ui/gfx/rect.h"
-namespace gfx {
-class Rect;
-}
+#if !defined(OS_MACOSX)
+#include "ui/gfx/transform.h"
+#endif
namespace ui {
@@ -36,6 +37,11 @@ class UI_EXPORT Tween {
static gfx::Rect ValueBetween(double value,
const gfx::Rect& start_bounds,
const gfx::Rect& target_bounds);
+#if !defined(OS_MACOSX)
+ static Transform ValueBetween(double value,
+ const Transform& start_transform,
+ const Transform& target_transform);
+#endif
private:
Tween();