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

Unified Diff: ui/base/animation/linear_animation.cc

Issue 10855151: Gradient overlay for constrained window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chromeos Created 8 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 | « ui/base/animation/linear_animation.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/animation/linear_animation.cc
diff --git a/ui/base/animation/linear_animation.cc b/ui/base/animation/linear_animation.cc
index 60054d9cb78ed2095dbc02fd7d9d1b69d137b68b..33bd1d1a4818effafad12a00056cdb28048aaa64 100644
--- a/ui/base/animation/linear_animation.cc
+++ b/ui/base/animation/linear_animation.cc
@@ -45,6 +45,14 @@ double LinearAnimation::GetCurrentValue() const {
return state_;
}
+void LinearAnimation::SetCurrentValue(double new_value) {
+ new_value = std::max(0.0, std::min(1.0, new_value));
+ base::TimeDelta time_delta = base::TimeDelta::FromMicroseconds(
+ duration_.InMicroseconds() * (new_value - state_));
+ SetStartTime(start_time() - time_delta);
+ state_ = new_value;
+}
+
void LinearAnimation::End() {
if (!is_animating())
return;
@@ -79,6 +87,10 @@ void LinearAnimation::Step(base::TimeTicks time_now) {
Stop();
}
+void LinearAnimation::AnimationStarted() {
+ state_ = 0.0;
+}
+
void LinearAnimation::AnimationStopped() {
if (!in_end_)
return;
« no previous file with comments | « ui/base/animation/linear_animation.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698