summaryrefslogtreecommitdiff
path: root/src/lib/ecore/efl_interpolator_bounce.c
blob: e6dd96d187c9d3db06c93e02568f23e1fbd43643 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include "Ecore.h"
#include "ecore_private.h"

#define MY_CLASS EFL_INTERPOLATOR_BOUNCE_CLASS

typedef struct _Efl_Interpolator_Bounce_Data Efl_Interpolator_Bounce_Data;

struct _Efl_Interpolator_Bounce_Data
{
   double factor[2];
};

EOLIAN static double
_efl_interpolator_bounce_efl_interpolator_interpolate(Eo *eo_obj EINA_UNUSED,
                                                      Efl_Interpolator_Bounce_Data *pd EINA_UNUSED,
                                                      double progress)
{
   if ((progress < 0.0) || (progress > 1.0))
     return progress;

   return ecore_animator_pos_map(progress, ECORE_POS_MAP_BOUNCE,
                                 pd->factor[0], pd->factor[1]);
}

EOLIAN static void
_efl_interpolator_bounce_factors_set(Eo *eo_obj EINA_UNUSED,
                                     Efl_Interpolator_Bounce_Data *pd,
                                     double factor1, double factor2)
{
   pd->factor[0] = factor1;
   pd->factor[1] = factor2;
}

EOLIAN static void
_efl_interpolator_bounce_factors_get(const Eo *eo_obj EINA_UNUSED,
                                     Efl_Interpolator_Bounce_Data *pd,
                                     double *factor1, double *factor2)
{
   if (factor1)
     *factor1 = pd->factor[0];

   if (factor2)
     *factor2 = pd->factor[1];
}

EOLIAN static Efl_Object *
_efl_interpolator_bounce_efl_object_constructor(Eo *eo_obj,
                                                Efl_Interpolator_Bounce_Data *pd)
{
   eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));

   pd->factor[0] = 1.0;
   pd->factor[1] = 1.0;

   return eo_obj;
}

#include "efl_interpolator_bounce.eo.c"