Tizen Native API
|
Functions | |
Ecore_Animator * | ecore_animator_add (Ecore_Task_Cb func, const void *data) |
Adds an animator to call func at every animation tick during main loop execution. | |
Ecore_Animator * | ecore_animator_timeline_add (double runtime, Ecore_Timeline_Cb func, const void *data) |
Adds an animator that runs for a limited time. | |
void * | ecore_animator_del (Ecore_Animator *animator) |
Deletes the specified animator from the animator list. | |
void | ecore_animator_freeze (Ecore_Animator *animator) |
Suspends the specified animator. | |
void | ecore_animator_thaw (Ecore_Animator *animator) |
Restores execution of the specified animator. | |
void | ecore_animator_frametime_set (double frametime) |
Sets the animator call interval in seconds. | |
double | ecore_animator_frametime_get (void) |
Gets the animator call interval in seconds. | |
double | ecore_animator_pos_map (double pos, Ecore_Pos_Map map, double v1, double v2) |
Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve. | |
void | ecore_animator_source_set (Ecore_Animator_Source source) |
Sets the source of the animator ticks for the mainloop. | |
Ecore_Animator_Source | ecore_animator_source_get (void) |
Gets the animator source currently set. | |
void | ecore_animator_custom_source_tick_begin_callback_set (Ecore_Cb func, const void *data) |
Sets the function that begins a custom animator tick source. | |
void | ecore_animator_custom_source_tick_end_callback_set (Ecore_Cb func, const void *data) |
Sets the function that ends a custom animator tick source. | |
void | ecore_animator_custom_tick (void) |
Triggers a custom animator tick. | |
Typedefs | |
typedef struct _Ecore_Animator | Ecore_Animator |
handle for ecore animator. | |
typedef enum _Ecore_Pos_Map | Ecore_Pos_Map |
typedef to enum _Ecore_Pos_Map | |
typedef enum _Ecore_Animator_Source | Ecore_Animator_Source |
typedef to enum _Ecore_Animator_Source | |
typedef Eina_Bool(* | Ecore_Timeline_Cb )(void *data, double pos) |
The boolean type for a callback run for a task (animators with runtimes) |
Ecore animators are a helper to simplify creating animations.
Creating an animation is as simple as saying for how long it should be run and having a callback that does the animation, something like this:
static Eina_Bool _do_animation(void *data, double pos) { evas_object_move(data, 100 * pos, 100 * pos); ... do some more animating ... } ... ecore_animator_timeline_add(2, _do_animation, my_evas_object);
In the sample above we create an animation to move my_evas_object
from position (0,0) to (100,100) in 2
seconds.
If your animation runs for an unspecified amount of time you can use ecore_animator_add(), which is like using ecore_timer_add() with the interval being the framerate. Note that this has tangible benefits of creating a timer for each animation in terms of performance.
enum _Ecore_Pos_Map |
Enumeration that defines the position mappings for the animation.
Ecore_Animator* ecore_animator_add | ( | Ecore_Task_Cb | func, |
const void * | data | ||
) |
Adds an animator to call func at every animation tick during main loop execution.
This function adds an animator and returns its handle on success, and NULL
on failure. The function func is called every N seconds where N is the frametime interval set by ecore_animator_frametime_set(). The function is passed the data pointer as its parameter.
1
or 0
. If it returns 1
(or ECORE_CALLBACK_RENEW
), it is called again at the next tick, or if it returns 0
(or ECORE_CALLBACK_CANCEL
) it is deleted automatically making any references/handles for it invalid.[in] | func | The function to call when it ticks off |
[in] | data | The data to pass to the function |
void ecore_animator_custom_source_tick_begin_callback_set | ( | Ecore_Cb | func, |
const void * | data | ||
) |
Sets the function that begins a custom animator tick source.
NULL
then no function is called to begin custom ticking.[in] | func | The function to call when ticking is to begin |
[in] | data | The data passed to the tick begin function as its parameter |
void ecore_animator_custom_source_tick_end_callback_set | ( | Ecore_Cb | func, |
const void * | data | ||
) |
Sets the function that ends a custom animator tick source.
NULL
then no function is called to stop ticking. For more information see ecore_animator_custom_source_tick_begin_callback_set().[in] | func | The function to call when ticking is to end |
[in] | data | The data passed to the tick end function as its parameter |
void ecore_animator_custom_tick | ( | void | ) |
Triggers a custom animator tick.
ECORE_ANIMATOR_SOURCE_CUSTOM
, then calling this function triggers a run of all animators currently registered with Ecore as this indicates that a "frame tick" happened. This does nothing if the animator source(set by ecore_animator_source_set()) is not set to ECORE_ANIMATOR_SOURCE_CUSTOM
.void* ecore_animator_del | ( | Ecore_Animator * | animator | ) |
Deletes the specified animator from the animator list.
This deletes the specified animator from the set of animators that are executed during main loop execution. This function returns the data parameter that is being passed to the callback on success, otherwise NULL
on failure. After this call returns the specified animator object animator is invalid and should not be used again. It does not get called again after deletion.
[in] | animator | The animator to delete |
double ecore_animator_frametime_get | ( | void | ) |
Gets the animator call interval in seconds.
This function retrieves the time in seconds between animator ticks.
void ecore_animator_frametime_set | ( | double | frametime | ) |
Sets the animator call interval in seconds.
This function sets the time interval (in seconds) between animator ticks. At every tick the callback of every existing animator is called.
[in] | frametime | The time in seconds between animator ticks |
void ecore_animator_freeze | ( | Ecore_Animator * | animator | ) |
Suspends the specified animator.
[in] | animator | The animator to delete |
double ecore_animator_pos_map | ( | double | pos, |
Ecore_Pos_Map | map, | ||
double | v1, | ||
double | v2 | ||
) |
Maps an input position from 0.0
to 1.0
along a timeline to a position in a different curve.
This takes an input position (0.0
to 1.0
) and maps it to a new position (normally between 0.0
and 1.0
, but it may go above/below 0.0
or 1.0
to show that it has "overshot" the mark) using some interpolation (mapping) algorithm.
0.0
being linear, 1.0
being ECORE_POS_MAP_ACCELERATE
, 2.0
being much more pronounced accelerate (squared), 3.0
being cubed, and so on. 0.0
being linear, 1.0
being ECORE_POS_MAP_DECELERATE
, 2.0
being much more pronounced decelerate (squared), 3.0
being cubed, and so on. 0.0
being linear, 1.0
being ECORE_POS_MAP_SINUSOIDAL
, 2.0
being much more pronounced sinusoidal (squared), 3.0
being cubed, and so on. 0.0
then "drop" like a ball bouncing to the ground at 1.0
, and bounce v2 times, with decay factor of v1. 0.0
then "wobble" like a spring with rest position 1.0
, and wobble v2 times, with decay factor of v1 double pos; // input position in a timeline from 0.0 to 1.0 double out; // output position after mapping int x1, y1, x2, y2; // x1 & y1 are start position, x2 & y2 are end position int x, y; // x & y are the calculated position out = ecore_animator_pos_map(pos, ECORE_POS_MAP_BOUNCE, 1.8, 7); x = (x1 * out) + (x2 * (1.0 - out)); y = (y1 * out) + (y2 * (1.0 - out)); move_my_object_to(myobject, x, y);
7
diminish each time by a factor of 1.8
.[in] | pos | The input position to map |
[in] | map | The mapping to use |
[in] | v1 | A parameter used by the mapping (pass 0.0 if not used) |
[in] | v2 | A parameter used by the mapping (pass 0.0 if not used) |
Gets the animator source currently set.
This gets the current animator source.
void ecore_animator_source_set | ( | Ecore_Animator_Source | source | ) |
Sets the source of the animator ticks for the mainloop.
This sets the source of the animator ticks. When an animator is active the mainloop will "tick" over frame by frame calling all animators that are registered until none are left. The mainloop ticks at a given rate based on the animator source. The default source is the system clock timer source - ECORE_ANIMATOR_SOURCE_TIMER
. This source uses the system clock to tick over every N seconds (specified by ecore_animator_frametime_set(), with the default being 1/30th of a second unless set otherwise). You can set a custom tick source by setting the source to ECORE_ANIMATOR_SOURCE_CUSTOM
and then driving it yourself based on some input tick source (like another application via ipc, some vertical blanking interrupt and so on) using ecore_animator_custom_source_tick_begin_callback_set() and ecore_animator_custom_source_tick_end_callback_set() to set the functions that are called to start and stop the ticking source, which when gets a "tick" should call ecore_animator_custom_tick() to make the "tick" over 1
frame.
[in] | source | The source of the animator ticks to use |
void ecore_animator_thaw | ( | Ecore_Animator * | animator | ) |
Restores execution of the specified animator.
[in] | animator | The animator to delete |
Ecore_Animator* ecore_animator_timeline_add | ( | double | runtime, |
Ecore_Timeline_Cb | func, | ||
const void * | data | ||
) |
Adds an animator that runs for a limited time.
This function is just like ecore_animator_add() except that the animator only runs for a limited time specified in seconds by runtime. Once the runtime of the animator has elapsed (animator finished) it is automatically deleted. The callback function func can return ECORE_CALLBACK_RENEW
to keep the animator running or ECORE_CALLBACK_CANCEL
to stop it and have it deleted automatically at any time.
0.0
to 1.0
to indicate where along the timeline (0.0
for start, 1.0
for end) is the animator run at. If the callback wishes not to have a linear transition it can "map" this value to one of the several curves and mappings via ecore_animator_pos_map().[in] | runtime | The time to run in seconds |
[in] | func | The function to call when it ticks off |
[in] | data | The data to pass to the function |