Transit is designed to apply various animated transition effects to
Evas_Object
, such like translation, rotation, etc. For using these
effects, create a Transit
and add the desired transition effects.
Once the effects are added into transit, they will be automatically managed (their callback will be called for the set duration and they will be deleted upon completion).
Example:
from efl.elementary.transit import Transit, ELM_TRANSIT_TWEEN_MODE_DECELERATE
t = Transit()
t.object_add(obj)
t.effect_translation_add(0, 0, 280, 280)
t.duration = 1
t.auto_reverse = True
t.tween_mode = ELM_TRANSIT_TWEEN_MODE_DECELERATE
t.repeat_times = 3
Some transition effects are used to change the properties of objects. They are:
effect_translation_add()
effect_color_add()
effect_rotation_add()
effect_wipe_add()
effect_zoom_add()
effect_resizing_add()
Other transition effects are used to make one object disappear and another object appear on its place. These effects are:
It’s also possible to make a transition chain with
chain_transit_add()
.
Warning
We strongly recommend to use elm_transit just when edje can not do the trick. Edje is better at handling transitions than Elm_Transit. Edje has more flexibility and animations can be manipulated inside the theme.
efl.elementary.
ELM_TRANSIT_EFFECT_FLIP_AXIS_X
¶Flip on X axis
efl.elementary.
ELM_TRANSIT_EFFECT_FLIP_AXIS_Y
¶Flip on Y axis
efl.elementary.
ELM_TRANSIT_EFFECT_WIPE_DIR_LEFT
¶Wipe to the left
efl.elementary.
ELM_TRANSIT_EFFECT_WIPE_DIR_RIGHT
¶Wipe to the right
efl.elementary.
ELM_TRANSIT_EFFECT_WIPE_DIR_UP
¶Wipe up
efl.elementary.
ELM_TRANSIT_EFFECT_WIPE_DIR_DOWN
¶Wipe down
efl.elementary.
ELM_TRANSIT_EFFECT_WIPE_TYPE_HIDE
¶Hide the object during the animation.
efl.elementary.
ELM_TRANSIT_EFFECT_WIPE_TYPE_SHOW
¶Show the object during the animation.
efl.elementary.
ELM_TRANSIT_TWEEN_MODE_LINEAR
¶Constant speed
efl.elementary.
ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL
¶Starts slow, increase speed over time, then decrease again and stop slowly
efl.elementary.
ELM_TRANSIT_TWEEN_MODE_DECELERATE
¶Starts fast and decrease speed over time
efl.elementary.
ELM_TRANSIT_TWEEN_MODE_ACCELERATE
¶Starts slow and increase speed over time
efl.elementary.
ELM_TRANSIT_TWEEN_MODE_DIVISOR_INTERP
¶Start at gradient v1, interpolated via power of v2 curve
New in version 1.13.
efl.elementary.
ELM_TRANSIT_TWEEN_MODE_BOUNCE
¶Start at 0.0 then “drop” like a ball bouncing to the ground at 1.0, and bounce v2 times, with decay factor of v1
New in version 1.13.
efl.elementary.
ELM_TRANSIT_TWEEN_MODE_SPRING
¶Start at 0.0 then “wobble” like a spring rest position 1.0, and wobble v2 times, with decay factor of v1
New in version 1.13.
efl.elementary.
ELM_TRANSIT_TWEEN_MODE_BEZIER_CURVE
¶Follow the cubic-bezier curve calculated with the control points (x1, y1), (x2, y2)
New in version 1.13.
efl.elementary.
Transit
(*args, **kwargs)¶Bases: object
Note
It is not necessary to delete the transit object, it will be deleted at the end of its operation.
Note
The transit will start playing when the program enters the main loop.
Parameters: | **kwargs – All the remaining keyword arguments are interpreted as properties of the instance |
---|
auto_reverse
¶If auto reverse is set, after running the effects with the progress parameter from 0 to 1, it will call the effects again with the progress from 1 to 0.
The transit will last for a time equal to (2 * duration * repeat),
where the duration was set with the function elm_transit_add and
the repeat with the function repeat_times
.
Type: | bool |
---|
chain_transit_add
(chain_transit)¶Makes the chain relationship between two transits.
This function adds chain_transit
transition to a chain after the
transit
, and will be started as soon as transit
ends.
Note
chain_transit
can not be None. Chain transits could be
chained to the only one transit.
Parameters: | chain_transit – The chain transit object. This transit will be operated after transit is done. |
---|
chain_transit_del
(chain_transit)¶Cut off the chain relationship between two transits.
This function removes the chain_transit
transition from the
transit
.
Note
chain_transit
can not be None. Chain transits should be
chained to the transit
.
Parameters: | chain_transit – The chain transit object. |
---|
chain_transits
¶Get the current chain transit list.
Type: | list |
---|
del_cb_set
(func, *args, **kwargs)¶Set the user-callback function when the transit is deleted.
Note
Using this function twice will overwrite the first function set.
Note
the transit
object will be deleted after call func
function.
Parameters: |
|
---|
delete
()¶Stops the animation and delete the transit
object.
Call this function if you want to stop the animation before the
transit time. Make sure the transit
object is still alive with
del_cb_set()
function. All added effects will be deleted,
calling its respective data_free_cb functions. The function set by
del_cb_set()
will be called.
duration
¶Set the transit animation time
Type: | float |
---|
effect_add
(effect)¶Add a new effect to the transit.
Example:
class MyEffect(TransitCustomEffect):
# define your methods...
t = Transit()
e = MyEffect()
t.effect_add(e)
Warning
The transit will free the context data at the and of the transition with the data_free_cb function. Do not share the context data in between different transit objects.
Note
The cb function and the data are the key to the effect. If you try to add an existing effect, nothing is done.
Note
After the first addition of an effect to transit
, if its
effect list become empty again, the transit
will be killed by
delete()
function.
Parameters: | effect – The context data of the effect. |
---|
effect_blend_add
()¶Add the Blend Effect to Elm_Transit.
Note
This API is one of the facades. It creates blend effect context and add it’s required APIs to elm_transit_effect_add.
Note
This effect is applied to each pair of objects in the order they are listed in the transit list of objects. The first object in the pair will be the “before” object and the second will be the “after” object.
See also
Returns: | Blend effect context data. |
---|---|
Return type: | Elm_Transit_Effect |
Warning
It is highly recommended just create a transit with this effect when the window that the objects of the transit belongs has already been created. This is because this effect needs the color information about the objects, and if the window was not created yet, it can get a wrong information.
effect_color_add
(from_r, from_g, from_b, from_a, to_r, to_g, to_b, to_a)¶Add the Color Effect to Elm_Transit.
Note
This API is one of the facades. It creates color effect context and add it’s required APIs to elm_transit_effect_add.
See also
Parameters: |
|
---|---|
Returns: | Color effect context data. |
Return type: | Elm_Transit_Effect |
effect_del
(effect)¶Delete an added effect.
This function will remove the effect from the transit
, calling the
data_free_cb to free the data
.
See also
Note
If the effect is not found, nothing is done.
Note
If the effect list become empty, this function will call
elm_transit_del(transit), i.e., it will kill the transit
.
Parameters: | effect – The context data of the effect. |
---|
effect_fade_add
()¶Add the Fade Effect to Elm_Transit.
Note
This API is one of the facades. It creates fade effect context and add it’s required APIs to elm_transit_effect_add.
Note
This effect is applied to each pair of objects in the order they are listed in the transit list of objects. The first object in the pair will be the “before” object and the second will be the “after” object.
See also
Returns: | Fade effect context data. |
---|---|
Return type: | Elm_Transit_Effect |
Warning
It is highly recommended just create a transit with this effect when the window that the objects of the transit belongs has already been created. This is because this effect needs the color information about the objects, and if the window was not created yet, it can get a wrong information.
effect_flip_add
(axis, cw)¶Add the Flip Effect to Elm_Transit.
Note
This API is one of the facades. It creates flip effect context and add it’s required APIs to elm_transit_effect_add.
Note
This effect is applied to each pair of objects in the order they are listed in the transit list of objects. The first object in the pair will be the “front” object and the second will be the “back” object.
See also
Parameters: |
|
---|---|
Returns: | Flip effect context data. |
Return type: | Elm_Transit_Effect |
Warning
It is highly recommended just create a transit with this effect when the window that the objects of the transit belongs has already been created. This is because this effect needs the geometry information about the objects, and if the window was not created yet, it can get a wrong information.
effect_image_animation_add
(images)¶Add the ImageAnimation Effect to Elm_Transit.
Example:
t = Transit()
images = []
images.append("%s/images/icon_11.png" % PACKAGE_DATA_DIR)
images.append("%s/images/logo_small.png" % PACKAGE_DATA_DIR)
t.effect_image_animation_add(images)
Note
This API is one of the facades. It creates image animation
effect context and add it’s required APIs to
elm_transit_effect_add. The images
parameter is a list images
paths. This list and its contents will be deleted at the end of
the effect by elm_transit_effect_image_animation_context_free()
function.
See also
Parameters: | images (list) – A list of images file paths. This list and its contents will be deleted at the end of the effect by elm_transit_effect_image_animation_context_free() function. |
---|---|
Returns: | Image Animation effect context data. |
Return type: | Elm_Transit_Effect |
effect_resizable_flip_add
(axis, cw)¶Add the Resizeable Flip Effect to Elm_Transit.
Note
This API is one of the facades. It creates resizable flip effect context and add it’s required APIs to elm_transit_effect_add.
Note
This effect is applied to each pair of objects in the order they are listed in the transit list of objects. The first object in the pair will be the “front” object and the second will be the “back” object.
See also
Parameters: |
|
---|---|
Returns: | Resizeable flip effect context data. |
Return type: | Elm_Transit_Effect |
Warning
It is highly recommended just create a transit with this effect when the window that the objects of the transit belongs has already been created. This is because this effect needs the geometry information about the objects, and if the window was not created yet, it can get a wrong information.
effect_resizing_add
(from_w, from_h, to_w, to_h)¶Add the Resizing Effect to Elm_Transit.
Note
This API is one of the facades. It creates resizing effect context and adds its required APIs to elm_transit_effect_add.
See also
Parameters: |
|
---|---|
Returns: | Resizing effect context data. |
Return type: | Elm_Transit_Effect |
effect_rotation_add
(from_degree, to_degree)¶Add the Rotation Effect to Elm_Transit.
Note
This API is one of the facades. It creates rotation effect context and add it’s required APIs to elm_transit_effect_add.
See also
Parameters: |
|
---|---|
Returns: | Rotation effect context data. |
Return type: | Elm_Transit_Effect |
Warning
It is highly recommended just create a transit with this effect when the window that the objects of the transit belongs has already been created. This is because this effect needs the geometry information about the objects, and if the window was not created yet, it can get a wrong information.
effect_translation_add
(from_dx, from_dy, to_dx, to_dy)¶Add the Translation Effect to Elm_Transit.
Note
This API is one of the facades. It creates translation effect context and adds its required APIs to elm_transit_effect_add.
See also
Parameters: |
|
---|---|
Returns: | Translation effect context data. |
Return type: | Elm_Transit_Effect |
Warning
It is highly recommended just create a transit with this effect when the window that the objects of the transit belongs has already been created. This is because this effect needs the geometry information about the objects, and if the window was not created yet, it can get a wrong information.
effect_wipe_add
(wipe_type, wipe_dir)¶Add the Wipe Effect to Elm_Transit.
Note
This API is one of the facades. It creates wipe effect context and add it’s required APIs to elm_transit_effect_add.
See also
Parameters: |
|
---|---|
Returns: | Wipe effect context data. |
Return type: | Elm_Transit_Effect |
Warning
It is highly recommended just create a transit with this effect when the window that the objects of the transit belongs has already been created. This is because this effect needs the geometry information about the objects, and if the window was not created yet, it can get a wrong information.
effect_zoom_add
(from_rate, to_rate)¶Add the Zoom Effect to Elm_Transit.
Note
This API is one of the facades. It creates zoom effect context and adds its required APIs to elm_transit_effect_add.
See also
Parameters: |
|
---|---|
Returns: | Zoom effect context data. |
Return type: | Elm_Transit_Effect |
Warning
It is highly recommended just create a transit with this effect when the window that the objects of the transit belongs has already been created. This is because this effect needs the geometry information about the objects, and if the window was not created yet, it can get a wrong information.
event_enabled
¶Set the event enabled when transit is operating.
If enabled
is True, the objects of the transit will receive
events from mouse and keyboard during the animation.
Note
When you add an object with object_add()
, its
state from evas_object_freeze_events_get(obj) is saved, and it is
applied when the transit ends. If you change this state with
evas_object_freeze_events_set() after adding the object, this
state will change again when transit
stops to run.
Type: | bool |
---|
go
()¶Starts the transition. Once this API is called, the transit begins to measure the time.
go_in
(seconds)¶Starts the transition in given seconds.
Parameters: | seconds (float) – The interval value in seconds |
---|
New in version 1.14.
object_add
(obj)¶Add new object to apply the effects.
Note
After the first addition of an object to transit
, if its
object list become empty again, the transit
will be killed by
elm_transit_del(transit) function.
Note
If the obj
belongs to another transit, the obj
will be
removed from it and it will only belong to the other transit
.
If the old transit stays without objects, it will die.
Note
When you add an object into the transit
, its state from
evas_object_pass_events_get(obj) is saved, and it is applied
when the transit ends, if you change this state with
evas_object_pass_events_set() after add the object, this state
will change again when transit
stops.
Parameters: | obj – Object to be animated. |
---|
Warning
It is not allowed to add a new object after transit begins.
object_remove
(obj)¶Removes an added object from the transit.
Note
If the obj
is not in the transit
, nothing is done.
Note
If the list become empty, this function will call
transit.delete(), i.e., it will kill the transit
.
Parameters: | obj – Object to be removed from transit . |
---|
Warning
It is not allowed to remove objects after transit begins.
objects
¶The objects of the transit.
type: list
objects_final_state_keep
¶Enable/disable keeping up the objects states.
If it is not kept, the objects states will be reset when transition ends.
Note
One state includes geometry, color, map data.
Type: | bool |
---|
paused
¶Pause/Resume the transition.
If you call elm_transit_go again, the transit will be started from the beginning, and will be played.
Type: | bool |
---|
progress_value
¶Get the time progression of the animation (a double value between 0.0 and 1.0).
The value returned is a fraction (current time / total time). It represents the progression position relative to the total.
Type: | float |
---|
repeat_times
¶The transit repeat count. Effect will be repeated by repeat count.
This property reflects the number of repetition the transit will run
after the first one, i.e., if repeat
is 1, the transit will run 2
times. If the repeat
is a negative number, it will repeat
infinite times.
Note
If this function is called during the transit execution, the
transit will run repeat
times, ignoring the times it already
performed.
Type: | int |
---|
revert
()¶This can be used to reverse play an ongoing transition.
It shows effect only when an animation is going on. If this function is called twice transition will go in forward direction as normal one. If a repeat count is set, this function call will revert just the ongoing cycle and once it is reverted back completely, the transition will go in forward direction. If an autoreverse is set for the transition and this function is called in the midst of the transition the ongoing transition will be reverted and once it is done, the transition will begin again and complete a full auto reverse cycle.
Returns: | True if the transition is reverted, False otherwise. |
---|---|
Return type: | bool |
New in version 1.18.
smooth
¶Smooth effect for a transit.
This sets smoothing for transit map rendering. If the object added in a transit is a type that has its own smoothing settings, then both the smooth settings for this object and the map must be turned off. By default smooth maps are enabled.
Type: | bool |
---|---|
See: | efl.evas.Map.smooth |
New in version 1.8.
smooth_get
()¶smooth_set
(smooth)¶tween_mode
¶The transit animation acceleration type.
Type: | Transit tween mode |
---|
tween_mode_factor
¶Transit animation acceleration factor.
If you use the below tween modes, you have to set the factor using this API.
Type: | (float v1, float v2) (defaults are 1.0, 0.0) |
---|
See also
New in version 1.8.
tween_mode_factor_get
()¶tween_mode_factor_n
¶Set the transit animation acceleration factors.
This is the same as tween_mode_factor
, but lets you
specify more than 2 values. Actually only need for the
ELM_TRANSIT_TWEEN_MODE_BEZIER_CURVE mode.
Type: | list of doubles |
---|
See also
New in version 1.13.
tween_mode_factor_n_set
(values)¶tween_mode_factor_set
(v1, v2)¶