-
-
Notifications
You must be signed in to change notification settings - Fork 451
/
Copy pathCEasingCurve.h
81 lines (61 loc) · 2.11 KB
/
CEasingCurve.h
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*****************************************************************************
*
* PROJECT: Multi Theft Auto v1.1
* LICENSE: See LICENSE in the top level directory
* FILE: animation/CEasingCurve.h
* PURPOSE: Easing curves for non-linear time interpolation
*
*****************************************************************************/
/****************************************************************************
** Derived from LGPL code from Qt Framework (QEasingCurve)
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation ([email protected])
****************************************************************************/
class CEasingCurve;
#pragma once
// Real implementation class defined in .cpp
class CEasingCurve_Impl;
// User friendly interface
class CEasingCurve
{
public:
enum eType
{
Linear,
InQuad,
OutQuad,
InOutQuad,
OutInQuad,
InElastic,
OutElastic,
InOutElastic,
OutInElastic,
InBack,
OutBack,
InOutBack,
OutInBack,
InBounce,
OutBounce,
InOutBounce,
OutInBounce,
SineCurve,
CosineCurve,
EASING_INVALID = 0xFF
};
typedef double (*SimpleEasingFunction)(double progress);
CEasingCurve(eType a_eType = Linear);
CEasingCurve(const CEasingCurve& a_rfOther);
CEasingCurve& operator=(const CEasingCurve& a_rfOther);
~CEasingCurve();
static eType GetEasingTypeFromString(const std::string& a_rstrType);
static std::string GetStringFromEasingType(eType a_eType);
void SetType(eType a_eType);
eType GetType() const;
void SetParams(double a_fPeriod, double a_fAmplitude, double a_fOvershoot);
void GetParams(double& a_rfPeriod, double& a_rfAmplitude, double& a_rfOvershoot) const;
float ValueForProgress(float progress) const;
bool IsTargetValueFinalValue() const; // at t=1 can we use target as the final value (false for sin & cos)
protected:
CEasingCurve_Impl* m_pImplementation;
};