\hypertarget{ecore_animator_example_8c-example}{}\section{ecore\+\_\+animator\+\_\+example.\+c}

\begin{DoxyCodeInclude}
\textcolor{comment}{//Compile with:}
\textcolor{comment}{//gcc -g -Wall -o ecore\_animator\_example ecore\_animator\_example.c `pkg-config --cflags --libs evas
       ecore-evas ecore`}

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

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool} \_advance\_frame(\textcolor{keywordtype}{void} *data, \textcolor{keywordtype}{double} pos);
\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool} \_advance\_frame2(\textcolor{keywordtype}{void} *data, \textcolor{keywordtype}{double} pos);
\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool} \_advance\_frame3(\textcolor{keywordtype}{void} *data);
\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool} \_start\_second\_anim(\textcolor{keywordtype}{void} *data);
\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool} \_freeze\_third\_anim(\textcolor{keywordtype}{void} *data);
\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool} \_thaw\_third\_anim(\textcolor{keywordtype}{void} *data);

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{void})
\{
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *rect, *bg, *rect2;
   Ecore\_Evas *ee;
   \hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas} *\hyperlink{namespaceevas}{evas};
   Ecore\_Animator *anim;

   \hyperlink{group__Ecore__Evas__Group_ga32ddbb6457033ad435a177eb0c4fe235}{ecore\_evas\_init}();

   ee = \hyperlink{group__Ecore__Evas__Group_gac7f2cdbcb79635c34317c1183dd04cb0}{ecore\_evas\_new}(NULL, 0, 0, 300, 400, NULL);
   \hyperlink{group__Ecore__Evas__Group_ga4953047ff97d4f1b0d75a7d513d4f317}{ecore\_evas\_show}(ee);
   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__Font__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(bg, 300, 400);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(bg);

   rect = \hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}(evas);
   \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(rect, 0, 0, 255, 255);
   \hyperlink{group__Evas__Font__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(rect, 50, 50);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(rect);

   rect2 = \hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}(evas);
   \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(rect2, 0, 55, 0, 255);
   \hyperlink{group__Evas__Font__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(rect2, 50, 50);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(rect2);

   \hyperlink{group__Ecore__Animator__Group_ga2c7aa7e621cd68562519066ad87a3fa1}{ecore\_animator\_frametime\_set}(1. / 50);
   \hyperlink{group__Ecore__Animator__Group_ga523a0e9716bcc6573eb9f4b310067ed1}{ecore\_animator\_timeline\_add}(5, \_advance\_frame, rect);

   anim = \hyperlink{group__Ecore__Animator__Group_gaa1e33b8be9117a26918823c535e429ea}{ecore\_animator\_add}(\_advance\_frame3, rect2);

   \hyperlink{group__Ecore__Timer__Group_ga7b9cb9d24ecebfdbb957436e2e669402}{ecore\_timer\_add}(10, \_start\_second\_anim, rect);
   \hyperlink{group__Ecore__Timer__Group_ga7b9cb9d24ecebfdbb957436e2e669402}{ecore\_timer\_add}(5, \_freeze\_third\_anim, anim);
   \hyperlink{group__Ecore__Timer__Group_ga7b9cb9d24ecebfdbb957436e2e669402}{ecore\_timer\_add}(10, \_thaw\_third\_anim, anim);
   \hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}();

   \hyperlink{group__Evas__Object__Group__Basic_ga7e7a625dab7a3890532aa13b43117076}{evas\_object\_del}(rect);
   \hyperlink{group__Ecore__Evas__Group_gad3ec61f2aa03df4d3dbfd0d311e0c8dc}{ecore\_evas\_free}(ee);
   \hyperlink{group__Ecore__Animator__Group_gaadfa590f3c1638035393ed9d7aa10e2f}{ecore\_animator\_del}(anim);
   \hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}();

   \textcolor{keywordflow}{return} 0;
\}

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
\_advance\_frame(\textcolor{keywordtype}{void} *data, \textcolor{keywordtype}{double} pos)
\{
   \textcolor{keywordtype}{double} frame = pos;
   frame = \hyperlink{group__Ecore__Animator__Group_ga5d4c42b9fdb22748943efa9ae6ba0a47}{ecore\_animator\_pos\_map}(pos, 
      \hyperlink{group__Ecore__Animator__Group_gga2db0d0f0f3973829c7f700e5af3e041cac8cbb42f58cabb5db04f52cede85dacd}{ECORE\_POS\_MAP\_SPRING}, 1.2, 15);

   \hyperlink{group__Evas__Font__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(data, 50 * (1 + frame), 50 * (1 + frame));
   \hyperlink{group__Evas__Font__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}(data, 100 * frame, 100 * frame);
   \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(data, 255 * frame, 0, 255 * (1 - frame), 255);
   \textcolor{keywordflow}{return} \hyperlink{group__Ecore__Main__Loop__Group_ga1ee9db07f9a46a8b20fb83e1c6dbed09}{ECORE\_CALLBACK\_RENEW};
\}

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
\_start\_second\_anim(\textcolor{keywordtype}{void} *data)
\{
   \hyperlink{group__Ecore__Animator__Group_ga2c7aa7e621cd68562519066ad87a3fa1}{ecore\_animator\_frametime\_set}(1. / 10);
   \hyperlink{group__Ecore__Animator__Group_ga523a0e9716bcc6573eb9f4b310067ed1}{ecore\_animator\_timeline\_add}(20, \_advance\_frame2, data);
   \textcolor{keywordflow}{return} \hyperlink{group__Ecore__Main__Loop__Group_gae0c653baad8836232c0dc27f91f875d6}{ECORE\_CALLBACK\_CANCEL};
\}

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
\_advance\_frame2(\textcolor{keywordtype}{void} *data, \textcolor{keywordtype}{double} pos)
\{
   \textcolor{keywordtype}{double} frame = pos;
   frame = \hyperlink{group__Ecore__Animator__Group_ga5d4c42b9fdb22748943efa9ae6ba0a47}{ecore\_animator\_pos\_map}(pos, 
      \hyperlink{group__Ecore__Animator__Group_gga2db0d0f0f3973829c7f700e5af3e041ca2eb0a9af74a33bf88fc19d350f703f5e}{ECORE\_POS\_MAP\_BOUNCE}, 1.2, 50);

   \hyperlink{group__Evas__Font__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(data, 100 - (50 * frame), 100 - (50 * frame));
   \hyperlink{group__Evas__Font__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}(data, 100 * (1 - frame), 100 * (1 - frame));
   \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(data, 255 * (1 - frame), 0, 255 * frame, 255);
   \textcolor{keywordflow}{return} \hyperlink{group__Ecore__Main__Loop__Group_ga1ee9db07f9a46a8b20fb83e1c6dbed09}{ECORE\_CALLBACK\_RENEW};
\}

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
\_advance\_frame3(\textcolor{keywordtype}{void} *data)
\{
   \textcolor{keyword}{static} \textcolor{keywordtype}{int} x = 0;

   \textcolor{keywordflow}{if} (x >= 250)
     x = 0;
   \hyperlink{group__Evas__Font__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}(data, ++x, 350);

   \textcolor{keywordflow}{return} \hyperlink{group__Ecore__Main__Loop__Group_ga1ee9db07f9a46a8b20fb83e1c6dbed09}{ECORE\_CALLBACK\_RENEW};
\}

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
\_freeze\_third\_anim(\textcolor{keywordtype}{void} *data)
\{
   \hyperlink{group__Ecore__Animator__Group_gaff76e892f893610f9360aa6fddd810ef}{ecore\_animator\_freeze}(data);
   \textcolor{keywordflow}{return} \hyperlink{group__Ecore__Main__Loop__Group_gae0c653baad8836232c0dc27f91f875d6}{ECORE\_CALLBACK\_CANCEL};
\}

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
\_thaw\_third\_anim(\textcolor{keywordtype}{void} *data)
\{
   \hyperlink{group__Ecore__Animator__Group_ga11c89906f136e3132e23527e412ccc69}{ecore\_animator\_thaw}(data);
   \textcolor{keywordflow}{return} \hyperlink{group__Ecore__Main__Loop__Group_gae0c653baad8836232c0dc27f91f875d6}{ECORE\_CALLBACK\_CANCEL};
\}

\end{DoxyCodeInclude}
 