Hi. 

Even it looks somewhat alien elm, 

I hope EFL supports basic effect by using c and edc.

In some cases, it is useful for app developers. 
They want to use effects easily and quickly as Other F/W does providing. 

Here is patch again.

Added two lines for elm_transit_duration_set exception handling. 

I guess there are possibilities still to add/modify some functions to the
transit. 
So, currently the exception cases does not defined yet. 

But I will try patches soon as perfect things.

Please consider about transit.  

And..  if this transit is acceptable, 
How about deprecate elm_animator as soon as possible? 

Thanks. 

-----Original Message-----
From: Carsten Haitzler (The Rasterman) [mailto:ras...@rasterman.com] 
Sent: Thursday, January 06, 2011 1:37 AM
To: Gustavo Sverzut Barbieri
Cc: ChunEon Park; enlightenment-devel@lists.sourceforge.net
Subject: Re: [E-devel] [PATCH] elm_transit

On Wed, 5 Jan 2011 12:48:05 -0200 Gustavo Sverzut Barbieri
<barbi...@profusion.mobi> said:

> On Wed, Jan 5, 2011 at 12:27 PM, ChunEon Park <chuneon.p...@samsung.com>
> wrote:
> > Good day, this is Hermet.
> >
> > Here is elm_transit patch.
> >
> > - Modified elm_transit_add(double duration) to elm_transit_add()
> > - Added elm_transit_duration_set() / elm_transit_duration_get() APIs
> > - Added elm_transit_go API
> 
> Modifying the duration of an ongoing animation is tricky, what do you
> do to avoid things going weirdly?  Let's say you're at 0.5 of an 1.0
> second (progress = 50%), then you reset it to 2.0 second, you're now
> back in progress to 25%.
> 
> I'm also strongly against _go() apis. They do not need to exist, as
> they don't for all but elm_list, which is there for an optimization
> hack which I dislike every time i have to type them.

in this case transit is a time based thing - when does it start its
animation?
you can do a lot of set-up before you start it and thus there is a good
reason
for being able to separate the starting of the transition from its setup. as
for setting the duration - not weird - not more weird than the adding ofthe
objects. if you stand back and look at it, transit is much like an object -
u
create it then set up a whole bunch of properties (basically a transition
pipeline) and then say "go". there is no good reason why it shouldn't be
expanded to allow chained transitions. eg transition from A to B, then B to
C,
then C to D - and thus there would be a good case for each leg of the
transition to have its own timeframe - thus a set call for setting the
transition duration. again - this also makes the go() call almost a must as
at
what point would you start that transition - and for that matter if you have
a
fairly lengthy and complex transition you do often you may want to repeat it
again and again (call go to start it each time).

-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    ras...@rasterman.com
Index: src/lib/elm_transit.c
===================================================================
--- src/lib/elm_transit.c       (revision 55925)
+++ src/lib/elm_transit.c       (working copy)
@@ -30,13 +30,14 @@
  *
  * Example:
  * @code
- * Elm_Transit *trans = elm_transit_add(5.0);
+ * Elm_Transit *trans = elm_transit_add();
  * elm_transit_object_add(trans, obj);
  * void *effect_context = elm_transit_effect_translation_context_new(0.0, 0.0,
  *                                                               280.0, 280.0);
  * elm_transit_effect_add(transit,
  *                        elm_transit_effect_translation_op, effect_context,
  *                        elm_transit_effect_translation_context_free);
+ * elm_transit_duration_set(transit, 5);
  * elm_transit_auto_reverse_set(transit, EINA_TRUE);
  * elm_transit_tween_mode_set(transit, ELM_TRANSIT_TWEEN_MODE_DECELERATE);
  * elm_transit_repeat_times_set(transit, -1);
@@ -263,23 +264,17 @@
  * @ingroup Transit
  */
 EAPI Elm_Transit *
-elm_transit_add(double duration)
+elm_transit_add()
 {
    Elm_Transit *transit = ELM_NEW(Elm_Transit);
-   
    if (!transit) return NULL;
    
    EINA_MAGIC_SET(transit, ELM_TRANSIT_MAGIC);
 
    elm_transit_tween_mode_set(transit, ELM_TRANSIT_TWEEN_MODE_LINEAR);
        
-   transit->time.duration = duration;
-   transit->time.begin = ecore_loop_time_get();
-   transit->animator = ecore_animator_add(_animator_animate_cb, transit);
-
    return transit;
 }
-
 /**
  * Stops the animation and delete the @p transit object.
  *
@@ -316,7 +311,7 @@
  *
  * Exemple:
  * @code
- * Elm_Transit *transit = elm_transit_add(5.0);
+ * Elm_Transit *transit = elm_transit_add();
  * elm_transit_effect_add(transit,
  *                        elm_transit_effect_blend_op,
  *                        elm_transit_effect_blend_context_new(),
@@ -741,6 +736,64 @@
    return transit->tween_mode;
 }
 
+/**
+ * Set the transit animation time
+ *
+ * @note @p transit can not be NULL
+ *
+ * @param transit The transit object.
+ * @param duration The animation time.
+ *
+ * @ingroup Transit
+ */
+EAPI void
+elm_transit_duration_set(Elm_Transit *transit, double duration)
+{
+   ELM_TRANSIT_CHECK_OR_RETURN(transit);
+   if(transit->animator) return;
+   transit->time.duration = duration;
+}
+
+/**
+ * Get the transit animation time
+ *
+ * @note @p transit can not be NULL
+ *
+ * @param transit The transit object.
+ *
+ * @return The transit animation time.
+ *
+ * @ingroup Transit
+ */
+EAPI double 
+elm_transit_duration_get(const Elm_Transit *transit)
+{
+   ELM_TRANSIT_CHECK_OR_RETURN(transit);
+   return transit->time.duration;
+}
+
+/**
+ * Starts the transition. 
+ * Once this API is called, the transit begins to measure the time.
+ *
+ * @note @p transit can not be NULL
+ *
+ * @param transit The transit object.
+ *
+ * @ingroup Transit
+ */
+EAPI void
+elm_transit_go(Elm_Transit *transit)
+{
+   ELM_TRANSIT_CHECK_OR_RETURN(transit);
+
+   if(transit->animator)
+      ecore_animator_del(transit->animator);
+
+   transit->time.begin = ecore_loop_time_get();
+   transit->animator = ecore_animator_add(_animator_animate_cb, transit);
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 //Resizing FX
 ///////////////////////////////////////////////////////////////////////////////
@@ -2496,7 +2549,7 @@
  * @code
  * char buf[PATH_MAX];
  * Eina_List *images = NULL;
- * Elm_Transit *transi = elm_transit_add(4.0);
+ * Elm_Transit *transi = elm_transit_add();
  *
  * snprintf(buf, sizeof(buf), "%s/images/icon_11.png", PACKAGE_DATA_DIR);
  * images = eina_list_append(images, eina_stringshare_add(buf));
Index: src/lib/Elementary.h.in
===================================================================
--- src/lib/Elementary.h.in     (revision 55925)
+++ src/lib/Elementary.h.in     (working copy)
@@ -2471,7 +2471,7 @@
 
    typedef struct _Elm_Transit Elm_Transit;
 
-   EAPI Elm_Transit           *elm_transit_add(double duration);
+   EAPI Elm_Transit           *elm_transit_add();
    EAPI void                   elm_transit_del(Elm_Transit *transit) 
EINA_ARG_NONNULL(1);
    EAPI void                   elm_transit_effect_add(Elm_Transit *transit, 
void (*cb)(void *data, Elm_Transit *transit, double progress), void *data, void 
(*data_free_cb)(void *data, Elm_Transit *transit)) EINA_ARG_NONNULL(1, 2);
    EAPI void                   elm_transit_effect_del(Elm_Transit *transit, 
void (*cb)(void *data, Elm_Transit *transit, double progress), void *data) 
EINA_ARG_NONNULL(1, 2);
@@ -2489,6 +2489,9 @@
    EAPI int                    elm_transit_repeat_times_get(Elm_Transit 
*transit) EINA_ARG_NONNULL(1);
    EAPI void                   elm_transit_tween_mode_set(Elm_Transit 
*transit, Elm_Transit_Tween_Mode tween_mode) EINA_ARG_NONNULL(1);
    EAPI Elm_Transit_Tween_Mode elm_transit_tween_mode_get(const Elm_Transit 
*transit) EINA_ARG_NONNULL(1) EINA_ARG_NONNULL(1);
+   EAPI void                   elm_transit_duration_set(Elm_Transit *transit, 
double duration) EINA_ARG_NONNULL(1); 
+   EAPI double                 elm_transit_duration_get(const Elm_Transit 
*transit) EINA_ARG_NONNULL(1);
+   EAPI void                   elm_transit_go(Elm_Transit *transit) 
EINA_ARG_NONNULL(1);
 
    EAPI void                  *elm_transit_effect_resizing_add(Elm_Transit* 
transit, Evas_Coord from_w, Evas_Coord from_h, Evas_Coord to_w, Evas_Coord 
to_h);
    EAPI void                  *elm_transit_effect_translation_add(Elm_Transit* 
transit, Evas_Coord from_dx, Evas_Coord dy, Evas_Coord to_dx, Evas_Coord to_dy);
Index: src/bin/test_transit.c
===================================================================
--- src/bin/test_transit.c      (revision 55925)
+++ src/bin/test_transit.c      (working copy)
@@ -34,11 +34,11 @@
      {
         h = custom_effect->from.h + custom_effect->to.h;
         w = custom_effect->from.w + \
-                                  (custom_effect->to.w * (progress - 0.5) * 2);
+            (custom_effect->to.w * (progress - 0.5) * 2);
      }
 
    EINA_LIST_FOREACH(objs, elist, obj)
-     evas_object_resize(obj, w, h);
+      evas_object_resize(obj, w, h);
 
 }
 
@@ -69,7 +69,7 @@
 {
    Elm_Transit *trans;
 
-   trans = elm_transit_add(5.0);
+   trans = elm_transit_add();
    elm_transit_object_add(trans, obj);
    elm_transit_auto_reverse_set(trans, EINA_TRUE);
    elm_transit_repeat_times_set(trans, 2);
@@ -82,6 +82,9 @@
 
    /* Rotation Effect */
    elm_transit_effect_rotation_add(trans, 0.0, 135.0, EINA_FALSE);
+
+   elm_transit_duration_set(trans, 5.0);
+   elm_transit_go(trans);
 }
 
 static void
@@ -89,13 +92,16 @@
 {
    Elm_Transit *trans;
 
-   trans = elm_transit_add(5.0);
+   trans = elm_transit_add();
    elm_transit_object_add(trans, obj);
    elm_transit_auto_reverse_set(trans, EINA_TRUE);
 
    elm_transit_effect_wipe_add(trans, 
                                ELM_TRANSIT_EFFECT_WIPE_TYPE_HIDE,
                                ELM_TRANSIT_EFFECT_WIPE_DIR_RIGHT);
+
+   elm_transit_duration_set(trans, 5.0);
+   elm_transit_go(trans);
 }
 
 static void
@@ -118,10 +124,13 @@
    snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
    images = eina_list_append(images, eina_stringshare_add(buf));
 
-   trans = elm_transit_add(5.0);
+   trans = elm_transit_add();
    elm_transit_object_add(trans, ic);
-   
+
    elm_transit_effect_image_animation_add(trans, images);
+
+   elm_transit_duration_set(trans, 5.0); 
+   elm_transit_go(trans);
 }
 
 static void
@@ -129,9 +138,13 @@
 {
    Elm_Transit *trans;
 
-   trans = elm_transit_add(5.0);
+   trans = elm_transit_add();
    elm_transit_object_add(trans, obj);   
+
    elm_transit_effect_resizing_add(trans, 100, 50, 300, 150);
+
+   elm_transit_duration_set(trans, 5.0);
+   elm_transit_go(trans);
 }
 
 static void
@@ -140,10 +153,14 @@
    Elm_Transit *trans;
    Evas_Object *obj2 = data;
 
-   trans = elm_transit_add(5.0);
+   trans = elm_transit_add();
    elm_transit_object_add(trans, obj);
    elm_transit_object_add(trans, obj2);
+
    elm_transit_effect_flip_add(trans, ELM_TRANSIT_EFFECT_FLIP_AXIS_X, 
EINA_TRUE);
+
+   elm_transit_duration_set(trans, 5.0);
+   elm_transit_go(trans);
 }
 
 static void
@@ -151,9 +168,13 @@
 {
    Elm_Transit *trans;
 
-   trans = elm_transit_add(5.0);
+   trans = elm_transit_add();
    elm_transit_object_add(trans, obj);
+
    elm_transit_effect_zoom_add(trans, 1.0, 3.0);
+
+   elm_transit_duration_set(trans, 5.0);
+   elm_transit_go(trans);
 }
 
 static void
@@ -162,10 +183,14 @@
    Elm_Transit *trans;
    Evas_Object *obj2 = data;
 
-   trans = elm_transit_add(5.0);
+   trans = elm_transit_add();
    elm_transit_object_add(trans, obj);
    elm_transit_object_add(trans, obj2);
+
    elm_transit_effect_blend_add(trans);
+
+   elm_transit_duration_set(trans, 5.0);
+   elm_transit_go(trans);
 }
 
 static void
@@ -174,10 +199,14 @@
    Elm_Transit *trans;
    Evas_Object *obj2 = data;
 
-   trans = elm_transit_add(5.0);
+   trans = elm_transit_add();
    elm_transit_object_add(trans, obj);
    elm_transit_object_add(trans, obj2);
+
    elm_transit_effect_fade_add(trans);
+
+   elm_transit_duration_set(trans, 5.0);
+   elm_transit_go(trans);
 }
 
 static void
@@ -186,10 +215,14 @@
    Elm_Transit *trans;
    Evas_Object *obj2 = data;
 
-   trans = elm_transit_add(5.0);
+   trans = elm_transit_add();
    elm_transit_object_add(trans, obj);
    elm_transit_object_add(trans, obj2);
+
    elm_transit_effect_resizable_flip_add(trans, 
ELM_TRANSIT_EFFECT_FLIP_AXIS_Y, EINA_TRUE);
+
+   elm_transit_duration_set(trans, 5.0);
+   elm_transit_go(trans);
 }
 
 /* Translation, Rotation, Color, Wipe, ImagemAnimation Effect */
@@ -433,7 +466,7 @@
    evas_object_show(bt);
    evas_object_move(bt, 50, 100);
    evas_object_resize(bt, 200, 30); 
-   
+
    bt2 = elm_button_add(win);
    elm_button_label_set(bt2, "Back Button - Resizable Flip Effect");
    evas_object_move(bt2, 50, 100);
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to