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

Side by Side Diff: ui/views/animation/ink_drop_animation.h

Issue 1422593003: Made material design ink drop QUICK_ACTION animation more visible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merged in changes to https://codereview.chromium.org/1390113006/ Created 4 years, 11 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
« no previous file with comments | « no previous file | ui/views/animation/ink_drop_animation.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_H_ 5 #ifndef UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_H_
6 #define UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_H_ 6 #define UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/observer_list.h" 10 #include "base/observer_list.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "ui/compositor/layer_animator.h" 12 #include "ui/compositor/layer_animator.h"
13 #include "ui/gfx/geometry/point.h"
13 #include "ui/gfx/geometry/size.h" 14 #include "ui/gfx/geometry/size.h"
14 #include "ui/gfx/transform.h" 15 #include "ui/gfx/transform.h"
15 #include "ui/views/animation/ink_drop_state.h" 16 #include "ui/views/animation/ink_drop_state.h"
16 #include "ui/views/views_export.h" 17 #include "ui/views/views_export.h"
17 18
18 namespace ui { 19 namespace ui {
19 class CallbackLayerAnimationObserver; 20 class CallbackLayerAnimationObserver;
20 class Layer; 21 class Layer;
21 class LayerAnimationObserver; 22 class LayerAnimationObserver;
22 class LayerDelegate; 23 class LayerDelegate;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 85
85 // Type that contains a gfx::Tansform for each of the layers required by the 86 // Type that contains a gfx::Tansform for each of the layers required by the
86 // ink drop. 87 // ink drop.
87 typedef gfx::Transform InkDropTransforms[PAINTED_SHAPE_COUNT]; 88 typedef gfx::Transform InkDropTransforms[PAINTED_SHAPE_COUNT];
88 89
89 // Animates the ripple to |ink_drop_state| and attaches |observer| to all 90 // Animates the ripple to |ink_drop_state| and attaches |observer| to all
90 // LayerAnimationSequence's used. 91 // LayerAnimationSequence's used.
91 void AnimateToStateInternal(InkDropState ink_drop_state, 92 void AnimateToStateInternal(InkDropState ink_drop_state,
92 ui::LayerAnimationObserver* observer); 93 ui::LayerAnimationObserver* observer);
93 94
94 // Animates all of the painted shape layers to the specified |transforms| and 95 // Animates all of the painted shape layers to the specified |transforms|. The
95 // |opacity|. The animation will use the given |duration| and 96 // animation will use the given |duration| and |preemption_strategy|, and
96 // |preemption_strategy|, and |observer| will be added to all 97 // |observer| will be added to all LayerAnimationSequences.
97 // LayerAnimationSequences.
98 void AnimateToTransforms( 98 void AnimateToTransforms(
99 const InkDropTransforms transforms, 99 const InkDropTransforms transforms,
100 float opacity,
101 base::TimeDelta duration, 100 base::TimeDelta duration,
102 ui::LayerAnimator::PreemptionStrategy preemption_strategy, 101 ui::LayerAnimator::PreemptionStrategy preemption_strategy,
103 ui::LayerAnimationObserver* observer); 102 ui::LayerAnimationObserver* observer);
104 103
105 // Updates the Transforms and opacity to the HIDDEN state. 104 // Updates the Transforms and opacity to the HIDDEN state.
106 void SetStateToHidden(); 105 void SetStateToHidden();
107 106
108 // Sets the |transforms| on all of the shape layers. Note that this does not 107 // Sets the |transforms| on all of the shape layers. Note that this does not
109 // perform any animation. 108 // perform any animation.
110 void SetTransforms(const InkDropTransforms transforms); 109 void SetTransforms(const InkDropTransforms transforms);
111 110
112 // Sets the opacity of the ink drop. 111 // Sets the opacity of the ink drop.
113 void SetOpacity(float opacity); 112 void SetOpacity(float opacity);
114 113
114 // Animates all of the painted shape layers to the specified |opacity|. The
115 // animation will use the given |duration| and |preemption_strategy|, and
116 // |observer| will be added to all LayerAnimationSequences.
117 void AnimateToOpacity(
118 float opacity,
119 base::TimeDelta duration,
120 ui::LayerAnimator::PreemptionStrategy preemption_strategy,
121 ui::LayerAnimationObserver* animation_observer);
122
115 // Updates all of the Transforms in |transforms_out| for a circle of the given 123 // Updates all of the Transforms in |transforms_out| for a circle of the given
116 // |size|. 124 // |size|.
117 void CalculateCircleTransforms(const gfx::Size& size, 125 void CalculateCircleTransforms(const gfx::Size& size,
118 InkDropTransforms* transforms_out) const; 126 InkDropTransforms* transforms_out) const;
119 127
120 // Updates all of the Transforms in |transforms_out| for a rounded rectangle 128 // Updates all of the Transforms in |transforms_out| for a rounded rectangle
121 // of the given |size| and |corner_radius|. 129 // of the given |size| and |corner_radius|.
122 void CalculateRectTransforms(const gfx::Size& size, 130 void CalculateRectTransforms(const gfx::Size& size,
123 float corner_radius, 131 float corner_radius,
124 InkDropTransforms* transforms_out) const; 132 InkDropTransforms* transforms_out) const;
125 133
126 // Updates all of the Transforms in |transforms_out| to the current target 134 // Updates all of the Transforms in |transforms_out| to the current Transforms
127 // Transforms of the Layers. 135 // of the Layers.
128 void GetCurrentTansforms(InkDropTransforms* transforms_out) const; 136 void GetCurrentTransforms(InkDropTransforms* transforms_out) const;
129 137
130 // Adds and configures a new |painted_shape| layer to |painted_layers_|. 138 // Adds and configures a new |painted_shape| layer to |painted_layers_|.
131 void AddPaintLayer(PaintedShape painted_shape); 139 void AddPaintLayer(PaintedShape painted_shape);
132 140
133 void AbortAllAnimations(); 141 void AbortAllAnimations();
134 142
143 // Calculates an estimated distance ratio between 0.0 and 1.0 that estimates
144 // how close the painted shape |transforms| are away from the final
145 // QUICK_ACTION transforms.
146 float CalculateDistanceEstimateToQuickAction(
147 const InkDropTransforms& transforms) const;
148
135 // The Callback invoked when all of the animation sequences for the specific 149 // The Callback invoked when all of the animation sequences for the specific
136 // |ink_drop_state| animation have started. |observer| is the 150 // |ink_drop_state| animation have started. |observer| is the
137 // ui::CallbackLayerAnimationObserver which is notifying the callback. 151 // ui::CallbackLayerAnimationObserver which is notifying the callback.
138 void AnimationStartedCallback( 152 void AnimationStartedCallback(
139 InkDropState ink_drop_state, 153 InkDropState ink_drop_state,
140 const ui::CallbackLayerAnimationObserver& observer); 154 const ui::CallbackLayerAnimationObserver& observer);
141 155
142 // The Callback invoked when all of the animation sequences for the specific 156 // The Callback invoked when all of the animation sequences for the specific
143 // |ink_drop_state| animation have finished. |observer| is the 157 // |ink_drop_state| animation have finished. |observer| is the
144 // ui::CallbackLayerAnimationObserver which is notifying the callback. 158 // ui::CallbackLayerAnimationObserver which is notifying the callback.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 195
182 // List of observers to notify when animations have finished. 196 // List of observers to notify when animations have finished.
183 base::ObserverList<InkDropAnimationObserver> observers_; 197 base::ObserverList<InkDropAnimationObserver> observers_;
184 198
185 DISALLOW_COPY_AND_ASSIGN(InkDropAnimation); 199 DISALLOW_COPY_AND_ASSIGN(InkDropAnimation);
186 }; 200 };
187 201
188 } // namespace views 202 } // namespace views
189 203
190 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_H_ 204 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_H_
OLDNEW
« no previous file with comments | « no previous file | ui/views/animation/ink_drop_animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698