forked from enlightenment/efl
ecore: Add Efl.Interpolator class
Efl.Interpolator class is to interpolate a value. Efl.Interpolator class has the following interpolation function classes as its subclasses. Efl.Interpolator.Linear Efl.Interpolator.Accelerate Efl.Interpolator.Decelerate Efl.Interpolator.Sinusoidal Efl.Interpolator.Divisor Efl.Interpolator.Bounce Efl.Interpolator.Spring Efl.Interpolator.Cubic_Bezier
This commit is contained in:
parent
e83facfb37
commit
2ae42b00ab
|
@ -19,7 +19,16 @@ ecore_eolian_files_public = \
|
|||
lib/ecore/efl_io_stderr.eo \
|
||||
lib/ecore/efl_io_file.eo \
|
||||
lib/ecore/efl_io_copier.eo \
|
||||
lib/ecore/efl_io_buffered_stream.eo
|
||||
lib/ecore/efl_io_buffered_stream.eo \
|
||||
lib/ecore/efl_interpolator.eo \
|
||||
lib/ecore/efl_interpolator_linear.eo \
|
||||
lib/ecore/efl_interpolator_accelerate.eo \
|
||||
lib/ecore/efl_interpolator_decelerate.eo \
|
||||
lib/ecore/efl_interpolator_sinusoidal.eo \
|
||||
lib/ecore/efl_interpolator_divisor.eo \
|
||||
lib/ecore/efl_interpolator_bounce.eo \
|
||||
lib/ecore/efl_interpolator_spring.eo \
|
||||
lib/ecore/efl_interpolator_cubic_bezier.eo
|
||||
|
||||
|
||||
ecore_eolian_files = \
|
||||
|
@ -95,6 +104,15 @@ lib/ecore/efl_model_composite_boolean.c \
|
|||
lib/ecore/efl_model_composite_selection.c \
|
||||
lib/ecore/efl_model_accessor_view.c \
|
||||
lib/ecore/efl_model_accessor_view_private.h \
|
||||
lib/ecore/efl_interpolator.c \
|
||||
lib/ecore/efl_interpolator_linear.c \
|
||||
lib/ecore/efl_interpolator_accelerate.c \
|
||||
lib/ecore/efl_interpolator_decelerate.c \
|
||||
lib/ecore/efl_interpolator_sinusoidal.c \
|
||||
lib/ecore/efl_interpolator_divisor.c \
|
||||
lib/ecore/efl_interpolator_bounce.c \
|
||||
lib/ecore/efl_interpolator_spring.c \
|
||||
lib/ecore/efl_interpolator_cubic_bezier.c \
|
||||
lib/ecore/ecore_pipe.c \
|
||||
lib/ecore/ecore_poller.c \
|
||||
lib/ecore/ecore_time.c \
|
||||
|
|
|
@ -38,6 +38,15 @@ set(PUBLIC_EO_FILES
|
|||
efl_loop_timer.eo
|
||||
efl_loop_user.eo
|
||||
efl_promise.eo
|
||||
efl_interpolator.eo
|
||||
efl_interpolator_linear.eo
|
||||
efl_interpolator_accelerate.eo
|
||||
efl_interpolator_decelerate.eo
|
||||
efl_interpolator_sinusoidal.eo
|
||||
efl_interpolator_divisor.eo
|
||||
efl_interpolator_bounce.eo
|
||||
efl_interpolator_spring.eo
|
||||
efl_interpolator_cubic_bezier.eo
|
||||
)
|
||||
|
||||
set(PUBLIC_HEADERS
|
||||
|
|
|
@ -46,6 +46,16 @@ EAPI Eina_Future_Scheduler *efl_loop_future_scheduler_get(Eo *obj);
|
|||
|
||||
#include "efl_promise.eo.h"
|
||||
|
||||
#include "efl_interpolator.eo.h"
|
||||
#include "efl_interpolator_linear.eo.h"
|
||||
#include "efl_interpolator_accelerate.eo.h"
|
||||
#include "efl_interpolator_decelerate.eo.h"
|
||||
#include "efl_interpolator_sinusoidal.eo.h"
|
||||
#include "efl_interpolator_divisor.eo.h"
|
||||
#include "efl_interpolator_bounce.eo.h"
|
||||
#include "efl_interpolator_spring.eo.h"
|
||||
#include "efl_interpolator_cubic_bezier.eo.h"
|
||||
|
||||
/* We ue the factory pattern here, so you shouldn't call eo_add directly. */
|
||||
EAPI Eo *ecore_main_loop_get(void);
|
||||
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "Ecore.h"
|
||||
#include "ecore_private.h"
|
||||
|
||||
#define MY_CLASS EFL_INTERPOLATOR_CLASS
|
||||
|
||||
typedef struct _Efl_Interpolator_Data Efl_Interpolator_Data;
|
||||
|
||||
struct _Efl_Interpolator_Data
|
||||
{
|
||||
};
|
||||
|
||||
EOLIAN static double
|
||||
_efl_interpolator_interpolate(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Interpolator_Data *pd EINA_UNUSED,
|
||||
double progress)
|
||||
{
|
||||
return progress;
|
||||
}
|
||||
|
||||
#include "efl_interpolator.eo.c"
|
|
@ -0,0 +1,14 @@
|
|||
class Efl.Interpolator (Efl.Object)
|
||||
{
|
||||
[[Efl interpolator class]]
|
||||
data: Efl_Interpolator_Data;
|
||||
methods {
|
||||
interpolate {
|
||||
[[Interpolate the given value.]]
|
||||
return: double; [[Output value calculated by interpolating the input value.]]
|
||||
params {
|
||||
@in progress: double; [[Input value mapped from 0.0 to 1.0.]]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "Ecore.h"
|
||||
#include "ecore_private.h"
|
||||
|
||||
#define MY_CLASS EFL_INTERPOLATOR_ACCELERATE_CLASS
|
||||
|
||||
typedef struct _Efl_Interpolator_Accelerate_Data Efl_Interpolator_Accelerate_Data;
|
||||
|
||||
struct _Efl_Interpolator_Accelerate_Data
|
||||
{
|
||||
double factor;
|
||||
};
|
||||
|
||||
EOLIAN static double
|
||||
_efl_interpolator_accelerate_efl_interpolator_interpolate(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Interpolator_Accelerate_Data *pd EINA_UNUSED,
|
||||
double progress)
|
||||
{
|
||||
if ((progress < 0.0) || (progress > 1.0))
|
||||
return progress;
|
||||
|
||||
return ecore_animator_pos_map(progress, ECORE_POS_MAP_ACCELERATE_FACTOR,
|
||||
pd->factor, 0);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_interpolator_accelerate_factor_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Interpolator_Accelerate_Data *pd,
|
||||
double factor)
|
||||
{
|
||||
pd->factor = factor;
|
||||
}
|
||||
|
||||
EOLIAN static double
|
||||
_efl_interpolator_accelerate_factor_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Interpolator_Accelerate_Data *pd EINA_UNUSED)
|
||||
{
|
||||
return pd->factor;
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Object *
|
||||
_efl_interpolator_accelerate_efl_object_constructor(Eo *eo_obj,
|
||||
Efl_Interpolator_Accelerate_Data *pd)
|
||||
{
|
||||
eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
|
||||
|
||||
pd->factor = 1.0;
|
||||
|
||||
return eo_obj;
|
||||
}
|
||||
|
||||
#include "efl_interpolator_accelerate.eo.c"
|
|
@ -0,0 +1,23 @@
|
|||
class Efl.Interpolator.Accelerate (Efl.Interpolator)
|
||||
{
|
||||
[[Efl accelerate interpolator class
|
||||
|
||||
output = 1 - sin(Pi / 2 + input * Pi / 2);
|
||||
]]
|
||||
data: Efl_Interpolator_Accelerate_Data;
|
||||
methods {
|
||||
@property factor {
|
||||
set {
|
||||
}
|
||||
get {
|
||||
}
|
||||
values {
|
||||
factor: double; [[Factor of the interpolation function.]]
|
||||
}
|
||||
}
|
||||
}
|
||||
implements {
|
||||
Efl.Object.constructor;
|
||||
Efl.Interpolator.interpolate;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,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(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"
|
|
@ -0,0 +1,21 @@
|
|||
class Efl.Interpolator.Bounce (Efl.Interpolator)
|
||||
{
|
||||
[[Efl bounce interpolator class]]
|
||||
data: Efl_Interpolator_Bounce_Data;
|
||||
methods {
|
||||
@property factors {
|
||||
set {
|
||||
}
|
||||
get {
|
||||
}
|
||||
values {
|
||||
factor1: double; [[First factor of the interpolation function.]]
|
||||
factor2: double; [[Second factor of the interpolation function.]]
|
||||
}
|
||||
}
|
||||
}
|
||||
implements {
|
||||
Efl.Object.constructor;
|
||||
Efl.Interpolator.interpolate;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "Ecore.h"
|
||||
#include "ecore_private.h"
|
||||
|
||||
#define MY_CLASS EFL_INTERPOLATOR_CUBIC_BEZIER_CLASS
|
||||
|
||||
typedef struct _Efl_Interpolator_Cubic_Bezier_Data Efl_Interpolator_Cubic_Bezier_Data;
|
||||
|
||||
struct _Efl_Interpolator_Cubic_Bezier_Data
|
||||
{
|
||||
double factor[4];
|
||||
};
|
||||
|
||||
EOLIAN static double
|
||||
_efl_interpolator_cubic_bezier_efl_interpolator_interpolate(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Interpolator_Cubic_Bezier_Data *pd EINA_UNUSED,
|
||||
double progress)
|
||||
{
|
||||
if ((progress < 0.0) || (progress > 1.0))
|
||||
return progress;
|
||||
|
||||
return ecore_animator_pos_map_n(progress, ECORE_POS_MAP_CUBIC_BEZIER, 4,
|
||||
pd->factor);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_interpolator_cubic_bezier_factors_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Interpolator_Cubic_Bezier_Data *pd,
|
||||
double factor1, double factor2,
|
||||
double factor3, double factor4)
|
||||
{
|
||||
pd->factor[0] = factor1;
|
||||
pd->factor[1] = factor2;
|
||||
pd->factor[2] = factor3;
|
||||
pd->factor[3] = factor4;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_interpolator_cubic_bezier_factors_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Interpolator_Cubic_Bezier_Data *pd,
|
||||
double *factor1, double *factor2,
|
||||
double *factor3, double *factor4)
|
||||
{
|
||||
if (factor1)
|
||||
*factor1 = pd->factor[0];
|
||||
|
||||
if (factor2)
|
||||
*factor2 = pd->factor[1];
|
||||
|
||||
if (factor3)
|
||||
*factor3 = pd->factor[2];
|
||||
|
||||
if (factor4)
|
||||
*factor4 = pd->factor[3];
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Object *
|
||||
_efl_interpolator_cubic_bezier_efl_object_constructor(Eo *eo_obj,
|
||||
Efl_Interpolator_Cubic_Bezier_Data *pd)
|
||||
{
|
||||
eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
|
||||
|
||||
pd->factor[0] = 1.0;
|
||||
pd->factor[1] = 1.0;
|
||||
pd->factor[2] = 1.0;
|
||||
pd->factor[3] = 1.0;
|
||||
|
||||
return eo_obj;
|
||||
}
|
||||
|
||||
#include "efl_interpolator_cubic_bezier.eo.c"
|
|
@ -0,0 +1,23 @@
|
|||
class Efl.Interpolator.Cubic_Bezier (Efl.Interpolator)
|
||||
{
|
||||
[[Efl cubic_bezier interpolator class]]
|
||||
data: Efl_Interpolator_Cubic_Bezier_Data;
|
||||
methods {
|
||||
@property factors {
|
||||
set {
|
||||
}
|
||||
get {
|
||||
}
|
||||
values {
|
||||
factor1: double; [[First factor of the interpolation function.]]
|
||||
factor2: double; [[Second factor of the interpolation function.]]
|
||||
factor3: double; [[Third factor of the interpolation function.]]
|
||||
factor4: double; [[Fourth factor of the interpolation function.]]
|
||||
}
|
||||
}
|
||||
}
|
||||
implements {
|
||||
Efl.Object.constructor;
|
||||
Efl.Interpolator.interpolate;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "Ecore.h"
|
||||
#include "ecore_private.h"
|
||||
|
||||
#define MY_CLASS EFL_INTERPOLATOR_DECELERATE_CLASS
|
||||
|
||||
typedef struct _Efl_Interpolator_Decelerate_Data Efl_Interpolator_Decelerate_Data;
|
||||
|
||||
struct _Efl_Interpolator_Decelerate_Data
|
||||
{
|
||||
double factor;
|
||||
};
|
||||
|
||||
EOLIAN static double
|
||||
_efl_interpolator_decelerate_efl_interpolator_interpolate(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Interpolator_Decelerate_Data *pd EINA_UNUSED,
|
||||
double progress)
|
||||
{
|
||||
if ((progress < 0.0) || (progress > 1.0))
|
||||
return progress;
|
||||
|
||||
return ecore_animator_pos_map(progress, ECORE_POS_MAP_DECELERATE_FACTOR,
|
||||
pd->factor, 0);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_interpolator_decelerate_factor_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Interpolator_Decelerate_Data *pd,
|
||||
double factor)
|
||||
{
|
||||
pd->factor = factor;
|
||||
}
|
||||
|
||||
EOLIAN static double
|
||||
_efl_interpolator_decelerate_factor_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Interpolator_Decelerate_Data *pd EINA_UNUSED)
|
||||
{
|
||||
return pd->factor;
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Object *
|
||||
_efl_interpolator_decelerate_efl_object_constructor(Eo *eo_obj,
|
||||
Efl_Interpolator_Decelerate_Data *pd)
|
||||
{
|
||||
eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
|
||||
|
||||
pd->factor = 1.0;
|
||||
|
||||
return eo_obj;
|
||||
}
|
||||
|
||||
#include "efl_interpolator_decelerate.eo.c"
|
|
@ -0,0 +1,23 @@
|
|||
class Efl.Interpolator.Decelerate (Efl.Interpolator)
|
||||
{
|
||||
[[Efl decelerate interpolator class
|
||||
|
||||
output = sin(input * Pi / 2);
|
||||
]]
|
||||
data: Efl_Interpolator_Decelerate_Data;
|
||||
methods {
|
||||
@property factor {
|
||||
set {
|
||||
}
|
||||
get {
|
||||
}
|
||||
values {
|
||||
factor: double; [[Factor of the interpolation function.]]
|
||||
}
|
||||
}
|
||||
}
|
||||
implements {
|
||||
Efl.Object.constructor;
|
||||
Efl.Interpolator.interpolate;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "Ecore.h"
|
||||
#include "ecore_private.h"
|
||||
|
||||
#define MY_CLASS EFL_INTERPOLATOR_DIVISOR_CLASS
|
||||
|
||||
typedef struct _Efl_Interpolator_Divisor_Data Efl_Interpolator_Divisor_Data;
|
||||
|
||||
struct _Efl_Interpolator_Divisor_Data
|
||||
{
|
||||
double factor[2];
|
||||
};
|
||||
|
||||
EOLIAN static double
|
||||
_efl_interpolator_divisor_efl_interpolator_interpolate(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Interpolator_Divisor_Data *pd EINA_UNUSED,
|
||||
double progress)
|
||||
{
|
||||
if ((progress < 0.0) || (progress > 1.0))
|
||||
return progress;
|
||||
|
||||
return ecore_animator_pos_map(progress, ECORE_POS_MAP_DIVISOR_INTERP,
|
||||
pd->factor[0], pd->factor[1]);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_interpolator_divisor_factors_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Interpolator_Divisor_Data *pd,
|
||||
double factor1, double factor2)
|
||||
{
|
||||
pd->factor[0] = factor1;
|
||||
pd->factor[1] = factor2;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_interpolator_divisor_factors_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Interpolator_Divisor_Data *pd,
|
||||
double *factor1, double *factor2)
|
||||
{
|
||||
if (factor1)
|
||||
*factor1 = pd->factor[0];
|
||||
|
||||
if (factor2)
|
||||
*factor2 = pd->factor[1];
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Object *
|
||||
_efl_interpolator_divisor_efl_object_constructor(Eo *eo_obj,
|
||||
Efl_Interpolator_Divisor_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_divisor.eo.c"
|
|
@ -0,0 +1,21 @@
|
|||
class Efl.Interpolator.Divisor (Efl.Interpolator)
|
||||
{
|
||||
[[Efl divisor interpolator class]]
|
||||
data: Efl_Interpolator_Divisor_Data;
|
||||
methods {
|
||||
@property factors {
|
||||
set {
|
||||
}
|
||||
get {
|
||||
}
|
||||
values {
|
||||
factor1: double; [[First factor of the interpolation function.]]
|
||||
factor2: double; [[Second factor of the interpolation function.]]
|
||||
}
|
||||
}
|
||||
}
|
||||
implements {
|
||||
Efl.Object.constructor;
|
||||
Efl.Interpolator.interpolate;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "Ecore.h"
|
||||
#include "ecore_private.h"
|
||||
|
||||
#define MY_CLASS EFL_INTERPOLATOR_LINEAR_CLASS
|
||||
|
||||
typedef struct _Efl_Interpolator_Linear_Data Efl_Interpolator_Linear_Data;
|
||||
|
||||
struct _Efl_Interpolator_Linear_Data
|
||||
{
|
||||
};
|
||||
|
||||
EOLIAN static double
|
||||
_efl_interpolator_linear_efl_interpolator_interpolate(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Interpolator_Linear_Data *pd EINA_UNUSED,
|
||||
double progress)
|
||||
{
|
||||
if ((progress < 0.0) || (progress > 1.0))
|
||||
return progress;
|
||||
|
||||
return ecore_animator_pos_map(progress, ECORE_POS_MAP_LINEAR, 0, 0);
|
||||
}
|
||||
|
||||
#include "efl_interpolator_linear.eo.c"
|
|
@ -0,0 +1,8 @@
|
|||
class Efl.Interpolator.Linear (Efl.Interpolator)
|
||||
{
|
||||
[[Efl linear interpolator class]]
|
||||
data: Efl_Interpolator_Linear_Data;
|
||||
implements {
|
||||
Efl.Interpolator.interpolate;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "Ecore.h"
|
||||
#include "ecore_private.h"
|
||||
|
||||
#define MY_CLASS EFL_INTERPOLATOR_SINUSOIDAL_CLASS
|
||||
|
||||
typedef struct _Efl_Interpolator_Sinusoidal_Data Efl_Interpolator_Sinusoidal_Data;
|
||||
|
||||
struct _Efl_Interpolator_Sinusoidal_Data
|
||||
{
|
||||
double factor;
|
||||
};
|
||||
|
||||
EOLIAN static double
|
||||
_efl_interpolator_sinusoidal_efl_interpolator_interpolate(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Interpolator_Sinusoidal_Data *pd EINA_UNUSED,
|
||||
double progress)
|
||||
{
|
||||
if ((progress < 0.0) || (progress > 1.0))
|
||||
return progress;
|
||||
|
||||
return ecore_animator_pos_map(progress, ECORE_POS_MAP_SINUSOIDAL_FACTOR,
|
||||
pd->factor, 0);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_interpolator_sinusoidal_factor_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Interpolator_Sinusoidal_Data *pd,
|
||||
double factor)
|
||||
{
|
||||
pd->factor = factor;
|
||||
}
|
||||
|
||||
EOLIAN static double
|
||||
_efl_interpolator_sinusoidal_factor_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Interpolator_Sinusoidal_Data *pd EINA_UNUSED)
|
||||
{
|
||||
return pd->factor;
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Object *
|
||||
_efl_interpolator_sinusoidal_efl_object_constructor(Eo *eo_obj,
|
||||
Efl_Interpolator_Sinusoidal_Data *pd)
|
||||
{
|
||||
eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
|
||||
|
||||
pd->factor = 1.0;
|
||||
|
||||
return eo_obj;
|
||||
}
|
||||
|
||||
#include "efl_interpolator_sinusoidal.eo.c"
|
|
@ -0,0 +1,23 @@
|
|||
class Efl.Interpolator.Sinusoidal (Efl.Interpolator)
|
||||
{
|
||||
[[Efl sinusoidal interpolator class
|
||||
|
||||
output = (1 - cos(input * Pi)) / 2;
|
||||
]]
|
||||
data: Efl_Interpolator_Sinusoidal_Data;
|
||||
methods {
|
||||
@property factor {
|
||||
set {
|
||||
}
|
||||
get {
|
||||
}
|
||||
values {
|
||||
factor: double; [[Factor of the interpolation function.]]
|
||||
}
|
||||
}
|
||||
}
|
||||
implements {
|
||||
Efl.Object.constructor;
|
||||
Efl.Interpolator.interpolate;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "Ecore.h"
|
||||
#include "ecore_private.h"
|
||||
|
||||
#define MY_CLASS EFL_INTERPOLATOR_SPRING_CLASS
|
||||
|
||||
typedef struct _Efl_Interpolator_Spring_Data Efl_Interpolator_Spring_Data;
|
||||
|
||||
struct _Efl_Interpolator_Spring_Data
|
||||
{
|
||||
double factor[2];
|
||||
};
|
||||
|
||||
EOLIAN static double
|
||||
_efl_interpolator_spring_efl_interpolator_interpolate(Eo *obj EINA_UNUSED,
|
||||
Efl_Interpolator_Spring_Data *pd EINA_UNUSED,
|
||||
double progress)
|
||||
{
|
||||
if ((progress < 0.0) || (progress > 1.0))
|
||||
return progress;
|
||||
|
||||
return ecore_animator_pos_map(progress, ECORE_POS_MAP_SPRING,
|
||||
pd->factor[0], pd->factor[1]);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_interpolator_spring_factors_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Interpolator_Spring_Data *pd,
|
||||
double factor1, double factor2)
|
||||
{
|
||||
pd->factor[0] = factor1;
|
||||
pd->factor[1] = factor2;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_interpolator_spring_factors_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Interpolator_Spring_Data *pd,
|
||||
double *factor1, double *factor2)
|
||||
{
|
||||
if (factor1)
|
||||
*factor1 = pd->factor[0];
|
||||
|
||||
if (factor2)
|
||||
*factor2 = pd->factor[1];
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Object *
|
||||
_efl_interpolator_spring_efl_object_constructor(Eo *eo_obj,
|
||||
Efl_Interpolator_Spring_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_spring.eo.c"
|
|
@ -0,0 +1,21 @@
|
|||
class Efl.Interpolator.Spring (Efl.Interpolator)
|
||||
{
|
||||
[[Efl spring interpolator class]]
|
||||
data: Efl_Interpolator_Spring_Data;
|
||||
methods {
|
||||
@property factors {
|
||||
set {
|
||||
}
|
||||
get {
|
||||
}
|
||||
values {
|
||||
factor1: double; [[First factor of the interpolation function.]]
|
||||
factor2: double; [[Second factor of the interpolation function.]]
|
||||
}
|
||||
}
|
||||
}
|
||||
implements {
|
||||
Efl.Object.constructor;
|
||||
Efl.Interpolator.interpolate;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue