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'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'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's position during the animation, now we need to define how it'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 'load' signal. This signal is generated when the edje object is loaded. The 'after' property is saying to this program block exactly this\+: \char`\"{}\+When you finish, call the program 'animation,state1' \char`\"{}. The 'in' 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\+C\+E and apply this to the part \char`\"{}part\+\_\+bubble\char`\"{}. You can notice that B\+O\+U\+N\+C\+E 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{DoxyImage}
\includegraphics{signal2final}
\caption{width=}
\end{DoxyImage}


The .edc file\+: 
\begin{DoxyCodeInclude}
1 collections \{
2    group \{
3       name: "animation\_group";
4       max: 700 700;
5       min: 700 700;
6      images\{
7          image: "bubble.png" COMP;
8      \}
9     parts\{
10               part\{
11                    name: "part\_bubble";
12                    type: IMAGE;
13                    description\{
14                        state: "default" 0.0;
15                        max: 63 63;
16                        min: 63 63;
17                        image\{
18                             normal: "bubble.png";
19                        \}
20                        rel1.relative: 0.0 0.0;
21                        rel2.relative: 0.0 0.0;
22                     \}
23                     description \{
24                        state: "down-state" 1.0;
25                        inherit: "default" 0.0;
26                        rel1.relative: 0.0 1.0;
27                        rel2.relative: 0.0 0.0;
28                      \}
29          \}
30 
31     \}
32     programs\{
33        program \{
34          signal: "load";
35          source: "";
36          in: 0.5 0.0;
37          after: "animation,state1";
38        \}
39        program \{
40          name: "animation,state1";
41          source: "";
42          action: STATE\_SET "down-state" 1.0;
43          target: "part\_bubble";
44          transition: BOUNCE 2.5 0.0 5.0;
45       \}
46     \}
47    \}
48 \}
\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 <\hyperlink{Ecore__Evas_8h}{Ecore\_Evas.h}>}
\textcolor{preprocessor}{#include <\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 EINA\_UNUSED)
\{
   \hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}();
\}

\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}{"/animations2.edj"};
   \hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas} *evas;
   Ecore\_Evas *ee;
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *edje\_obj;
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *bg;

   \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;

   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);
   \hyperlink{group__Ecore__Evas__Group_ga3b2832e0373bbafae2bb7143618535c1}{ecore\_evas\_title\_set}(ee, \textcolor{stringliteral}{"Animations"});

   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);
   evas\_object\_move(bg, 0, 0);
   evas\_object\_resize(bg, WIDTH, HEIGHT);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(bg);

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

   edje\_obj = edje\_object\_add(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 = \hyperlink{group__Edje__Object__File_ga034465c2de4ab495802da20f332c386e}{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);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(edje\_obj);

   \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__Edje__General__Group_ga01041f6702f2d81bf10c3e41899805cb}{edje\_shutdown}();
   \hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_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}


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}
 