~\newline


In this example we will make an animation of a bouncing ball.

Our focus now will be in the .edc file, because in the C source code we just load the edje object and do nothing else.

We want to give the freedom to the object to use the whole canvas of our program, so lets define the min, max of our group\+:

 
\begin{DoxyCodeInclude}
      max: 700 700;
      min: 700 700;

\end{DoxyCodeInclude}


You will notice that in our .c file the canvas will have this size

Now we will define our part that\textquotesingle{}s going to be our image, the ball\+: 
\begin{DoxyCodeInclude}
              part\{
                   name: \textcolor{stringliteral}{"part\_bubble"};
                   type: IMAGE;

\end{DoxyCodeInclude}


At the description block bellow we are saying that this part has an image, defining the max and min size and it\textquotesingle{}s position on the edje\+\_\+object. The default state is the first state of the part, this means that when the edje object is loaded this one is going to be showed to you.

Here it is\+:  
\begin{DoxyCodeInclude}
                   description\{
                       state: \textcolor{stringliteral}{"default"} 0.0;
                       max: 63 63;
                       min: 63 63;
                       image\{
                            normal: \textcolor{stringliteral}{"bubble.png"};
                       \}
                       rel1.relative: 0.0 0.0;
                       rel2.relative: 0.0 0.0;
                    \}

\end{DoxyCodeInclude}


Now in the next description block we are saying where the ball is going to stop. Note that we have the \char`\"{}inherit\char`\"{} property. This means we are inheriting everything from default, except rel1 and rel2, because we are redefining it.

Check the code\+:


\begin{DoxyCodeInclude}
                    description \{
                       state: \textcolor{stringliteral}{"down-state"} 1.0;
                       inherit: \textcolor{stringliteral}{"default"} 0.0;
                       rel1.relative: 0.0 1.0;
                       rel2.relative: 0.0 0.0;
                     \}

\end{DoxyCodeInclude}


We defined how our object will look like and it\textquotesingle{}s position during the animation, now we need to define how it\textquotesingle{}s going to act during the time. To do this we will use the programs block

The first program block will start the animation, it will wait for the \textquotesingle{}load\textquotesingle{} signal. This signal is generated when the edje object is loaded. The \textquotesingle{}after\textquotesingle{} property is saying to this program block exactly this\+: \char`\"{}\+When you finish, call the program \textquotesingle{}animation,state1\textquotesingle{} \char`\"{}. The \textquotesingle{}in\textquotesingle{} property is saying, wait 0.\+5 seconds until you execute this program block.

Here is the code\+:


\begin{DoxyCodeInclude}
       program \{
         signal: \textcolor{stringliteral}{"load"};
         source: \textcolor{stringliteral}{""};
         in: 0.5 0.0;
         after: \textcolor{stringliteral}{"animation,state1"};
       \}

\end{DoxyCodeInclude}


Now lets make the ball move and bounce it. In the second program block we are defining what we need to do with the action property. So we are saying change to the state \char`\"{}down-\/state\char`\"{} using the transition B\+O\+U\+N\+CE and apply this to the part \char`\"{}part\+\_\+bubble\char`\"{}. You can notice that B\+O\+U\+N\+CE has three parameters, the first one is saying how much time the transition will last, the second one is the factor of curviness and the last one is saying how many times and object will bounce.

The code is very easy\+:


\begin{DoxyCodeInclude}
       program \{
         name: \textcolor{stringliteral}{"animation,state1"};
         source: \textcolor{stringliteral}{""};
         action: STATE\_SET \textcolor{stringliteral}{"down-state"} 1.0;
         target: \textcolor{stringliteral}{"part\_bubble"};
         transition: BOUNCE 2.5 0.0 5.0;
      \}

\end{DoxyCodeInclude}


Now all you have to do is compile the code and run it!

When you compile and run it you should see this\+:   
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth]{signal2final}}
\end{DoxyImageNoCaption}


The .edc file\+: 
\begin{DoxyCodeInclude}
collections \{
   group \{
      name: "animation\_group";
      max: 700 700;
      min: 700 700;
     images\{
         image: "bubble.png" COMP;
     \}
    parts\{
              part\{
                   name: "part\_bubble";
                   type: IMAGE;
                   description\{
                       state: "default" 0.0;
                       max: 63 63;
                       min: 63 63;
                       image\{
                            normal: "bubble.png";
                       \}
                       rel1.relative: 0.0 0.0;
                       rel2.relative: 0.0 0.0;
                    \}
                    description \{
                       state: "down-state" 1.0;
                       inherit: "default" 0.0;
                       rel1.relative: 0.0 1.0;
                       rel2.relative: 0.0 0.0;
                     \}
         \}

    \}
    programs\{
       program \{
         signal: "load";
         source: "";
         in: 0.5 0.0;
         after: "animation,state1";
       \}
       program \{
         name: "animation,state1";
         source: "";
         action: STATE\_SET "down-state" 1.0;
         target: "part\_bubble";
         transition: BOUNCE 2.5 0.0 5.0;
      \}
    \}
   \}
\}
\end{DoxyCodeInclude}


The source code\+: 
\begin{DoxyCodeInclude}
\textcolor{comment}{//Compile with:}
\textcolor{comment}{// edje\_cc animations2.edc && gcc -o animations2 animations2.c `pkg-config --libs --cflags ecore ecore-evas
       edje`}

\textcolor{preprocessor}{#ifdef HAVE\_CONFIG\_H}
\textcolor{preprocessor}{#include "config.h"}
\textcolor{preprocessor}{#else}
\textcolor{preprocessor}{#define PACKAGE\_EXAMPLES\_DIR "."}
\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 <\mbox{\hyperlink{Ecore__Evas_8h}{Ecore\_Evas.h}}>}
\textcolor{preprocessor}{#include <\mbox{\hyperlink{Edje_8h}{Edje.h}}>}
\textcolor{preprocessor}{#include <stdio.h>}

\textcolor{preprocessor}{#define WIDTH     (700)}
\textcolor{preprocessor}{#define HEIGHT    (700)}

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

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

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

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

   ee = \mbox{\hyperlink{group__Ecore__Evas__Group_gac7f2cdbcb79635c34317c1183dd04cb0}{ecore\_evas\_new}}(NULL, 0, 0, WIDTH, HEIGHT, NULL);

   \textcolor{keywordflow}{if} (!ee) \textcolor{keywordflow}{goto} shutdown\_edje;

   \mbox{\hyperlink{group__Ecore__Evas__Group_ga3d478e975e2101b9b821ef24baf3dd9e}{ecore\_evas\_callback\_delete\_request\_set}}(ee, \_on\_delete);
   \mbox{\hyperlink{group__Ecore__Evas__Group_ga3b2832e0373bbafae2bb7143618535c1}{ecore\_evas\_title\_set}}(ee, \textcolor{stringliteral}{"Animations"});

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

   bg = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}}(\mbox{\hyperlink{namespaceevas}{evas}});
   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(bg, 255, 255, 255, 255);
   evas\_object\_move(bg, 0, 0);
   evas\_object\_resize(bg, WIDTH, HEIGHT);
   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(bg);

   \mbox{\hyperlink{group__Ecore__Evas__Group_gac35627a5c3a766ee42762dbcc9eb733d}{ecore\_evas\_object\_associate}}(ee, bg, ECORE\_EVAS\_OBJECT\_ASSOCIATE\_BASE);
   evas\_object\_focus\_set(bg, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});

   edje\_obj = edje\_object\_add(\mbox{\hyperlink{namespaceevas}{evas}});

   fprintf(stderr, \textcolor{stringliteral}{"loading edje file; %s\(\backslash\)n"}, edje\_file);

   \textcolor{keywordflow}{if} (!edje\_object\_file\_set(edje\_obj, edje\_file, \textcolor{stringliteral}{"animation\_group"}))
     \{
        \textcolor{keywordtype}{int} err = edje\_object\_load\_error\_get(edje\_obj);
        \textcolor{keyword}{const} \textcolor{keywordtype}{char} *errmsg = edje\_load\_error\_str(err);
        fprintf(stderr, \textcolor{stringliteral}{"Could not load the edje file - reason:%s\(\backslash\)n"}, errmsg);
        \textcolor{keywordflow}{goto} shutdown\_edje;
     \}

   evas\_object\_resize(edje\_obj, 700, 700);
   evas\_object\_move(edje\_obj, 50, 50);
   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(edje\_obj);

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

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

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

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

   shutdown\_edje: \mbox{\hyperlink{group__Edje__General__Group_ga01041f6702f2d81bf10c3e41899805cb}{edje\_shutdown}}();

   shutdown\_ecore\_evas: \mbox{\hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}}();

   \textcolor{keywordflow}{return} EXIT\_FAILURE;
\}
\end{DoxyCodeInclude}


To compile use this command\+: \begin{DoxyVerb}* gcc -o animations2 animations2.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  animations2.edc
* \end{DoxyVerb}
 