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

Unified Diff: ui/views/animation/ink_drop_animation.h

Issue 1495753002: Make the material design ripple effect more visible on a quick action (single click or single tap) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Polished for review. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/views/animation/ink_drop_animation.cc » ('j') | ui/views/animation/ink_drop_animation.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/animation/ink_drop_animation.h
diff --git a/ui/views/animation/ink_drop_animation.h b/ui/views/animation/ink_drop_animation.h
index 6abc23b409aab09233f0d1b4d88cfe92e0d412b9..c74bd5a294ec1678ae3f5e517820dcc2b12b48bf 100644
--- a/ui/views/animation/ink_drop_animation.h
+++ b/ui/views/animation/ink_drop_animation.h
@@ -5,11 +5,15 @@
#ifndef UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_H_
#define UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_H_
+#include <string>
+
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "base/time/time.h"
#include "ui/compositor/layer_animator.h"
+#include "ui/gfx/animation/tween.h"
+#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/transform.h"
#include "ui/views/animation/ink_drop_state.h"
@@ -36,6 +40,17 @@ class InkDropAnimationTestApi;
// final frame for each InkDropState will be bounded by either a |large_size_|
// rectangle or a |small_size_| rectangle.
//
+// The valid InkDropState transitions are defined below in (where * means any
varkha 2016/01/28 20:50:45 nit: below in? nit: Did you want to use '*' below?
bruthig 2016/01/28 22:38:00 Removed mention of '*'.
+// state):
+//
+// {All InkDropStates} => HIDDEN
+// HIDDEN => ACTION_PENDING
+// HIDDEN, ACTION_PENDING => QUICK_ACTION
+// ACTION_PENDING => SLOW_ACTION_PENDING
+// SLOW_ACTION_PENDING => SLOW_ACTION
+// {All InkDropStates} => ACTIVATED
+// {All InkDropStates} => DEACTIVATED
+//
// TODO(bruthig): Document the ink drop ripple on chromium.org and add a link to
// it.
class VIEWS_EXPORT InkDropAnimation {
@@ -54,16 +69,18 @@ class VIEWS_EXPORT InkDropAnimation {
void AddObserver(InkDropAnimationObserver* observer);
void RemoveObserver(InkDropAnimationObserver* observer);
- // Animates from the current |ink_drop_state_| to a new |ink_drop_state|. It
- // is possible to animate from any |ink_drop_state_| to any new
- // |ink_drop_state|. Note that some state transitions will also perform an
- // implicit transition to the another state. e.g. AnimateToState(QUICK_ACTION)
- // will implicitly transition to the HIDDEN state.
+ // Animates from the current |ink_drop_state_| to a new |ink_drop_state|.
void AnimateToState(InkDropState ink_drop_state);
// Sets the |center_point| of the ink drop layer relative to its parent Layer.
void SetCenterPoint(const gfx::Point& center_point);
+ // Immediately hides the ink drop and sets the state to InkDropState::HIDDEN.
+ // All in-progress animations will be aborted.
varkha 2016/01/28 20:50:45 Nit: How about "Imediately aborts all in-progress
bruthig 2016/01/28 22:38:00 Done.
+ // NOTE: This will NOT raise InkDropAnimation(Started|Ended) events for the
+ // state transition to HIDDEN!
+ void HideImmediately();
+
private:
friend class test::InkDropAnimationTestApi;
@@ -91,15 +108,14 @@ class VIEWS_EXPORT InkDropAnimation {
void AnimateToStateInternal(InkDropState ink_drop_state,
ui::LayerAnimationObserver* observer);
- // Animates all of the painted shape layers to the specified |transforms| and
- // |opacity|. The animation will use the given |duration| and
- // |preemption_strategy|, and |observer| will be added to all
- // LayerAnimationSequences.
+ // Animates all of the painted shape layers to the specified |transforms|. The
+ // animation will use the given |duration|, |preemption_strategy|, and |tween|
varkha 2016/01/28 20:50:45 Maybe break into a second sentence after |preempti
bruthig 2016/01/28 22:38:00 Re-worded a bit, PTAL
+ // and |observer| will be added to all LayerAnimationSequences.
void AnimateToTransforms(
const InkDropTransforms transforms,
- float opacity,
base::TimeDelta duration,
ui::LayerAnimator::PreemptionStrategy preemption_strategy,
+ gfx::Tween::Type tween,
ui::LayerAnimationObserver* observer);
// Updates the Transforms and opacity to the HIDDEN state.
@@ -109,9 +125,22 @@ class VIEWS_EXPORT InkDropAnimation {
// perform any animation.
void SetTransforms(const InkDropTransforms transforms);
+ // Gets the opacity of the ink drop.
+ float GetCurrentOpacity() const;
+
// Sets the opacity of the ink drop.
void SetOpacity(float opacity);
+ // Animates all of the painted shape layers to the specified |opacity|. The
+ // animation will use the given |duration|, |preemption_strategy|, and |tween|
+ // and |observer| will be added to all LayerAnimationSequences.
varkha 2016/01/28 20:50:45 s/observer/animation_observer Maybe also break out
bruthig 2016/01/28 22:38:00 Re-worded a bit, PTAL.
+ void AnimateToOpacity(
+ float opacity,
+ base::TimeDelta duration,
+ ui::LayerAnimator::PreemptionStrategy preemption_strategy,
+ gfx::Tween::Type tween,
+ ui::LayerAnimationObserver* animation_observer);
+
// Updates all of the Transforms in |transforms_out| for a circle of the given
// |size|.
void CalculateCircleTransforms(const gfx::Size& size,
@@ -123,9 +152,9 @@ class VIEWS_EXPORT InkDropAnimation {
float corner_radius,
InkDropTransforms* transforms_out) const;
- // Updates all of the Transforms in |transforms_out| to the current target
- // Transforms of the Layers.
- void GetCurrentTansforms(InkDropTransforms* transforms_out) const;
+ // Updates all of the Transforms in |transforms_out| to the current Transforms
+ // of the painted shape Layers.
+ void GetCurrentTransforms(InkDropTransforms* transforms_out) const;
// Adds and configures a new |painted_shape| layer to |painted_layers_|.
void AddPaintLayer(PaintedShape painted_shape);
« no previous file with comments | « no previous file | ui/views/animation/ink_drop_animation.cc » ('j') | ui/views/animation/ink_drop_animation.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698