In this example we will figure out how to manipulate the animations on an Edje object.

After reading this document you will be able to manipulate the frametime, freeze, pause and stop, all animations on an Edje object.

To play with this example you will use the keyboard. Below are listed the keys and what each does.


\begin{DoxyItemize}
\item '+' Increase the frametime;
\item '-\/' Decrease the frametime;
\item '=' Prints the actual frametime and says if the animations is playing;
\item 'f' Freezes the animations in the Edje object;
\item 'F' Freezes the animations in all objects in the running program;
\item 't' Thaws the animations in the Edje object;
\item 'T' Thaws the animations in all objects in the running program;
\item 's' Pauses the animations;
\item 'p' Plays the animations previously stopped;
\item 'a' Starts the animation in the Edje object;
\item 'A' Stops the animations in the Edje object;
\end{DoxyItemize}

Now that we've explained how to use our example, we will see how it is made. Let's start by looking at the piece of code responsible to the actions commented above.  
\begin{DoxyCodeInclude}
\_on\_key\_down(\textcolor{keywordtype}{void} *data EINA\_UNUSED, \hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas} *evas EINA\_UNUSED, \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *obj, \textcolor{keywordtype}{void} *
      event\_info)
\{
   \hyperlink{struct__Evas__Event__Key__Down}{Evas\_Event\_Key\_Down} *ev;
   \textcolor{keywordtype}{double}               ft;

   ev = (\hyperlink{struct__Evas__Event__Key__Down}{Evas\_Event\_Key\_Down} *)event\_info;

   \textcolor{keywordflow}{if} (!strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"h"}))
     \{
        fprintf(stdout, commands);
        \textcolor{keywordflow}{return};
     \}
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"plus"}))
     \{
        frametime *= 2.0;
        fprintf(stdout, \textcolor{stringliteral}{"Increasing frametime to: %f\(\backslash\)n"}, frametime);
        \hyperlink{group__Edje__Object__Animation_gac9b19ee918546740c0144904393a1acd}{edje\_frametime\_set}(frametime);
     \}
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"minus"}))
     \{
        frametime /= 2.0;
        fprintf(stdout, \textcolor{stringliteral}{"Decreasing frametime to: %f\(\backslash\)n"}, frametime);
        \hyperlink{group__Edje__Object__Animation_gac9b19ee918546740c0144904393a1acd}{edje\_frametime\_set}(frametime);
     \}
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"equal"}))
     \{
        ft = \hyperlink{group__Edje__Object__Animation_gad9593e50d1d5bc847e9b34b104c83935}{edje\_frametime\_get}();
        fprintf(stdout, \textcolor{stringliteral}{"Frametime: %f\(\backslash\)n"}, ft);
        \textcolor{keywordflow}{if} (edje\_object\_play\_get(obj))
          fprintf(stdout, \textcolor{stringliteral}{"Object is playing\(\backslash\)n"});
        \textcolor{keywordflow}{else}
          fprintf(stdout, \textcolor{stringliteral}{"Object was paused\(\backslash\)n"});
        \textcolor{keywordflow}{if} (edje\_object\_animation\_get(obj))
          fprintf(stdout, \textcolor{stringliteral}{"Animation is running\(\backslash\)n"});
        \textcolor{keywordflow}{else}
          fprintf(stdout, \textcolor{stringliteral}{"Animation was stopped\(\backslash\)n"});
     \}
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"s"}))
     \{
        edje\_object\_play\_set(obj, \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE});
        fprintf(stdout, \textcolor{stringliteral}{"Pausing the object\(\backslash\)n"});
     \}
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"p"}))
     \{
        edje\_object\_play\_set(obj, \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE});
        fprintf(stdout, \textcolor{stringliteral}{"Playing the object\(\backslash\)n"});
     \}
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"f"}))
       fprintf(stdout, \textcolor{stringliteral}{"Freezing object. Count: %d\(\backslash\)n"}, edje\_object\_freeze(obj));
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"t"}))
       fprintf(stdout, \textcolor{stringliteral}{"Thawing object. Count: %d\(\backslash\)n"}, edje\_object\_thaw(obj));
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"F"}))
     \{
        \hyperlink{group__Edje__Object__Animation_ga8f4779b06ca82ab279cecfafe4bf6149}{edje\_freeze}();
        fprintf(stdout, \textcolor{stringliteral}{"Freezing all objects\(\backslash\)n"});
     \}
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"T"}))
     \{
        \hyperlink{group__Edje__Object__Animation_ga1963a864ac582582780dcbf3db3a4e45}{edje\_thaw}();
        fprintf(stdout, \textcolor{stringliteral}{"Thawing all objects\(\backslash\)n"});
     \}
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"a"}))
     \{
        edje\_object\_animation\_set(obj, \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE});
        fprintf(stdout, \textcolor{stringliteral}{"Starting the animation in the Edje object\(\backslash\)n"});
     \}
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"A"}))
     \{
        edje\_object\_animation\_set(obj, \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE});
        fprintf(stdout, \textcolor{stringliteral}{"Stopping the animation in the Edje object\(\backslash\)n"});
     \}
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"Escape"}))
     \hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}();
   \textcolor{keywordflow}{else}
     \{
        printf(\textcolor{stringliteral}{"unhandled key: %s\(\backslash\)n"}, ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key});
        fprintf(stdout, commands);
     \}

\end{DoxyCodeInclude}
 \begin{DoxyNote}{Note}
The actions for the keys 'f' and 'F' will have the same effect in our example, just because there is only one object in the running program, The same happens with the keys 't' and 'T'.
\end{DoxyNote}
As you may have seen these set of functions are pretty easy to handle. The other important part of this example is the E\+D\+C file. The animations used in the code were created there  
\begin{DoxyCodeInclude}
      program \{
         signal: \textcolor{stringliteral}{"load"};
         source: \textcolor{stringliteral}{""};
         in: 2.0 0.0;
         after: \textcolor{stringliteral}{"animation,state1"};
      \}
      program \{
         name: \textcolor{stringliteral}{"animation,state1"};
         signal: \textcolor{stringliteral}{"animation,start"};
         source: \textcolor{stringliteral}{""};
         in: 1.0 0.0;
         action: STATE\_SET \textcolor{stringliteral}{"invert"} 1.0;
         target: \textcolor{stringliteral}{"part\_one"};
         target: \textcolor{stringliteral}{"part\_two"};
         target: \textcolor{stringliteral}{"part\_three"};
         transition: LINEAR 0.6;
         after: \textcolor{stringliteral}{"animation,state2"};
      \}
      program \{
         name: \textcolor{stringliteral}{"animation,state2"};
         signal: \textcolor{stringliteral}{"animation,start"};
         source: \textcolor{stringliteral}{""};
         in: 1.0 0.0;
         action: STATE\_SET \textcolor{stringliteral}{"default"} 0.0;
         target: \textcolor{stringliteral}{"part\_one"};
         target: \textcolor{stringliteral}{"part\_two"};
         target: \textcolor{stringliteral}{"part\_three"};
         transition: LINEAR 0.6;
         after: \textcolor{stringliteral}{"animation,state1"};
   \}
\}

\end{DoxyCodeInclude}


The example's window should look like this picture\+:

  
\begin{DoxyImage}
\includegraphics{edje-animations}
\caption{width=}
\end{DoxyImage}
 ~\newline
   
\begin{DoxyImage}
\includegraphics{edje-animations2}
\caption{width=}
\end{DoxyImage}


The full example follows.


\begin{DoxyCodeInclude}

\textcolor{preprocessor}{#ifdef HAVE\_CONFIG\_H}
\textcolor{preprocessor}{# include "config.h"}
\textcolor{preprocessor}{#else}
\textcolor{preprocessor}{# define EINA\_UNUSED}
\textcolor{preprocessor}{#endif}

\textcolor{preprocessor}{#ifndef PACKAGE\_DATA\_DIR}
\textcolor{preprocessor}{#define PACKAGE\_DATA\_DIR "."}
\textcolor{preprocessor}{#endif}

\textcolor{preprocessor}{#include <Ecore.h>}
\textcolor{preprocessor}{#include <\hyperlink{Ecore__Evas_8h}{Ecore\_Evas.h}>}
\textcolor{preprocessor}{#include <\hyperlink{Edje_8h}{Edje.h}>}

\textcolor{preprocessor}{#define WIDTH  (400)}
\textcolor{preprocessor}{#define HEIGHT (300)}

\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} commands[] = \(\backslash\)
  \textcolor{stringliteral}{"commands are:\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)t+ - increase frametime\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)t- - decrease frametime\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)t= - status of the animation\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)ts - pause\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tp - play\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tf - freeze one object\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tF - freeze all objects\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tt - thaw one object\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tT - thaw all objects\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)ta - start animation of one object\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tA - stop animation of one object\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tEsc - exit\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)th - print help\(\backslash\)n"};

\textcolor{keyword}{static} \textcolor{keywordtype}{double} frametime = 1.0 / 30.0; \textcolor{comment}{/* default value */}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_on\_delete\_cb(Ecore\_Evas *ee EINA\_UNUSED)
\{
    \hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}();
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_on\_canvas\_resize(Ecore\_Evas *ee)
\{
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *bg;
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *edje\_obj;
   \textcolor{keywordtype}{int}          w;
   \textcolor{keywordtype}{int}          h;

   bg = \hyperlink{group__Ecore__Evas__Group_gae00d4a4feb8aec5de03e464fe21a1d30}{ecore\_evas\_data\_get}(ee, \textcolor{stringliteral}{"background"});
   edje\_obj = \hyperlink{group__Ecore__Evas__Group_gae00d4a4feb8aec5de03e464fe21a1d30}{ecore\_evas\_data\_get}(ee, \textcolor{stringliteral}{"edje\_obj"});
   \hyperlink{group__Ecore__Evas__Group_ga931aadf4603731e73e8a84e4b14f1493}{ecore\_evas\_geometry\_get}(ee, NULL, NULL, &w, &h);
   evas\_object\_resize(bg, w, h);
   evas\_object\_resize(edje\_obj, w, h);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_on\_key\_down(\textcolor{keywordtype}{void} *data EINA\_UNUSED, \hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas} *evas EINA\_UNUSED, \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *obj, \textcolor{keywordtype}{void} *
      event\_info)
\{
   \hyperlink{struct__Evas__Event__Key__Down}{Evas\_Event\_Key\_Down} *ev;
   \textcolor{keywordtype}{double}               ft;

   ev = (\hyperlink{struct__Evas__Event__Key__Down}{Evas\_Event\_Key\_Down} *)event\_info;

   \textcolor{keywordflow}{if} (!strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"h"}))
     \{
        fprintf(stdout, commands);
        \textcolor{keywordflow}{return};
     \}
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"plus"}))
     \{
        frametime *= 2.0;
        fprintf(stdout, \textcolor{stringliteral}{"Increasing frametime to: %f\(\backslash\)n"}, frametime);
        \hyperlink{group__Edje__Object__Animation_gac9b19ee918546740c0144904393a1acd}{edje\_frametime\_set}(frametime);
     \}
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"minus"}))
     \{
        frametime /= 2.0;
        fprintf(stdout, \textcolor{stringliteral}{"Decreasing frametime to: %f\(\backslash\)n"}, frametime);
        \hyperlink{group__Edje__Object__Animation_gac9b19ee918546740c0144904393a1acd}{edje\_frametime\_set}(frametime);
     \}
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"equal"}))
     \{
        ft = \hyperlink{group__Edje__Object__Animation_gad9593e50d1d5bc847e9b34b104c83935}{edje\_frametime\_get}();
        fprintf(stdout, \textcolor{stringliteral}{"Frametime: %f\(\backslash\)n"}, ft);
        \textcolor{keywordflow}{if} (edje\_object\_play\_get(obj))
          fprintf(stdout, \textcolor{stringliteral}{"Object is playing\(\backslash\)n"});
        \textcolor{keywordflow}{else}
          fprintf(stdout, \textcolor{stringliteral}{"Object was paused\(\backslash\)n"});
        \textcolor{keywordflow}{if} (edje\_object\_animation\_get(obj))
          fprintf(stdout, \textcolor{stringliteral}{"Animation is running\(\backslash\)n"});
        \textcolor{keywordflow}{else}
          fprintf(stdout, \textcolor{stringliteral}{"Animation was stopped\(\backslash\)n"});
     \}
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"s"}))
     \{
        edje\_object\_play\_set(obj, \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE});
        fprintf(stdout, \textcolor{stringliteral}{"Pausing the object\(\backslash\)n"});
     \}
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"p"}))
     \{
        edje\_object\_play\_set(obj, \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE});
        fprintf(stdout, \textcolor{stringliteral}{"Playing the object\(\backslash\)n"});
     \}
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"f"}))
       fprintf(stdout, \textcolor{stringliteral}{"Freezing object. Count: %d\(\backslash\)n"}, edje\_object\_freeze(obj));
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"t"}))
       fprintf(stdout, \textcolor{stringliteral}{"Thawing object. Count: %d\(\backslash\)n"}, edje\_object\_thaw(obj));
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"F"}))
     \{
        \hyperlink{group__Edje__Object__Animation_ga8f4779b06ca82ab279cecfafe4bf6149}{edje\_freeze}();
        fprintf(stdout, \textcolor{stringliteral}{"Freezing all objects\(\backslash\)n"});
     \}
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"T"}))
     \{
        \hyperlink{group__Edje__Object__Animation_ga1963a864ac582582780dcbf3db3a4e45}{edje\_thaw}();
        fprintf(stdout, \textcolor{stringliteral}{"Thawing all objects\(\backslash\)n"});
     \}
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"a"}))
     \{
        edje\_object\_animation\_set(obj, \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE});
        fprintf(stdout, \textcolor{stringliteral}{"Starting the animation in the Edje object\(\backslash\)n"});
     \}
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"A"}))
     \{
        edje\_object\_animation\_set(obj, \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE});
        fprintf(stdout, \textcolor{stringliteral}{"Stopping the animation in the Edje object\(\backslash\)n"});
     \}
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"Escape"}))
     \hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}();
   \textcolor{keywordflow}{else}
     \{
        printf(\textcolor{stringliteral}{"unhandled key: %s\(\backslash\)n"}, ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key});
        fprintf(stdout, commands);
     \}
\}

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{int} argc EINA\_UNUSED, \textcolor{keywordtype}{char} *argv[] EINA\_UNUSED)
\{
   \textcolor{keyword}{const} \textcolor{keywordtype}{char}  *edje\_file = PACKAGE\_DATA\_DIR\textcolor{stringliteral}{"/animations.edj"};
   Ecore\_Evas  *ee;
   \hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}        *evas;
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *bg;
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *edje\_obj;

   \textcolor{keywordflow}{if} (!\hyperlink{group__Ecore__Evas__Group_ga32ddbb6457033ad435a177eb0c4fe235}{ecore\_evas\_init}())
     \textcolor{keywordflow}{return} EXIT\_FAILURE;

   \textcolor{keywordflow}{if} (!\hyperlink{group__Edje__General__Group_ga1c9c6594f38023c29fbfb2d0c8c675db}{edje\_init}())
     \textcolor{keywordflow}{goto} shutdown\_ecore\_evas;

   \textcolor{comment}{/* this will give you a window with an Evas canvas under the first}
\textcolor{comment}{    * engine available */}
   ee = \hyperlink{group__Ecore__Evas__Group_gac7f2cdbcb79635c34317c1183dd04cb0}{ecore\_evas\_new}(NULL, 0, 0, WIDTH, HEIGHT, NULL);
   \textcolor{keywordflow}{if} (!ee) \textcolor{keywordflow}{goto} shutdown\_edje;

   \hyperlink{group__Ecore__Evas__Group_ga3d478e975e2101b9b821ef24baf3dd9e}{ecore\_evas\_callback\_delete\_request\_set}(ee, \_on\_delete\_cb);
   \hyperlink{group__Ecore__Evas__Group_gaac67f679c9027059a34519fbdea360df}{ecore\_evas\_callback\_resize\_set}(ee, \_on\_canvas\_resize);
   \hyperlink{group__Ecore__Evas__Group_ga3b2832e0373bbafae2bb7143618535c1}{ecore\_evas\_title\_set}(ee, \textcolor{stringliteral}{"Edje Animations Example"});

   evas = \hyperlink{group__Ecore__Evas__Group_ga75a7cc694b6069e78df47dab0b0f2d20}{ecore\_evas\_get}(ee);

   bg = \hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}(evas);
   \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(bg, 255, 255, 255, 255); \textcolor{comment}{/* white bg */}
   evas\_object\_move(bg, 0, 0); \textcolor{comment}{/* at canvas' origin */}
   evas\_object\_resize(bg, WIDTH, HEIGHT); \textcolor{comment}{/* covers full canvas */}
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(bg);
   \hyperlink{group__Ecore__Evas__Group_gaa86c5abd200a02711aced53d27b9ddb2}{ecore\_evas\_data\_set}(ee, \textcolor{stringliteral}{"background"}, bg);

   edje\_obj = edje\_object\_add(evas);

   edje\_object\_file\_set(edje\_obj, edje\_file, \textcolor{stringliteral}{"animations\_group"});
   evas\_object\_move(edje\_obj, 0, 0);
   evas\_object\_resize(edje\_obj, WIDTH, HEIGHT);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(edje\_obj);
   \hyperlink{group__Ecore__Evas__Group_gaa86c5abd200a02711aced53d27b9ddb2}{ecore\_evas\_data\_set}(ee, \textcolor{stringliteral}{"edje\_obj"}, edje\_obj);

   \hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}(edje\_obj, 
      \hyperlink{Evas__Common_8h_a99e208e463a20499aabe6faac8a8cb8aa336b86bad4f145f84c155e4922335584}{EVAS\_CALLBACK\_KEY\_DOWN},
                                  \_on\_key\_down, NULL);
   evas\_object\_focus\_set(edje\_obj, \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE});

   fprintf(stdout, commands);

   \hyperlink{group__Ecore__Evas__Group_ga4953047ff97d4f1b0d75a7d513d4f317}{ecore\_evas\_show}(ee);

   \hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}();

   \hyperlink{group__Ecore__Evas__Group_gad3ec61f2aa03df4d3dbfd0d311e0c8dc}{ecore\_evas\_free}(ee);
   \hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}();
   \hyperlink{group__Edje__General__Group_ga01041f6702f2d81bf10c3e41899805cb}{edje\_shutdown}();

   \textcolor{keywordflow}{return} EXIT\_SUCCESS;

 shutdown\_edje:
   \hyperlink{group__Edje__General__Group_ga01041f6702f2d81bf10c3e41899805cb}{edje\_shutdown}();
 shutdown\_ecore\_evas:
   \hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}();

   \textcolor{keywordflow}{return} EXIT\_FAILURE;
\}
\end{DoxyCodeInclude}
 
\begin{DoxyCodeInclude}
1 collections \{
2    group \{
3       name: "animations\_group";
4       min: 100 80;
5 
6       parts \{
7          part \{
8             name: "part\_one";
9             type: RECT;
10             scale: 1;
11             description \{
12                min: 50 50;
13                state: "default" 0.0;
14                color: 0 0 0 255; /* black */
15                rel1.relative: 0.0 0.0;
16                rel2.relative: 0.33 1.0;
17             \}
18             description \{
19                state: "invert" 1.0;
20                inherit: "default" 0.0;
21                rel1.relative: 0.0 0.0;
22                rel2.relative: 1.0 0.33;
23             \}
24          \}
25 
26          part \{
27             name: "part\_two";
28             type: RECT;
29             scale: 1;
30             description \{
31                min: 50 50;
32                state: "default" 0.0;
33                color: 255 255 0 255; /* yellow */
34                rel1.relative: 0.33 0.0;
35                rel2.relative: 0.66 1.0;
36             \}
37             description \{
38                state: "invert" 1.0;
39                inherit: "default" 0.0;
40                rel1.relative: 0.0 0.66;
41                rel2.relative: 1.0 1.0;
42             \}
43          \}
44 
45          part \{
46             name: "part\_three";
47             type: RECT;
48             description \{
49                state: "default" 0.0;
50                color: 255 0 0 255; /* red */
51                rel1.relative: 0.66 0.0;
52                rel2.relative: 1.0 1.0;
53             \}
54             description \{
55                state: "invert" 1.0;
56                inherit: "default" 0.0;
57                rel1.relative: 0.0 0.33;
58                rel2.relative: 1.0 0.66;
59             \}
60          \}
61       \}
62 
63       program \{
64          signal: "load";
65          source: "";
66          in: 2.0 0.0;
67          after: "animation,state1";
68       \}
69       program \{
70          name: "animation,state1";
71          signal: "animation,start";
72          source: "";
73          in: 1.0 0.0;
74          action: STATE\_SET "invert" 1.0;
75          target: "part\_one";
76          target: "part\_two";
77          target: "part\_three";
78          transition: LINEAR 0.6;
79          after: "animation,state2";
80       \}
81       program \{
82          name: "animation,state2";
83          signal: "animation,start";
84          source: "";
85          in: 1.0 0.0;
86          action: STATE\_SET "default" 0.0;
87          target: "part\_one";
88          target: "part\_two";
89          target: "part\_three";
90          transition: LINEAR 0.6;
91          after: "animation,state1";
92    \}
93 \}
\end{DoxyCodeInclude}


To compile use this command\+: \begin{DoxyVerb}* gcc -o edje-animations edje-animations.c -DPACKAGE_BIN_DIR=\"/Where/enlightenment/is/installed/bin\"
* -DPACKAGE_LIB_DIR=\"/Where/enlightenment/is/installed/lib\"
* -DPACKAGE_DATA_DIR=\"/Where/enlightenment/is/installed/share\"
* `pkg-config --cflags --libs evas ecore ecore-evas edje`
*
* edje_cc animations.edc
* \end{DoxyVerb}
 