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

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

Issue 1924663007: Expand the Material Design hover as it fades out when a ripple is triggered. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 8 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 | « ui/views/animation/ink_drop_host_view.cc ('k') | ui/views/animation/ink_drop_hover.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/animation/ink_drop_hover.h
diff --git a/ui/views/animation/ink_drop_hover.h b/ui/views/animation/ink_drop_hover.h
index 00ed198be34f32297592b20b59532f54d49774d2..1df74c2fc5adc27046fbc4c172f8f826015da127 100644
--- a/ui/views/animation/ink_drop_hover.h
+++ b/ui/views/animation/ink_drop_hover.h
@@ -10,7 +10,9 @@
#include "base/time/time.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/geometry/point.h"
+#include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/size.h"
+#include "ui/gfx/transform.h"
#include "ui/views/views_export.h"
namespace ui {
@@ -31,6 +33,8 @@ class VIEWS_EXPORT InkDropHover {
SkColor color);
~InkDropHover();
+ void set_explode_size(const gfx::Size& size) { explode_size_ = size; }
+
// Returns true if the hover animation is either in the process of fading
// in or is fully visible.
bool IsFadingInOrVisible() const;
@@ -38,8 +42,9 @@ class VIEWS_EXPORT InkDropHover {
// Fades in the hover visual over the given |duration|.
void FadeIn(const base::TimeDelta& duration);
- // Fades out the hover visual over the given |duration|.
- void FadeOut(const base::TimeDelta& duration);
+ // Fades out the hover visual over the given |duration|. If |explode| is true
+ // then the hover will animate a size increase in addition to the fade out.
+ void FadeOut(const base::TimeDelta& duration, bool explode);
// The root Layer that can be added in to a Layer tree.
ui::Layer* layer() { return layer_.get(); }
@@ -47,16 +52,32 @@ class VIEWS_EXPORT InkDropHover {
private:
enum HoverAnimationType { FADE_IN, FADE_OUT };
- // Animates a fade in/out as specified by |animation_type| over the given
+ // Animates a fade in/out as specified by |animation_type| combined with a
+ // transformation from the |initial_size| to the |target_size| over the given
// |duration|.
void AnimateFade(HoverAnimationType animation_type,
- const base::TimeDelta& duration);
+ const base::TimeDelta& duration,
+ const gfx::Size& initial_size,
+ const gfx::Size& target_size);
+
+ // Calculates the Transform to apply to |layer_| for the given |size|.
+ gfx::Transform CalculateTransform(const gfx::Size& size) const;
// The callback that will be invoked when a fade in/out animation is complete.
bool AnimationEndedCallback(
HoverAnimationType animation_type,
const ui::CallbackLayerAnimationObserver& observer);
+ // The size of the hover shape when fully faded in.
+ gfx::Size size_;
+
+ // The target size of the hover shape when it expands during a fade out
+ // animation.
+ gfx::Size explode_size_;
+
+ // The center point of the hover shape in the parent Layer's coordinate space.
+ gfx::PointF center_point_;
+
// True if the last animation to be initiated was a FADE_IN, and false
// otherwise.
bool last_animation_initiated_was_fade_in_;
« no previous file with comments | « ui/views/animation/ink_drop_host_view.cc ('k') | ui/views/animation/ink_drop_hover.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698