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

Unified Diff: ui/gfx/compositor/layer_animation_element.h

Issue 8247009: Explicit animation support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added new preemption strategy: replace queued animations. Created 9 years, 2 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
Index: ui/gfx/compositor/layer_animation_element.h
diff --git a/ui/gfx/compositor/layer_animation_element.h b/ui/gfx/compositor/layer_animation_element.h
new file mode 100644
index 0000000000000000000000000000000000000000..ef1bc91b671f6fff88592f9af2e04fb800a511cf
--- /dev/null
+++ b/ui/gfx/compositor/layer_animation_element.h
@@ -0,0 +1,65 @@
+// Copyright (c) 2011 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.
+
+#ifndef UI_GFX_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_
+#define UI_GFX_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_
+#pragma once
+
+#include <set>
+
+#include "base/time.h"
+#include "ui/gfx/compositor/compositor_export.h"
+
+namespace gfx {
+class Rect;
+} // gfx
+
+namespace ui {
+
+class LayerAnimationDelegate;
+class Transform;
+
+// LayerAnimationElements represent one segment of an animation between two
+// keyframes. They know how to update a LayerAnimationDelegate given a value
+// between 0 and 1 (0 for the last keyframe, and one for the next).
sky 2011/10/19 00:06:33 nit: the part in () is confusing. Maybe just 0 for
+class COMPOSITOR_EXPORT LayerAnimationElement {
+ public:
+ enum AnimatableProperty {
+ TRANSFORM = 0,
+ BOUNDS,
+ OPACITY
+ };
+
+ typedef std::set<AnimatableProperty> AnimatableProperties;
+
+ static LayerAnimationElement* CreateTransformElement(
sky 2011/10/19 00:06:33 each param on its own line when you wrap like this
+ const Transform& transform, base::TimeDelta duration);
+ static LayerAnimationElement* CreateBoundsElement(
+ const gfx::Rect& bounds, base::TimeDelta duration);
+ static LayerAnimationElement* CreateOpacityElement(
+ float opacity, base::TimeDelta duration);
+ static LayerAnimationElement* CreatePauseElement(
+ const AnimatableProperties& properties, base::TimeDelta duration);
+
+ virtual ~LayerAnimationElement() {}
sky 2011/10/19 00:06:33 this should be before static methods.
+
+ // Updates the delegate to the appropriate value for |t|, which is in the
+ // range [0, 1] where 0 represents the last keyframe and 1 represents the
sky 2011/10/19 00:06:33 same comment as with class description.
+ // next. If the animation is not aborted, it is guaranteed that Progress will
+ // eventually be called with t = 1.0.
+ virtual void Progress(double t, LayerAnimationDelegate* delegate) = 0;
+
+ // Called if the animation is not allowed to complete.
sky 2011/10/19 00:06:33 Mention this may be invoked without a call to Prog
+ virtual void Abort() = 0;
+
+ // The properties that the element modifies.
+ virtual const AnimatableProperties& Properties() const = 0;
+
+ // The duration of the animation
+ virtual base::TimeDelta Duration() const = 0;
+};
+
+} // namespace ui
+
+#endif // UI_GFX_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_

Powered by Google App Engine
This is Rietveld 408576698