summaryrefslogtreecommitdiffstats
path: root/cc/animation/scroll_offset_animation_curve.h
blob: 0d45cf2f7b83e1e493afd3a79ea80f4a76949fb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright 2013 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.

#ifndef CC_ANIMATION_SCROLL_OFFSET_ANIMATION_CURVE_H_
#define CC_ANIMATION_SCROLL_OFFSET_ANIMATION_CURVE_H_

#include "base/memory/scoped_ptr.h"
#include "cc/animation/animation_curve.h"
#include "cc/base/cc_export.h"

namespace cc {

class TimingFunction;

class CC_EXPORT ScrollOffsetAnimationCurve : public AnimationCurve {
 public:
  static scoped_ptr<ScrollOffsetAnimationCurve> Create(
      const gfx::Vector2dF& target_value,
      scoped_ptr<TimingFunction> timing_function);

  virtual ~ScrollOffsetAnimationCurve();

  void SetInitialValue(const gfx::Vector2dF& initial_value);
  gfx::Vector2dF GetValue(double t) const;

  // AnimationCurve implementation
  virtual double Duration() const OVERRIDE;
  virtual CurveType Type() const OVERRIDE;
  virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE;

 private:
  ScrollOffsetAnimationCurve(const gfx::Vector2dF& target_value,
                             scoped_ptr <TimingFunction> timing_function);

  gfx::Vector2dF initial_value_;
  gfx::Vector2dF target_value_;
  double duration_;

  scoped_ptr<TimingFunction> timing_function_;

  DISALLOW_COPY_AND_ASSIGN(ScrollOffsetAnimationCurve);
};

}  // namespace cc

#endif  // CC_ANIMATION_SCROLL_OFFSET_ANIMATION_CURVE_H_