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

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: Updated views desktop demo. 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/memory/ref_counted.h"
12 #include "base/time.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).
26 class LayerAnimationElement : public base::RefCounted<LayerAnimationElement> {
sky 2011/10/14 16:39:52 Can we make the ownership model trivial and have t
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(
37 const Transform& transform, base::TimeDelta duration);
sky 2011/10/14 16:39:52 wrap each param.
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 AnimatableProperty property, base::TimeDelta duration);
44
45 // Updates the delegate to the appropriate value for |t|, which is in the
46 // range [0, 1] where 0 represents the last keyframe and 1 represents the
47 // next. If the animation is not aborted, it is guaranteed that animate will
sky 2011/10/14 16:39:52 animate -> progress
48 // eventually be called with t = 1.0.
49 virtual void Progress(double t, LayerAnimationDelegate* delegate) = 0;
sky 2011/10/14 16:39:52 I think this should be time based, otherwise we co
50
51 // Called if the animation is not allowed to complete.
52 virtual void Abort() = 0;
53
54 // The properties that the element modifies.
55 virtual const AnimatableProperties& Properties() const = 0;
sky 2011/10/14 16:39:52 Can you think of a case where the properties or du
56
57 // The duration of the animation
58 virtual base::TimeDelta Duration() const = 0;
59
60 protected:
61 friend class base::RefCounted<LayerAnimationElement>;
62 virtual ~LayerAnimationElement() {}
63 };
64
65 } // namespace ui
66
67 #endif // UI_GFX_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698