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

Unified Diff: remoting/client/gl_cursor_feedback.cc

Issue 2265053005: [Remoting Android] Use Material Design's Ripple Expansion Function for Touch Feedback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comments Created 4 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/gl_cursor_feedback.cc
diff --git a/remoting/client/gl_cursor_feedback.cc b/remoting/client/gl_cursor_feedback.cc
index 8306933013e18f2919a50b45db7ba4c878fe731a..f4c75e65eb5358521f52b59dbae73ee6e066ad1a 100644
--- a/remoting/client/gl_cursor_feedback.cc
+++ b/remoting/client/gl_cursor_feedback.cc
@@ -15,7 +15,11 @@
#include "remoting/client/gl_texture_ids.h"
namespace {
-const float kAnimationDurationMs = 220.f;
+
+const float kAnimationDurationMs = 300.f;
+const float kExpansionBase = 400.f;
joedow 2016/08/22 22:22:21 Perhaps there isn't a better name, but kExpansionB
Yuwei 2016/08/22 23:46:22 Not sure what is the best description for this con
+const float kExpansionNormalization = (1.f - pow(kExpansionBase, -1));
joedow 2016/08/22 22:22:22 I think this might be clearer to create an anonymo
Yuwei 2016/08/22 23:46:22 Done. BTW nice timestamp, 22 22:22:22 :P
+
} // namespace
namespace remoting {
@@ -54,12 +58,17 @@ bool GlCursorFeedback::Draw() {
animation_start_time_ = base::TimeTicks();
return false;
}
- float diameter = progress * max_diameter_;
+ // Decelerating Expansion: (1 - 400^(-t)) / (1 - 400^(-1))
joedow 2016/08/22 22:22:21 Can you update the comment a bit here? The commen
Yuwei 2016/08/22 23:46:22 Just removed the comment here. It doesn't seem use
+ float expansion_coeff =
+ (1.f - pow(kExpansionBase, -progress)) / kExpansionNormalization;
+ float diameter = expansion_coeff * max_diameter_;
std::array<float, 8> positions;
FillRectangleVertexPositions(cursor_x_ - diameter / 2,
cursor_y_ - diameter / 2,
diameter, diameter, &positions);
layer_->SetVertexPositions(positions);
+
+ // Linear fade-out.
layer_->Draw(1.f - progress);
return true;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698