1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
|
#define MSG_ID_VEL (1)
collections {
group {
name: "prefs_edje";
max: 450 450;
min: 50 50;
parts {
part {
name: "bg";
type: RECT;
scale: 1;
description {
state: "default" 0.0;
min: 450 450;
max: 450 450;
color: 255 255 255 0;
align: 0.0 0.0;
}
}
part {
name: "square1";
type: RECT;
scale: 1;
description {
state: "default" 0.0;
min: 50 50;
max: 50 50;
color: 0 0 255 255;
align: 0.0 0.5;
}
description {
state: "invert" 0.0;
inherit: "default" 0.0;
color: 0 255 0 255;
align: 1 0.5;
}
}
part {
name: "square2";
type: RECT;
description {
state: "default" 0.0;
min: 50 50;
max: 50 50;
color: 0 255 0 255;
align: 0.5 0.0;
}
description {
state: "invert" 0.0;
inherit: "default" 0.0;
color: 0 0 255 255;
align: 0.5 1.0;
}
}
}
program {
name: "animation_start";
signal: "start";
source: "animation";
after: "animation,clear";
}
program {
name: "call_animation,state1";
script {
cancel_anim(anim_id);
set_int(anim_id, anim(get_float(global_speed), "animation_1", 0));
set_int(anim_n, 1);
}
}
program {
name: "call_animation,state2";
script {
cancel_anim(anim_id);
set_int(anim_id, anim(get_float(global_speed), "animation_2", 0));
set_int(anim_n, 2);
}
}
program {
name: "animation,stop";
signal: "stop";
source: "animation";
script {
cancel_anim(get_int(anim_id));
}
}
program {
name: "animation,clear";
script {
cancel_anim(get_int(anim_id));
if (get_int(anim_n) == 2)
set_float(anim_pos, (get_float(anim_pos) - 1) * ( -1));
}
after: "call_animation,state1";
}
script {
public global_speed;
public anim_id;
public anim_pos;
public anim_n;
public message(Msg_Type:type, id, ...) {
if ((type == MSG_FLOAT) && (id == MSG_ID_VEL))
set_float(global_speed, Float:getarg(2));
}
public animation_1(val, Float:pos) {
if (pos >= get_float(anim_pos) && get_int(anim_n) == 1)
{
set_tween_state(PART:"square1", pos, "default", 0.0,
"invert", 0.0);
set_tween_state(PART:"square2", pos, "default", 0.0,
"invert", 0.0);
set_float(anim_pos, pos);
}
if (pos >= 1)
{
run_program(PROGRAM:"call_animation,state2");
set_float(anim_pos, 0.0);
}
}
public animation_2(val, Float:pos) {
if (pos >= get_float(anim_pos) && get_int(anim_n) == 2)
{
set_tween_state(PART:"square1", pos, "invert", 0.0,
"default", 0.0);
set_tween_state(PART:"square2", pos, "invert", 0.0,
"default", 0.0);
set_float(anim_pos, pos);
}
if (pos >= 1)
{
run_program(PROGRAM:"call_animation,state1");
set_float(anim_pos, 0.0);
}
}
}
}
#undef MSG_ID_VEL
|