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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 #ifndef UI_GFX_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_
6 #define UI_GFX_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_
7 #pragma once
8
9 #include <set>
10
11 #include "base/time.h"
12 #include "ui/gfx/compositor/compositor_export.h"
13
14 namespace gfx {
15 class Rect;
16 } // gfx
17
18 namespace ui {
19
20 class LayerAnimationDelegate;
21 class Transform;
22
23 // LayerAnimationElements represent one segment of an animation between two
24 // keyframes. They know how to update a LayerAnimationDelegate given a value
25 // 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
26 class COMPOSITOR_EXPORT LayerAnimationElement {
27 public:
28 enum AnimatableProperty {
29 TRANSFORM = 0,
30 BOUNDS,
31 OPACITY
32 };
33
34 typedef std::set<AnimatableProperty> AnimatableProperties;
35
36 static LayerAnimationElement* CreateTransformElement(
sky 2011/10/19 00:06:33 each param on its own line when you wrap like this
37 const Transform& transform, base::TimeDelta duration);
38 static LayerAnimationElement* CreateBoundsElement(
39 const gfx::Rect& bounds, base::TimeDelta duration);
40 static LayerAnimationElement* CreateOpacityElement(
41 float opacity, base::TimeDelta duration);
42 static LayerAnimationElement* CreatePauseElement(
43 const AnimatableProperties& properties, base::TimeDelta duration);
44
45 virtual ~LayerAnimationElement() {}
sky 2011/10/19 00:06:33 this should be before static methods.
46
47 // Updates the delegate to the appropriate value for |t|, which is in the
48 // 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.
49 // next. If the animation is not aborted, it is guaranteed that Progress will
50 // eventually be called with t = 1.0.
51 virtual void Progress(double t, LayerAnimationDelegate* delegate) = 0;
52
53 // 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
54 virtual void Abort() = 0;
55
56 // The properties that the element modifies.
57 virtual const AnimatableProperties& Properties() const = 0;
58
59 // The duration of the animation
60 virtual base::TimeDelta Duration() const = 0;
61 };
62
63 } // namespace ui
64
65 #endif // UI_GFX_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698