The purpose of this example is to demonstrate the dynamically growing and shrinking of an EPhysics\+\_\+\+Body -\/ The code applies the growth of a ball and the shrink of another.

 
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth,height=\textheight/2,keepaspectratio=true]{growing_balls}}
\end{DoxyImageNoCaption}


For this example we\textquotesingle{}ll have an EPhysics\+\_\+\+World and three EPhysics\+\_\+\+Bodys with different sizes associated with an evas\+\_\+object.

The basic concepts like -\/ defining an EPhysics\+\_\+\+World, render geometry, physics limiting boundaries, add an EPhysics\+\_\+\+Body, associate it to evas objects, change restitution, friction and impulse properties, were already covered in \mbox{\hyperlink{tutorial_ephysics_bouncing_ball}{EPhysics -\/ Bouncing Ball}}\hypertarget{tutorial_ephysics_growing_balls_add-growshrink}{}\doxysection{Adding the growing/shrinking}\label{tutorial_ephysics_growing_balls_add-growshrink}


In this example we\textquotesingle{}ll use a timer to handle the callback function.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   test\_data-\/>data = \mbox{\hyperlink{group__Ecore__Timer__Group_ga7b9cb9d24ecebfdbb957436e2e669402}{ecore\_timer\_add}}(1, \_grow\_cb, test\_data);}

\end{DoxyCodeInclude}
 In this callback, we\textquotesingle{}ll pass through a list with 3 balls and apply the growth and the shrink between the limit we\textquotesingle{}ll set. Note that the variable i receives different values on each iteration (-\/1, 0, 1). For the first iteration it will decrease the size variable, the second will keep the same value, and the last one will increase the size variable.




\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\_grow\_cb(\textcolor{keywordtype}{void} *data)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   Test\_Data *test\_data = data;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj;}
\DoxyCodeLine{   \mbox{\hyperlink{struct__Eina__List}{Eina\_List}} *l;}
\DoxyCodeLine{   \textcolor{keywordtype}{int} size, i = -\/1;}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__List__Group_gac6efafc19f526d916cdb9757240a8773}{EINA\_LIST\_FOREACH}}(test\_data-\/>evas\_objs, l, obj)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga6f52fab1a96dc58c85ee481d84bac871}{evas\_object\_geometry\_get}}(obj, NULL, NULL, \&size, NULL);}
\DoxyCodeLine{        size += i * 8;}
\DoxyCodeLine{        i++;}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{keywordflow}{if} ((size < 20) || (size > 120))}
\DoxyCodeLine{          \textcolor{keywordflow}{continue};}
\DoxyCodeLine{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}}(obj, size, size);}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}};}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 Here we finish the example. The full source code can be found at \mbox{\hyperlink{test_growing_balls_c}{test\+\_\+growing\+\_\+balls.\+c}}. 