summaryrefslogtreecommitdiffstats
path: root/cc/CCScrollbarAnimationControllerLinearFade.h
blob: 749dca5e3f3493d186f151c2f4008f0ab1d1f253 (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
// Copyright 2012 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 CCScrollbarAnimationControllerLinearFade_h
#define CCScrollbarAnimationControllerLinearFade_h

#include "CCScrollbarAnimationController.h"

namespace cc {

class CCScrollbarAnimationControllerLinearFade : public CCScrollbarAnimationController {
public:
    static PassOwnPtr<CCScrollbarAnimationControllerLinearFade> create(CCLayerImpl* scrollLayer, double fadeoutDelay, double fadeoutLength);

    virtual ~CCScrollbarAnimationControllerLinearFade();

    virtual bool animate(double monotonicTime) OVERRIDE;

    virtual void didPinchGestureUpdateAtTime(double monotonicTime) OVERRIDE;
    virtual void didPinchGestureEndAtTime(double monotonicTime) OVERRIDE;
    virtual void updateScrollOffsetAtTime(CCLayerImpl* scrollLayer, double monotonicTime) OVERRIDE;

protected:
    CCScrollbarAnimationControllerLinearFade(CCLayerImpl* scrollLayer, double fadeoutDelay, double fadeoutLength);

private:
    float opacityAtTime(double monotonicTime);

    double m_lastAwakenTime;
    bool m_pinchGestureInEffect;

    double m_fadeoutDelay;
    double m_fadeoutLength;
};

} // namespace cc

#endif // CCScrollbarAnimationControllerLinearFade_h