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

Unified Diff: app/linear_animation.h

Issue 6154001: Move animation code to new ui/base/animation directory.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 | « app/app_base.gypi ('k') | app/linear_animation.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/linear_animation.h
===================================================================
--- app/linear_animation.h (revision 70624)
+++ app/linear_animation.h (working copy)
@@ -1,71 +1,13 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Inspired by NSAnimation
#ifndef APP_LINEAR_ANIMATION_H_
#define APP_LINEAR_ANIMATION_H_
#pragma once
-#include "app/animation.h"
-#include "base/time.h"
+#include "ui/base/animation/linear_animation.h"
-class AnimationDelegate;
+using ui::LinearAnimation;
-// Linear time bounded animation. As the animation progresses AnimateToState is
-// invoked.
-class LinearAnimation : public Animation {
- public:
- // Initializes everything except the duration.
- //
- // Caller must make sure to call SetDuration() if they use this
- // constructor; it is preferable to use the full one, but sometimes
- // duration can change between calls to Start() and we need to
- // expose this interface.
- LinearAnimation(int frame_rate, AnimationDelegate* delegate);
-
- // Initializes all fields.
- LinearAnimation(int duration, int frame_rate, AnimationDelegate* delegate);
-
- // Gets the value for the current state, according to the animation curve in
- // use. This class provides only for a linear relationship, however subclasses
- // can override this to provide others.
- virtual double GetCurrentValue() const;
-
- // Skip to the end of the current animation.
- void End();
-
- // Changes the length of the animation. This resets the current
- // state of the animation to the beginning.
- void SetDuration(int duration);
-
- protected:
- // Called when the animation progresses. Subclasses override this to
- // efficiently update their state.
- virtual void AnimateToState(double state) = 0;
-
- // Invoked by the AnimationContainer when the animation is running to advance
- // the animation. Use |time_now| rather than Time::Now to avoid multiple
- // animations running at the same time diverging.
- virtual void Step(base::TimeTicks time_now);
-
- // Overriden to advance to the end (if End was invoked).
- virtual void AnimationStopped();
-
- // Overriden to return true if state is not 1.
- virtual bool ShouldSendCanceledFromStop();
-
- private:
- base::TimeDelta duration_;
-
- // Current state, on a scale from 0.0 to 1.0.
- double state_;
-
- // If true, we're in end. This is used to determine if the animation should
- // be advanced to the end from AnimationStopped.
- bool in_end_;
-
- DISALLOW_COPY_AND_ASSIGN(LinearAnimation);
-};
-
#endif // APP_LINEAR_ANIMATION_H_
« no previous file with comments | « app/app_base.gypi ('k') | app/linear_animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698