\hypertarget{prefs_example_03_8edc-example}{}\doxysection{prefs\+\_\+example\+\_\+03.\+edc}

\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\#define MSG\_ID\_VEL (1)}
\DoxyCodeLine{}
\DoxyCodeLine{collections \{}
\DoxyCodeLine{   group \{}
\DoxyCodeLine{      name: "{}prefs\_edje"{};}
\DoxyCodeLine{      max: 450 450;}
\DoxyCodeLine{      min: 50 50;}
\DoxyCodeLine{}
\DoxyCodeLine{      parts \{}
\DoxyCodeLine{         part \{}
\DoxyCodeLine{            name: "{}bg"{};}
\DoxyCodeLine{            type: RECT;}
\DoxyCodeLine{            scale: 1;}
\DoxyCodeLine{            description \{}
\DoxyCodeLine{               state: "{}default"{} 0.0;}
\DoxyCodeLine{               min: 450 450;}
\DoxyCodeLine{               max: 450 450;}
\DoxyCodeLine{               color: 255 255 255 0;}
\DoxyCodeLine{               align: 0.0 0.0;}
\DoxyCodeLine{            \}}
\DoxyCodeLine{         \}}
\DoxyCodeLine{}
\DoxyCodeLine{         part \{}
\DoxyCodeLine{            name: "{}square1"{};}
\DoxyCodeLine{            type: RECT;}
\DoxyCodeLine{            scale: 1;}
\DoxyCodeLine{            description \{}
\DoxyCodeLine{               state: "{}default"{} 0.0;}
\DoxyCodeLine{               min: 50 50;}
\DoxyCodeLine{               max: 50 50;}
\DoxyCodeLine{               color: 0 0 255 255;}
\DoxyCodeLine{               align: 0.0 0.5;}
\DoxyCodeLine{            \}}
\DoxyCodeLine{            description \{}
\DoxyCodeLine{               state: "{}invert"{} 0.0;}
\DoxyCodeLine{               inherit: "{}default"{} 0.0;}
\DoxyCodeLine{               color: 0 255 0 255;}
\DoxyCodeLine{               align: 1 0.5;}
\DoxyCodeLine{            \}}
\DoxyCodeLine{         \}}
\DoxyCodeLine{}
\DoxyCodeLine{         part \{}
\DoxyCodeLine{            name: "{}square2"{};}
\DoxyCodeLine{            type: RECT;}
\DoxyCodeLine{            description \{}
\DoxyCodeLine{               state: "{}default"{} 0.0;}
\DoxyCodeLine{               min: 50 50;}
\DoxyCodeLine{               max: 50 50;}
\DoxyCodeLine{               color: 0 255 0 255;}
\DoxyCodeLine{               align: 0.5 0.0;}
\DoxyCodeLine{            \}}
\DoxyCodeLine{            description \{}
\DoxyCodeLine{               state: "{}invert"{} 0.0;}
\DoxyCodeLine{               inherit: "{}default"{} 0.0;}
\DoxyCodeLine{               color: 0 0 255 255;}
\DoxyCodeLine{               align: 0.5 1.0;}
\DoxyCodeLine{            \}}
\DoxyCodeLine{         \}}
\DoxyCodeLine{      \}}
\DoxyCodeLine{}
\DoxyCodeLine{      program \{}
\DoxyCodeLine{         name: "{}animation\_start"{};}
\DoxyCodeLine{         signal: "{}start"{};}
\DoxyCodeLine{         source: "{}animation"{};}
\DoxyCodeLine{         after: "{}animation,clear"{};}
\DoxyCodeLine{      \}}
\DoxyCodeLine{}
\DoxyCodeLine{      program \{}
\DoxyCodeLine{         name: "{}call\_animation,state1"{};}
\DoxyCodeLine{         script \{}
\DoxyCodeLine{              cancel\_anim(anim\_id);}
\DoxyCodeLine{              set\_int(anim\_id, anim(get\_float(global\_speed), "{}animation\_1"{}, 0));}
\DoxyCodeLine{              set\_int(anim\_n, 1);}
\DoxyCodeLine{         \}}
\DoxyCodeLine{      \}}
\DoxyCodeLine{}
\DoxyCodeLine{      program \{}
\DoxyCodeLine{         name: "{}call\_animation,state2"{};}
\DoxyCodeLine{         script \{}
\DoxyCodeLine{              cancel\_anim(anim\_id);}
\DoxyCodeLine{              set\_int(anim\_id, anim(get\_float(global\_speed), "{}animation\_2"{}, 0));}
\DoxyCodeLine{              set\_int(anim\_n, 2);}
\DoxyCodeLine{         \}}
\DoxyCodeLine{      \}}
\DoxyCodeLine{}
\DoxyCodeLine{      program \{}
\DoxyCodeLine{         name: "{}animation,stop"{};}
\DoxyCodeLine{         signal: "{}stop"{};}
\DoxyCodeLine{         source: "{}animation"{};}
\DoxyCodeLine{         script \{}
\DoxyCodeLine{              cancel\_anim(get\_int(anim\_id));}
\DoxyCodeLine{         \}}
\DoxyCodeLine{      \}}
\DoxyCodeLine{}
\DoxyCodeLine{      program \{}
\DoxyCodeLine{         name: "{}animation,clear"{};}
\DoxyCodeLine{         script \{}
\DoxyCodeLine{              cancel\_anim(get\_int(anim\_id));}
\DoxyCodeLine{              if (get\_int(anim\_n) == 2)}
\DoxyCodeLine{                set\_float(anim\_pos, (get\_float(anim\_pos) -\/ 1) * ( -\/1));}
\DoxyCodeLine{         \}}
\DoxyCodeLine{         after: "{}call\_animation,state1"{};}
\DoxyCodeLine{      \}}
\DoxyCodeLine{}
\DoxyCodeLine{      script \{}
\DoxyCodeLine{         public global\_speed;}
\DoxyCodeLine{         public anim\_id;}
\DoxyCodeLine{         public anim\_pos;}
\DoxyCodeLine{         public anim\_n;}
\DoxyCodeLine{}
\DoxyCodeLine{         public message(Msg\_Type:type, id, ...) \{}
\DoxyCodeLine{            if ((type == MSG\_FLOAT) \&\& (id == MSG\_ID\_VEL))}
\DoxyCodeLine{              set\_float(global\_speed, Float:getarg(2));}
\DoxyCodeLine{         \}}
\DoxyCodeLine{}
\DoxyCodeLine{         public animation\_1(val, Float:pos) \{}
\DoxyCodeLine{           if (pos >= get\_float(anim\_pos) \&\& get\_int(anim\_n) == 1)}
\DoxyCodeLine{             \{}
\DoxyCodeLine{                set\_tween\_state(PART:"{}square1"{}, pos, "{}default"{}, 0.0,}
\DoxyCodeLine{                                "{}invert"{}, 0.0);}
\DoxyCodeLine{                set\_tween\_state(PART:"{}square2"{}, pos, "{}default"{}, 0.0,}
\DoxyCodeLine{                                "{}invert"{}, 0.0);}
\DoxyCodeLine{                set\_float(anim\_pos, pos);}
\DoxyCodeLine{             \}}
\DoxyCodeLine{           if (pos >= 1)}
\DoxyCodeLine{             \{}
\DoxyCodeLine{                run\_program(PROGRAM:"{}call\_animation,state2"{});}
\DoxyCodeLine{                set\_float(anim\_pos, 0.0);}
\DoxyCodeLine{             \}}
\DoxyCodeLine{         \}}
\DoxyCodeLine{}
\DoxyCodeLine{         public animation\_2(val, Float:pos) \{}
\DoxyCodeLine{           if (pos >= get\_float(anim\_pos) \&\& get\_int(anim\_n) == 2)}
\DoxyCodeLine{             \{}
\DoxyCodeLine{                set\_tween\_state(PART:"{}square1"{}, pos, "{}invert"{}, 0.0,}
\DoxyCodeLine{                                "{}default"{}, 0.0);}
\DoxyCodeLine{                set\_tween\_state(PART:"{}square2"{}, pos, "{}invert"{}, 0.0,}
\DoxyCodeLine{                                "{}default"{}, 0.0);}
\DoxyCodeLine{                set\_float(anim\_pos, pos);}
\DoxyCodeLine{             \}}
\DoxyCodeLine{           if (pos >= 1)}
\DoxyCodeLine{             \{}
\DoxyCodeLine{                run\_program(PROGRAM:"{}call\_animation,state1"{});}
\DoxyCodeLine{                set\_float(anim\_pos, 0.0);}
\DoxyCodeLine{             \}}
\DoxyCodeLine{         \}}
\DoxyCodeLine{      \}}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\#undef MSG\_ID\_VEL}

\end{DoxyCodeInclude}
 