summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXavi Artigas <xavierartigas@yahoo.es>2019-11-05 20:26:14 +0100
committerXavi Artigas <xavierartigas@yahoo.es>2019-11-06 15:50:11 +0100
commit9ca84821fc91d3e5661edb9d2393788b28c56f7c (patch)
tree58aa2e3812cad7d41a3243915ed785e63d28754b /src
parent17a81bee4a53891e44a165a14ca20027f9aa0824 (diff)
Efl.Interpolator*: More sensible API names and docs
Summary: OK, so, ALL interpolator parameters were called "factor" and the docs literally said "First factor, Second factor, ..." After diving into the actual implementation, proper names (and types) for the parameters were found and proper docs written. I am afraid I could not make any sense of the Divisor interpolator code. Those docs still need writing. Test Plan: Everything still builds and passes tests. No functional changes. Reviewers: zmike, cedric, bu5hm4n, Jaehyun_Cho Reviewed By: bu5hm4n Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10603
Diffstat (limited to 'src')
-rw-r--r--src/bin/elementary/test_efl_anim_interpolator.c15
-rw-r--r--src/lib/ecore/efl_accelerate_interpolator.c16
-rw-r--r--src/lib/ecore/efl_accelerate_interpolator.eo14
-rw-r--r--src/lib/ecore/efl_bounce_interpolator.c40
-rw-r--r--src/lib/ecore/efl_bounce_interpolator.eo24
-rw-r--r--src/lib/ecore/efl_cubic_bezier_interpolator.c50
-rw-r--r--src/lib/ecore/efl_cubic_bezier_interpolator.eo26
-rw-r--r--src/lib/ecore/efl_decelerate_interpolator.c16
-rw-r--r--src/lib/ecore/efl_decelerate_interpolator.eo14
-rw-r--r--src/lib/ecore/efl_divisor_interpolator.c39
-rw-r--r--src/lib/ecore/efl_divisor_interpolator.eo20
-rw-r--r--src/lib/ecore/efl_linear_interpolator.eo3
-rw-r--r--src/lib/ecore/efl_sinusoidal_interpolator.c16
-rw-r--r--src/lib/ecore/efl_sinusoidal_interpolator.eo13
-rw-r--r--src/lib/ecore/efl_spring_interpolator.c44
-rw-r--r--src/lib/ecore/efl_spring_interpolator.eo24
-rw-r--r--src/lib/efl/interfaces/efl_interpolator.eo21
17 files changed, 250 insertions, 145 deletions
diff --git a/src/bin/elementary/test_efl_anim_interpolator.c b/src/bin/elementary/test_efl_anim_interpolator.c
index 9a6522f..96c7649 100644
--- a/src/bin/elementary/test_efl_anim_interpolator.c
+++ b/src/bin/elementary/test_efl_anim_interpolator.c
@@ -33,32 +33,35 @@ _interpolator_create(int index, Evas_Object *win)
33 else if (index == 1) 33 else if (index == 1)
34 { 34 {
35 interp = efl_add(EFL_SINUSOIDAL_INTERPOLATOR_CLASS, win); 35 interp = efl_add(EFL_SINUSOIDAL_INTERPOLATOR_CLASS, win);
36 efl_sinusoidal_interpolator_factor_set(interp, 1.0); 36 efl_sinusoidal_interpolator_slope_set(interp, 1.0);
37 } 37 }
38 else if (index == 2) 38 else if (index == 2)
39 { 39 {
40 interp = efl_add(EFL_DECELERATE_INTERPOLATOR_CLASS, win); 40 interp = efl_add(EFL_DECELERATE_INTERPOLATOR_CLASS, win);
41 efl_decelerate_interpolator_factor_set(interp, 1.0); 41 efl_decelerate_interpolator_slope_set(interp, 1.0);
42 } 42 }
43 else if (index == 3) 43 else if (index == 3)
44 { 44 {
45 interp = efl_add(EFL_ACCELERATE_INTERPOLATOR_CLASS, win); 45 interp = efl_add(EFL_ACCELERATE_INTERPOLATOR_CLASS, win);
46 efl_accelerate_interpolator_factor_set(interp, 1.0); 46 efl_accelerate_interpolator_slope_set(interp, 1.0);
47 } 47 }
48 else if (index == 4) 48 else if (index == 4)
49 { 49 {
50 interp = efl_add(EFL_DIVISOR_INTERPOLATOR_CLASS, win); 50 interp = efl_add(EFL_DIVISOR_INTERPOLATOR_CLASS, win);
51 efl_divisor_interpolator_factors_set(interp, 1.0, 1.0); 51 efl_divisor_interpolator_divisor_set(interp, 1.0);
52 efl_divisor_interpolator_power_set(interp, 1);
52 } 53 }
53 else if (index == 5) 54 else if (index == 5)
54 { 55 {
55 interp = efl_add(EFL_BOUNCE_INTERPOLATOR_CLASS, win); 56 interp = efl_add(EFL_BOUNCE_INTERPOLATOR_CLASS, win);
56 efl_bounce_interpolator_factors_set(interp, 1.0, 1.0); 57 efl_bounce_interpolator_rigidness_set(interp, 1.0);
58 efl_bounce_interpolator_bounces_set(interp, 1);
57 } 59 }
58 else if (index == 6) 60 else if (index == 6)
59 { 61 {
60 interp = efl_add(EFL_SPRING_INTERPOLATOR_CLASS, win); 62 interp = efl_add(EFL_SPRING_INTERPOLATOR_CLASS, win);
61 efl_spring_interpolator_factors_set(interp, 1.0, 1.0); 63 efl_spring_interpolator_decay_set(interp, 1.0);
64 efl_spring_interpolator_oscillations_set(interp, 1);
62 } 65 }
63 66
64 return interp; 67 return interp;
diff --git a/src/lib/ecore/efl_accelerate_interpolator.c b/src/lib/ecore/efl_accelerate_interpolator.c
index 917c032..b2e1032 100644
--- a/src/lib/ecore/efl_accelerate_interpolator.c
+++ b/src/lib/ecore/efl_accelerate_interpolator.c
@@ -11,7 +11,7 @@ typedef struct _Efl_Accelerate_Interpolator_Data Efl_Accelerate_Interpolator_Dat
11 11
12struct _Efl_Accelerate_Interpolator_Data 12struct _Efl_Accelerate_Interpolator_Data
13{ 13{
14 double factor; 14 double slope;
15}; 15};
16 16
17EOLIAN static double 17EOLIAN static double
@@ -23,22 +23,22 @@ _efl_accelerate_interpolator_efl_interpolator_interpolate(Eo *eo_obj EINA_UNUSED
23 return progress; 23 return progress;
24 24
25 return ecore_animator_pos_map(progress, ECORE_POS_MAP_ACCELERATE_FACTOR, 25 return ecore_animator_pos_map(progress, ECORE_POS_MAP_ACCELERATE_FACTOR,
26 pd->factor, 0); 26 pd->slope, 0);
27} 27}
28 28
29EOLIAN static void 29EOLIAN static void
30_efl_accelerate_interpolator_factor_set(Eo *eo_obj EINA_UNUSED, 30_efl_accelerate_interpolator_slope_set(Eo *eo_obj EINA_UNUSED,
31 Efl_Accelerate_Interpolator_Data *pd, 31 Efl_Accelerate_Interpolator_Data *pd,
32 double factor) 32 double slope)
33{ 33{
34 pd->factor = factor; 34 pd->slope = slope;
35} 35}
36 36
37EOLIAN static double 37EOLIAN static double
38_efl_accelerate_interpolator_factor_get(const Eo *eo_obj EINA_UNUSED, 38_efl_accelerate_interpolator_slope_get(const Eo *eo_obj EINA_UNUSED,
39 Efl_Accelerate_Interpolator_Data *pd EINA_UNUSED) 39 Efl_Accelerate_Interpolator_Data *pd EINA_UNUSED)
40{ 40{
41 return pd->factor; 41 return pd->slope;
42} 42}
43 43
44EOLIAN static Efl_Object * 44EOLIAN static Efl_Object *
@@ -47,7 +47,7 @@ _efl_accelerate_interpolator_efl_object_constructor(Eo *eo_obj,
47{ 47{
48 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS)); 48 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
49 49
50 pd->factor = 1.0; 50 pd->slope = 1.0;
51 51
52 return eo_obj; 52 return eo_obj;
53} 53}
diff --git a/src/lib/ecore/efl_accelerate_interpolator.eo b/src/lib/ecore/efl_accelerate_interpolator.eo
index 9af3669..648dc1b 100644
--- a/src/lib/ecore/efl_accelerate_interpolator.eo
+++ b/src/lib/ecore/efl_accelerate_interpolator.eo
@@ -1,19 +1,23 @@
1class @beta Efl.Accelerate_Interpolator extends Efl.Object implements Efl.Interpolator 1class @beta Efl.Accelerate_Interpolator extends Efl.Object implements Efl.Interpolator
2{ 2{
3 [[Efl accelerate interpolator class 3 [[Accelerated interpolator. It starts slow and accelerates, stopping abruptly when
4 it reaches $[1.0].
4 5
5 output = 1 - sin(Pi / 2 + input * Pi / 2); 6 Internally it uses the first half of a sinus rise (from 0 to 0.5) and the steepness
7 can be customized.
6 ]] 8 ]]
7 data: Efl_Accelerate_Interpolator_Data; 9 data: Efl_Accelerate_Interpolator_Data;
8 methods { 10 methods {
9 @property factor { 11 @property slope {
10 [[Factor property]] 12 [[Customize the acceleration effect.]]
11 set { 13 set {
12 } 14 }
13 get { 15 get {
14 } 16 }
15 values { 17 values {
16 factor: double; [[Factor of the interpolation function.]] 18 slope: double; [[How steep is the effect. $[0] performs a linear interpolation,
19 $[1] corresponds to a sinus function and higher numbers produce
20 an increasingly steep effect.]]
17 } 21 }
18 } 22 }
19 } 23 }
diff --git a/src/lib/ecore/efl_bounce_interpolator.c b/src/lib/ecore/efl_bounce_interpolator.c
index 7565019..11703b8 100644
--- a/src/lib/ecore/efl_bounce_interpolator.c
+++ b/src/lib/ecore/efl_bounce_interpolator.c
@@ -11,7 +11,8 @@ typedef struct _Efl_Bounce_Interpolator_Data Efl_Bounce_Interpolator_Data;
11 11
12struct _Efl_Bounce_Interpolator_Data 12struct _Efl_Bounce_Interpolator_Data
13{ 13{
14 double factor[2]; 14 double rigidness;
15 int bounces;
15}; 16};
16 17
17EOLIAN static double 18EOLIAN static double
@@ -23,28 +24,37 @@ _efl_bounce_interpolator_efl_interpolator_interpolate(Eo *eo_obj EINA_UNUSED,
23 return progress; 24 return progress;
24 25
25 return ecore_animator_pos_map(progress, ECORE_POS_MAP_BOUNCE, 26 return ecore_animator_pos_map(progress, ECORE_POS_MAP_BOUNCE,
26 pd->factor[0], pd->factor[1]); 27 pd->rigidness, (double)pd->bounces);
27} 28}
28 29
29EOLIAN static void 30EOLIAN static void
30_efl_bounce_interpolator_factors_set(Eo *eo_obj EINA_UNUSED, 31_efl_bounce_interpolator_rigidness_set(Eo *eo_obj EINA_UNUSED,
31 Efl_Bounce_Interpolator_Data *pd, 32 Efl_Bounce_Interpolator_Data *pd,
32 double factor1, double factor2) 33 double rigidness)
33{ 34{
34 pd->factor[0] = factor1; 35 pd->rigidness = rigidness;
35 pd->factor[1] = factor2; 36}
37
38EOLIAN static double
39_efl_bounce_interpolator_rigidness_get(const Eo *eo_obj EINA_UNUSED,
40 Efl_Bounce_Interpolator_Data *pd)
41{
42 return pd->rigidness;
36} 43}
37 44
38EOLIAN static void 45EOLIAN static void
39_efl_bounce_interpolator_factors_get(const Eo *eo_obj EINA_UNUSED, 46_efl_bounce_interpolator_bounces_set(Eo *eo_obj EINA_UNUSED,
40 Efl_Bounce_Interpolator_Data *pd, 47 Efl_Bounce_Interpolator_Data *pd,
41 double *factor1, double *factor2) 48 int bounces)
42{ 49{
43 if (factor1) 50 pd->bounces = bounces;
44 *factor1 = pd->factor[0]; 51}
45 52
46 if (factor2) 53EOLIAN static int
47 *factor2 = pd->factor[1]; 54_efl_bounce_interpolator_bounces_get(const Eo *eo_obj EINA_UNUSED,
55 Efl_Bounce_Interpolator_Data *pd)
56{
57 return pd->bounces;
48} 58}
49 59
50EOLIAN static Efl_Object * 60EOLIAN static Efl_Object *
@@ -53,8 +63,8 @@ _efl_bounce_interpolator_efl_object_constructor(Eo *eo_obj,
53{ 63{
54 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS)); 64 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
55 65
56 pd->factor[0] = 1.0; 66 pd->rigidness = 1.0;
57 pd->factor[1] = 1.0; 67 pd->bounces = 1;
58 68
59 return eo_obj; 69 return eo_obj;
60} 70}
diff --git a/src/lib/ecore/efl_bounce_interpolator.eo b/src/lib/ecore/efl_bounce_interpolator.eo
index d6b1147..54998d6 100644
--- a/src/lib/ecore/efl_bounce_interpolator.eo
+++ b/src/lib/ecore/efl_bounce_interpolator.eo
@@ -1,17 +1,31 @@
1class @beta Efl.Bounce_Interpolator extends Efl.Object implements Efl.Interpolator 1class @beta Efl.Bounce_Interpolator extends Efl.Object implements Efl.Interpolator
2{ 2{
3 [[Efl bounce interpolator class]] 3 [[Bouncing interpolator. The value quickly reaches $[1.0] and then bounces back
4 a number of times before stopping at $[1.0].
5
6 The number of bounces and how far it goes back on every bounce can be customized.
7 ]]
4 data: Efl_Bounce_Interpolator_Data; 8 data: Efl_Bounce_Interpolator_Data;
5 methods { 9 methods {
6 @property factors { 10 @property bounces {
7 [[Factors property]] 11 [[Customize the number of bounces.]]
8 set { 12 set {
9 } 13 }
10 get { 14 get {
11 } 15 }
12 values { 16 values {
13 factor1: double; [[First factor of the interpolation function.]] 17 bounces: int; [[Number of bounces before stopping.]]
14 factor2: double; [[Second factor of the interpolation function.]] 18 }
19 }
20 @property rigidness {
21 [[Customize the rigidness.]]
22 set {
23 }
24 get {
25 }
26 values {
27 rigidness: double; [[How much energy is lost on every bounce.
28 Higher numbers result in smaller bounces (lesser bounciness).]]
15 } 29 }
16 } 30 }
17 } 31 }
diff --git a/src/lib/ecore/efl_cubic_bezier_interpolator.c b/src/lib/ecore/efl_cubic_bezier_interpolator.c
index 8b9b376..2413714 100644
--- a/src/lib/ecore/efl_cubic_bezier_interpolator.c
+++ b/src/lib/ecore/efl_cubic_bezier_interpolator.c
@@ -11,7 +11,7 @@ typedef struct _Efl_Cubic_Bezier_Interpolator_Data Efl_Cubic_Bezier_Interpolator
11 11
12struct _Efl_Cubic_Bezier_Interpolator_Data 12struct _Efl_Cubic_Bezier_Interpolator_Data
13{ 13{
14 double factor[4]; 14 double control_points[4];
15}; 15};
16 16
17EOLIAN static double 17EOLIAN static double
@@ -23,38 +23,36 @@ _efl_cubic_bezier_interpolator_efl_interpolator_interpolate(Eo *eo_obj EINA_UNUS
23 return progress; 23 return progress;
24 24
25 return ecore_animator_pos_map_n(progress, ECORE_POS_MAP_CUBIC_BEZIER, 4, 25 return ecore_animator_pos_map_n(progress, ECORE_POS_MAP_CUBIC_BEZIER, 4,
26 pd->factor); 26 pd->control_points);
27} 27}
28 28
29EOLIAN static void 29EOLIAN static void
30_efl_cubic_bezier_interpolator_factors_set(Eo *eo_obj EINA_UNUSED, 30_efl_cubic_bezier_interpolator_control_points_set(Eo *eo_obj EINA_UNUSED,
31 Efl_Cubic_Bezier_Interpolator_Data *pd, 31 Efl_Cubic_Bezier_Interpolator_Data *pd,
32 double factor1, double factor2, 32 Eina_Vector2 p1, Eina_Vector2 p2)
33 double factor3, double factor4)
34{ 33{
35 pd->factor[0] = factor1; 34 pd->control_points[0] = p1.x;
36 pd->factor[1] = factor2; 35 pd->control_points[1] = p1.y;
37 pd->factor[2] = factor3; 36 pd->control_points[2] = p2.x;
38 pd->factor[3] = factor4; 37 pd->control_points[3] = p2.y;
39} 38}
40 39
41EOLIAN static void 40EOLIAN static void
42_efl_cubic_bezier_interpolator_factors_get(const Eo *eo_obj EINA_UNUSED, 41_efl_cubic_bezier_interpolator_control_points_get(const Eo *eo_obj EINA_UNUSED,
43 Efl_Cubic_Bezier_Interpolator_Data *pd, 42 Efl_Cubic_Bezier_Interpolator_Data *pd,
44 double *factor1, double *factor2, 43 Eina_Vector2 *p1, Eina_Vector2 *p2)
45 double *factor3, double *factor4)
46{ 44{
47 if (factor1) 45 if (p1)
48 *factor1 = pd->factor[0]; 46 {
47 p1->x = pd->control_points[0];
48 p1->y = pd->control_points[1];
49 }
49 50
50 if (factor2) 51 if (p2)
51 *factor2 = pd->factor[1]; 52 {
52 53 p2->x = pd->control_points[2];
53 if (factor3) 54 p2->y = pd->control_points[3];
54 *factor3 = pd->factor[2]; 55 }
55
56 if (factor4)
57 *factor4 = pd->factor[3];
58} 56}
59 57
60EOLIAN static Efl_Object * 58EOLIAN static Efl_Object *
@@ -63,10 +61,10 @@ _efl_cubic_bezier_interpolator_efl_object_constructor(Eo *eo_obj,
63{ 61{
64 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS)); 62 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
65 63
66 pd->factor[0] = 1.0; 64 pd->control_points[0] = 1.0;
67 pd->factor[1] = 1.0; 65 pd->control_points[1] = 1.0;
68 pd->factor[2] = 1.0; 66 pd->control_points[2] = 1.0;
69 pd->factor[3] = 1.0; 67 pd->control_points[3] = 1.0;
70 68
71 return eo_obj; 69 return eo_obj;
72} 70}
diff --git a/src/lib/ecore/efl_cubic_bezier_interpolator.eo b/src/lib/ecore/efl_cubic_bezier_interpolator.eo
index c6dd144..30614b9 100644
--- a/src/lib/ecore/efl_cubic_bezier_interpolator.eo
+++ b/src/lib/ecore/efl_cubic_bezier_interpolator.eo
@@ -1,19 +1,31 @@
1class @beta Efl.Cubic_Bezier_Interpolator extends Efl.Object implements Efl.Interpolator 1class @beta Efl.Cubic_Bezier_Interpolator extends Efl.Object implements Efl.Interpolator
2{ 2{
3 [[Efl cubic_bezier interpolator class]] 3 [[Cubic Bezier interpolator. It starts slow, then moves quickly and then slows down
4 again before stopping.
5
6 The exact shape of the mapping curve can be modified through the @.control_points
7 property.
8 ]]
4 data: Efl_Cubic_Bezier_Interpolator_Data; 9 data: Efl_Cubic_Bezier_Interpolator_Data;
5 methods { 10 methods {
6 @property factors { 11 @property control_points {
7 [[Factors property]] 12 [[Cubic Bezier curves are described by 4 2D control points
13 (https://en.wikipedia.org/wiki/B%C3%A9zier_curve).
14 For each control point, the X coordinate is an input value and the Y coordinate is the
15 corresponding output value.
16 The first one, P0, is set to $[(0,0)]: The input $[0.0] is mapped to the $[0.0] output.
17 The last one, P3, is set to $[(1,1)]: The input $[1.0] is mapped to the $[1.0] output.
18 The other two control points can be set through this property and control the shape of
19 the curve. Note that the control points do not need to be in the $[0...1] range, and
20 neither do the output values of the curve.
21 ]]
8 set { 22 set {
9 } 23 }
10 get { 24 get {
11 } 25 }
12 values { 26 values {
13 factor1: double; [[First factor of the interpolation function.]] 27 p1: Eina.Vector2; [[P1 control point.]]
14 factor2: double; [[Second factor of the interpolation function.]] 28 p2: Eina.Vector2; [[P2 control point.]]
15 factor3: double; [[Third factor of the interpolation function.]]
16 factor4: double; [[Fourth factor of the interpolation function.]]
17 } 29 }
18 } 30 }
19 } 31 }
diff --git a/src/lib/ecore/efl_decelerate_interpolator.c b/src/lib/ecore/efl_decelerate_interpolator.c
index 575ac22..9a8494d 100644
--- a/src/lib/ecore/efl_decelerate_interpolator.c
+++ b/src/lib/ecore/efl_decelerate_interpolator.c
@@ -11,7 +11,7 @@ typedef struct _Efl_Decelerate_Interpolator_Data Efl_Decelerate_Interpolator_Dat
11 11
12struct _Efl_Decelerate_Interpolator_Data 12struct _Efl_Decelerate_Interpolator_Data
13{ 13{
14 double factor; 14 double slope;
15}; 15};
16 16
17EOLIAN static double 17EOLIAN static double
@@ -23,22 +23,22 @@ _efl_decelerate_interpolator_efl_interpolator_interpolate(Eo *eo_obj EINA_UNUSED
23 return progress; 23 return progress;
24 24
25 return ecore_animator_pos_map(progress, ECORE_POS_MAP_DECELERATE_FACTOR, 25 return ecore_animator_pos_map(progress, ECORE_POS_MAP_DECELERATE_FACTOR,
26 pd->factor, 0); 26 pd->slope, 0);
27} 27}
28 28
29EOLIAN static void 29EOLIAN static void
30_efl_decelerate_interpolator_factor_set(Eo *eo_obj EINA_UNUSED, 30_efl_decelerate_interpolator_slope_set(Eo *eo_obj EINA_UNUSED,
31 Efl_Decelerate_Interpolator_Data *pd, 31 Efl_Decelerate_Interpolator_Data *pd,
32 double factor) 32 double slope)
33{ 33{
34 pd->factor = factor; 34 pd->slope = slope;
35} 35}
36 36
37EOLIAN static double 37EOLIAN static double
38_efl_decelerate_interpolator_factor_get(const Eo *eo_obj EINA_UNUSED, 38_efl_decelerate_interpolator_slope_get(const Eo *eo_obj EINA_UNUSED,
39 Efl_Decelerate_Interpolator_Data *pd EINA_UNUSED) 39 Efl_Decelerate_Interpolator_Data *pd EINA_UNUSED)
40{ 40{
41 return pd->factor; 41 return pd->slope;
42} 42}
43 43
44EOLIAN static Efl_Object * 44EOLIAN static Efl_Object *
@@ -47,7 +47,7 @@ _efl_decelerate_interpolator_efl_object_constructor(Eo *eo_obj,
47{ 47{
48 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS)); 48 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
49 49
50 pd->factor = 1.0; 50 pd->slope = 1.0;
51 51
52 return eo_obj; 52 return eo_obj;
53} 53}
diff --git a/src/lib/ecore/efl_decelerate_interpolator.eo b/src/lib/ecore/efl_decelerate_interpolator.eo
index 802d409..4201169 100644
--- a/src/lib/ecore/efl_decelerate_interpolator.eo
+++ b/src/lib/ecore/efl_decelerate_interpolator.eo
@@ -1,19 +1,23 @@
1class @beta Efl.Decelerate_Interpolator extends Efl.Object implements Efl.Interpolator 1class @beta Efl.Decelerate_Interpolator extends Efl.Object implements Efl.Interpolator
2{ 2{
3 [[Efl decelerate interpolator class 3 [[Decelerated interpolator. It starts fast and decelerates, stopping smoothly when
4 it reaches $[1.0].
4 5
5 output = sin(input * Pi / 2); 6 Internally it uses the second half of a sinus rise (from 0.5 to 1.0) and the steepness
7 can be customized.
6 ]] 8 ]]
7 data: Efl_Decelerate_Interpolator_Data; 9 data: Efl_Decelerate_Interpolator_Data;
8 methods { 10 methods {
9 @property factor { 11 @property slope {
10 [[Factor property]] 12 [[Customize the deceleration effect.]]
11 set { 13 set {
12 } 14 }
13 get { 15 get {
14 } 16 }
15 values { 17 values {
16 factor: double; [[Factor of the interpolation function.]] 18 slope: double; [[How steep is the effect. $[0] performs a linear interpolation,
19 $[1] corresponds to a sinus function and higher numbers produce
20 an increasingly steep effect.]]
17 } 21 }
18 } 22 }
19 } 23 }
diff --git a/src/lib/ecore/efl_divisor_interpolator.c b/src/lib/ecore/efl_divisor_interpolator.c
index 3cbc12b..2d96764 100644
--- a/src/lib/ecore/efl_divisor_interpolator.c
+++ b/src/lib/ecore/efl_divisor_interpolator.c
@@ -11,7 +11,8 @@ typedef struct _Efl_Divisor_Interpolator_Data Efl_Divisor_Interpolator_Data;
11 11
12struct _Efl_Divisor_Interpolator_Data 12struct _Efl_Divisor_Interpolator_Data
13{ 13{
14 double factor[2]; 14 double divisor;
15 int power;
15}; 16};
16 17
17EOLIAN static double 18EOLIAN static double
@@ -23,28 +24,36 @@ _efl_divisor_interpolator_efl_interpolator_interpolate(Eo *eo_obj EINA_UNUSED,
23 return progress; 24 return progress;
24 25
25 return ecore_animator_pos_map(progress, ECORE_POS_MAP_DIVISOR_INTERP, 26 return ecore_animator_pos_map(progress, ECORE_POS_MAP_DIVISOR_INTERP,
26 pd->factor[0], pd->factor[1]); 27 pd->divisor, (double)pd->power);
27} 28}
28 29
29EOLIAN static void 30EOLIAN static void
30_efl_divisor_interpolator_factors_set(Eo *eo_obj EINA_UNUSED, 31_efl_divisor_interpolator_divisor_set(Eo *eo_obj EINA_UNUSED,
31 Efl_Divisor_Interpolator_Data *pd, 32 Efl_Divisor_Interpolator_Data *pd,
32 double factor1, double factor2) 33 double divisor)
33{ 34{
34 pd->factor[0] = factor1; 35 pd->divisor = divisor;
35 pd->factor[1] = factor2;
36} 36}
37 37
38EOLIAN static double
39_efl_divisor_interpolator_divisor_get(const Eo *eo_obj EINA_UNUSED,
40 Efl_Divisor_Interpolator_Data *pd)
41{
42 return pd->divisor;
43}
38EOLIAN static void 44EOLIAN static void
39_efl_divisor_interpolator_factors_get(const Eo *eo_obj EINA_UNUSED, 45_efl_divisor_interpolator_power_set(Eo *eo_obj EINA_UNUSED,
40 Efl_Divisor_Interpolator_Data *pd, 46 Efl_Divisor_Interpolator_Data *pd,
41 double *factor1, double *factor2) 47 int power)
42{ 48{
43 if (factor1) 49 pd->power = power;
44 *factor1 = pd->factor[0]; 50}
45 51
46 if (factor2) 52EOLIAN static int
47 *factor2 = pd->factor[1]; 53_efl_divisor_interpolator_power_get(const Eo *eo_obj EINA_UNUSED,
54 Efl_Divisor_Interpolator_Data *pd)
55{
56 return pd->power;
48} 57}
49 58
50EOLIAN static Efl_Object * 59EOLIAN static Efl_Object *
@@ -53,8 +62,8 @@ _efl_divisor_interpolator_efl_object_constructor(Eo *eo_obj,
53{ 62{
54 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS)); 63 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
55 64
56 pd->factor[0] = 1.0; 65 pd->divisor = 1.0;
57 pd->factor[1] = 1.0; 66 pd->power = 1;
58 67
59 return eo_obj; 68 return eo_obj;
60} 69}
diff --git a/src/lib/ecore/efl_divisor_interpolator.eo b/src/lib/ecore/efl_divisor_interpolator.eo
index 848c44b..09b0ed6 100644
--- a/src/lib/ecore/efl_divisor_interpolator.eo
+++ b/src/lib/ecore/efl_divisor_interpolator.eo
@@ -1,17 +1,27 @@
1class @beta Efl.Divisor_Interpolator extends Efl.Object implements Efl.Interpolator 1class @beta Efl.Divisor_Interpolator extends Efl.Object implements Efl.Interpolator
2{ 2{
3 [[Efl divisor interpolator class]] 3 [[Divisor interpolator.
4 ]]
4 data: Efl_Divisor_Interpolator_Data; 5 data: Efl_Divisor_Interpolator_Data;
5 methods { 6 methods {
6 @property factors { 7 @property divisor {
7 [[Factors property]] 8 [[Customize divisor factor.]]
8 set { 9 set {
9 } 10 }
10 get { 11 get {
11 } 12 }
12 values { 13 values {
13 factor1: double; [[First factor of the interpolation function.]] 14 divisor: double; [[Divisor.]]
14 factor2: double; [[Second factor of the interpolation function.]] 15 }
16 }
17 @property power {
18 [[Customize power factor.]]
19 set {
20 }
21 get {
22 }
23 values {
24 power: int; [[Exponent.]]
15 } 25 }
16 } 26 }
17 } 27 }
diff --git a/src/lib/ecore/efl_linear_interpolator.eo b/src/lib/ecore/efl_linear_interpolator.eo
index e22e980..866247d 100644
--- a/src/lib/ecore/efl_linear_interpolator.eo
+++ b/src/lib/ecore/efl_linear_interpolator.eo
@@ -1,6 +1,7 @@
1class @beta Efl.Linear_Interpolator extends Efl.Object implements Efl.Interpolator 1class @beta Efl.Linear_Interpolator extends Efl.Object implements Efl.Interpolator
2{ 2{
3 [[Efl linear interpolator class]] 3 [[Linear interpolation (pass-through). Input values are used unmodified as output.
4 ]]
4 data: Efl_Linear_Interpolator_Data; 5 data: Efl_Linear_Interpolator_Data;
5 implements { 6 implements {
6 Efl.Interpolator.interpolate; 7 Efl.Interpolator.interpolate;
diff --git a/src/lib/ecore/efl_sinusoidal_interpolator.c b/src/lib/ecore/efl_sinusoidal_interpolator.c
index d36a776..3216ef9 100644
--- a/src/lib/ecore/efl_sinusoidal_interpolator.c
+++ b/src/lib/ecore/efl_sinusoidal_interpolator.c
@@ -11,7 +11,7 @@ typedef struct _Efl_Sinusoidal_Interpolator_Data Efl_Sinusoidal_Interpolator_Dat
11 11
12struct _Efl_Sinusoidal_Interpolator_Data 12struct _Efl_Sinusoidal_Interpolator_Data
13{ 13{
14 double factor; 14 double slope;
15}; 15};
16 16
17EOLIAN static double 17EOLIAN static double
@@ -23,22 +23,22 @@ _efl_sinusoidal_interpolator_efl_interpolator_interpolate(Eo *eo_obj EINA_UNUSED
23 return progress; 23 return progress;
24 24
25 return ecore_animator_pos_map(progress, ECORE_POS_MAP_SINUSOIDAL_FACTOR, 25 return ecore_animator_pos_map(progress, ECORE_POS_MAP_SINUSOIDAL_FACTOR,
26 pd->factor, 0); 26 pd->slope, 0);
27} 27}
28 28
29EOLIAN static void 29EOLIAN static void
30_efl_sinusoidal_interpolator_factor_set(Eo *eo_obj EINA_UNUSED, 30_efl_sinusoidal_interpolator_slope_set(Eo *eo_obj EINA_UNUSED,
31 Efl_Sinusoidal_Interpolator_Data *pd, 31 Efl_Sinusoidal_Interpolator_Data *pd,
32 double factor) 32 double slope)
33{ 33{
34 pd->factor = factor; 34 pd->slope = slope;
35} 35}
36 36
37EOLIAN static double 37EOLIAN static double
38_efl_sinusoidal_interpolator_factor_get(const Eo *eo_obj EINA_UNUSED, 38_efl_sinusoidal_interpolator_slope_get(const Eo *eo_obj EINA_UNUSED,
39 Efl_Sinusoidal_Interpolator_Data *pd EINA_UNUSED) 39 Efl_Sinusoidal_Interpolator_Data *pd EINA_UNUSED)
40{ 40{
41 return pd->factor; 41 return pd->slope;
42} 42}
43 43
44EOLIAN static Efl_Object * 44EOLIAN static Efl_Object *
@@ -47,7 +47,7 @@ _efl_sinusoidal_interpolator_efl_object_constructor(Eo *eo_obj,
47{ 47{
48 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS)); 48 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
49 49
50 pd->factor = 1.0; 50 pd->slope = 1.0;
51 51
52 return eo_obj; 52 return eo_obj;
53} 53}
diff --git a/src/lib/ecore/efl_sinusoidal_interpolator.eo b/src/lib/ecore/efl_sinusoidal_interpolator.eo
index e0701aa..ad48232 100644
--- a/src/lib/ecore/efl_sinusoidal_interpolator.eo
+++ b/src/lib/ecore/efl_sinusoidal_interpolator.eo
@@ -1,19 +1,22 @@
1class @beta Efl.Sinusoidal_Interpolator extends Efl.Object implements Efl.Interpolator 1class @beta Efl.Sinusoidal_Interpolator extends Efl.Object implements Efl.Interpolator
2{ 2{
3 [[Efl sinusoidal interpolator class 3 [[Sinusoidal interpolator. It starts slow, then moves quickly and then slows down
4 again before stopping.
4 5
5 output = (1 - cos(input * Pi)) / 2; 6 How long it stays in the quick zone (the slope of the curve) can be customized.
6 ]] 7 ]]
7 data: Efl_Sinusoidal_Interpolator_Data; 8 data: Efl_Sinusoidal_Interpolator_Data;
8 methods { 9 methods {
9 @property factor { 10 @property slope {
10 [[Factor property]] 11 [[Customize the sinusoidal effect.]]
11 set { 12 set {
12 } 13 }
13 get { 14 get {
14 } 15 }
15 values { 16 values {
16 factor: double; [[Factor of the interpolation function.]] 17 slope: double; [[How steep is the effect. $[0] performs a linear interpolation,
18 $[1] corresponds to a sinus function and higher numbers produce
19 an increasingly steep effect.]]
17 } 20 }
18 } 21 }
19 } 22 }
diff --git a/src/lib/ecore/efl_spring_interpolator.c b/src/lib/ecore/efl_spring_interpolator.c
index 183e54c..71611bf 100644
--- a/src/lib/ecore/efl_spring_interpolator.c
+++ b/src/lib/ecore/efl_spring_interpolator.c
@@ -11,40 +11,50 @@ typedef struct _Efl_Spring_Interpolator_Data Efl_Spring_Interpolator_Data;
11 11
12struct _Efl_Spring_Interpolator_Data 12struct _Efl_Spring_Interpolator_Data
13{ 13{
14 double factor[2]; 14 double decay;
15 int oscillations;
15}; 16};
16 17
17EOLIAN static double 18EOLIAN static double
18_efl_spring_interpolator_efl_interpolator_interpolate(Eo *obj EINA_UNUSED, 19_efl_spring_interpolator_efl_interpolator_interpolate(Eo *obj EINA_UNUSED,
19 Efl_Spring_Interpolator_Data *pd EINA_UNUSED, 20 Efl_Spring_Interpolator_Data *pd,
20 double progress) 21 double progress)
21{ 22{
22 if ((progress < 0.0) || (progress > 1.0)) 23 if ((progress < 0.0) || (progress > 1.0))
23 return progress; 24 return progress;
24 25
25 return ecore_animator_pos_map(progress, ECORE_POS_MAP_SPRING, 26 return ecore_animator_pos_map(progress, ECORE_POS_MAP_SPRING,
26 pd->factor[0], pd->factor[1]); 27 pd->decay, (double)pd->oscillations);
27} 28}
28 29
29EOLIAN static void 30EOLIAN static void
30_efl_spring_interpolator_factors_set(Eo *eo_obj EINA_UNUSED, 31_efl_spring_interpolator_decay_set(Eo *eo_obj EINA_UNUSED,
31 Efl_Spring_Interpolator_Data *pd, 32 Efl_Spring_Interpolator_Data *pd,
32 double factor1, double factor2) 33 double decay)
33{ 34{
34 pd->factor[0] = factor1; 35 pd->decay = decay;
35 pd->factor[1] = factor2; 36}
37
38EOLIAN static double
39_efl_spring_interpolator_decay_get(const Eo *eo_obj EINA_UNUSED,
40 Efl_Spring_Interpolator_Data *pd)
41{
42 return pd->decay;
36} 43}
37 44
38EOLIAN static void 45EOLIAN static void
39_efl_spring_interpolator_factors_get(const Eo *eo_obj EINA_UNUSED, 46_efl_spring_interpolator_oscillations_set(Eo *eo_obj EINA_UNUSED,
40 Efl_Spring_Interpolator_Data *pd, 47 Efl_Spring_Interpolator_Data *pd,
41 double *factor1, double *factor2) 48 int oscillations)
42{ 49{
43 if (factor1) 50 pd->oscillations = oscillations;
44 *factor1 = pd->factor[0]; 51}
45 52
46 if (factor2) 53EOLIAN static int
47 *factor2 = pd->factor[1]; 54_efl_spring_interpolator_oscillations_get(const Eo *eo_obj EINA_UNUSED,
55 Efl_Spring_Interpolator_Data *pd)
56{
57 return pd->oscillations;
48} 58}
49 59
50EOLIAN static Efl_Object * 60EOLIAN static Efl_Object *
@@ -53,8 +63,8 @@ _efl_spring_interpolator_efl_object_constructor(Eo *eo_obj,
53{ 63{
54 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS)); 64 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
55 65
56 pd->factor[0] = 1.0; 66 pd->decay = 1.0;
57 pd->factor[1] = 1.0; 67 pd->oscillations = 1;
58 68
59 return eo_obj; 69 return eo_obj;
60} 70}
diff --git a/src/lib/ecore/efl_spring_interpolator.eo b/src/lib/ecore/efl_spring_interpolator.eo
index 5549046..9890666 100644
--- a/src/lib/ecore/efl_spring_interpolator.eo
+++ b/src/lib/ecore/efl_spring_interpolator.eo
@@ -1,17 +1,31 @@
1class @beta Efl.Spring_Interpolator extends Efl.Object implements Efl.Interpolator 1class @beta Efl.Spring_Interpolator extends Efl.Object implements Efl.Interpolator
2{ 2{
3 [[Efl spring interpolator class]] 3 [[Spring interpolator. The value quickly reaches $[1.0] and then oscillates
4 around it a number of times before stopping (as if linked with a spring).
5
6 The number of oscillations and how quickly it stops can be customized.
7 ]]
4 data: Efl_Spring_Interpolator_Data; 8 data: Efl_Spring_Interpolator_Data;
5 methods { 9 methods {
6 @property factors { 10 @property decay {
7 [[Factors property]] 11 [[Customize the decay factor.]]
8 set { 12 set {
9 } 13 }
10 get { 14 get {
11 } 15 }
12 values { 16 values {
13 factor1: double; [[First factor of the interpolation function.]] 17 decay: double; [[How quickly energy is lost.
14 factor2: double; [[Second factor of the interpolation function.]] 18 Higher numbers result in smaller oscillations.]]
19 }
20 }
21 @property oscillations {
22 [[Customize number of oscillations.]]
23 set {
24 }
25 get {
26 }
27 values {
28 oscillations: int; [[Number of oscillations before stopping.]]
15 } 29 }
16 } 30 }
17 } 31 }
diff --git a/src/lib/efl/interfaces/efl_interpolator.eo b/src/lib/efl/interfaces/efl_interpolator.eo
index ba01e74..7c25dfe 100644
--- a/src/lib/efl/interfaces/efl_interpolator.eo
+++ b/src/lib/efl/interfaces/efl_interpolator.eo
@@ -1,12 +1,25 @@
1interface @beta Efl.Interpolator 1interface @beta Efl.Interpolator
2{ 2{
3 [[Efl interpolator interface]] 3 [[Interface providing interpolation capabilities.
4
5 In the context of EFL, interpolation is defined as the mapping of values in the
6 $[0, 1] range to another range (typically close).
7
8 This is used for example in animations, where the timer moves linearly from $[0.0]
9 to $[1.0] but the property being animated can accelerate, decelerate, bounce or
10 even move slightly out-of-bounds and come back.
11
12 For example implementations see @Efl.Accelerate_Interpolator, @Efl.Decelerate_Interpolator
13 or @Efl.Bounce_Interpolator.
14 ]]
4 methods { 15 methods {
5 interpolate { 16 interpolate {
6 [[Interpolate the given value.]] 17 [[Performs the mapping operation.]]
7 return: double; [[Output value calculated by interpolating the input value.]] 18 return: double; [[Output mapped value. Its range is unrestricted. In particular,
19 it might be outside the input $[0, 1] range.]]
8 params { 20 params {
9 @in progress: double; [[Input value mapped from 0.0 to 1.0.]] 21 @in progress: double; [[Input value between $[0.0] and $[1.0]. Values outside this range
22 might yield unpredictable results.]]
10 } 23 }
11 } 24 }
12 } 25 }