summaryrefslogtreecommitdiff
path: root/data/elementary/themes/edc/efl/focus.edc
blob: 32b5e6e564928ee9acb83fe864567ba30a700103 (plain)
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/**
Group: efl/focus_highlight/top (@since 1.23)
	 Signal: efl,focus,visible,off
	 Signal: efl,focus,visible,on
	 Signal: efl,state,animating,stopped
Group: efl/focus_highlight/top:blank (@since 1.23)
*/
group { name: "efl/focus_highlight/top"; data.item: "version" "123";
   images.image: "box_glow.png" COMP;
   images.image: "box_outline.png" COMP;
   data.item: "animate" "on";
   script {
      public s_x, s_y, s_w, s_h; /* source */
      public difx, dify, difw, difh;
      public g_anim_id;

      public animator1(val, Float:pos) {
         new x, y, w, h, dx, dy, dw, dh, Float:p;
         p = 1.0 - ((1.0 - pos) * (1.0 - pos) * (1.0 - pos));
         dx = round(float_mul(float(get_int(difx)), p));
         x = get_int(s_x) + dx;
         dy = round(float_mul(float(get_int(dify)), p));
         y = get_int(s_y) + dy;
         dw = round(float_mul(float(get_int(difw)), p));
         w = get_int(s_w) + dw;
         dh = round(float_mul(float(get_int(difh)), p));
         h = get_int(s_h) + dh;
         update_offset(x, y, w, h);

         if (pos >= 1.0) {
            set_int(g_anim_id, 0);
         }
      }

      public update_offset(x, y, w, h) {
         set_state_val(PART:"base", STATE_REL1_OFFSET, x, y);
         set_state_val(PART:"base", STATE_REL2_OFFSET, x + w, y + h);
      }

      public message(Msg_Type:type, id, ...) {
         if ((type == MSG_INT_SET) && (id == 1)) {
            new x1, y1, w1, h1, x2, y2, w2, h2;
            new anim_id;
            
            anim_id = get_int(g_anim_id);
            if (anim_id != 0) {
               cancel_anim(anim_id);
            }

            x1 = getarg(2);
            y1 = getarg(3);
            w1 = getarg(4);
            h1 = getarg(5);
            x2 = getarg(6);
            y2 = getarg(7);
            w2 = getarg(8);
            h2 = getarg(9);

            set_int(s_x, x1);
            set_int(s_y, y1);
            set_int(s_w, w1);
            set_int(s_h, h1);
            set_int(difx, x2 - x1);
            set_int(dify, y2 - y1);
            set_int(difw, w2 - w1);
            set_int(difh, h2 - h1);

            custom_state(PART:"base", "default", 0.0);
            set_state_val(PART:"base", STATE_REL1, 0.0, 0.0);
            set_state_val(PART:"base", STATE_REL2, 0.0, 0.0);
            update_offset(x1, y1, w1, h1);
            set_state(PART:"base", "custom", 0.0);
            
            anim_id = anim(0.2, "animator1", 1);
            set_int(g_anim_id, anim_id);
         }
      }
   }
   parts {
      part { name: "base"; type: SPACER;
         description { state: "default" 0.0;
            fixed: 1 1;
         }
      }
      part { name: "clip"; type: RECT;
         description { state: "default" 0.0;
            rel1.to: "glow";
            rel2.to: "glow";
            color: 255 255 255 0;
         }
         description { state: "visible" 0.0;
            inherit: "default" 0.0;
            color: 255 255 255 255;
         }
      }
      part { name: "glow"; mouse_events: 0;
         clip_to: "clip";
         description { state: "default" 0.0;
            image.normal: "box_glow.png";
            image.border: 12 12 12 12;
            image.middle: 0;
            fill.smooth: 0;
            rel1.to: "base";
            rel1.offset: -7 -7;
            rel2.to: "base";
            rel2.offset: 5 5;
         }
      }
      part { name: "sel"; mouse_events: 0;
         clip_to: "clip";
         description { state: "default" 0.0;
            image.normal: "box_outline.png";
            image.border: 12 12 12 12;
            image.middle: 0;
            fill.smooth: 0;
            rel1.to: "glow";
            rel2.to: "glow";
            color: 255 255 255 0;
         }
         description { state: "hi" 0.0;
            inherit: "default" 0.0;
            color: 255 255 255 255;
         }
      }
   }
   programs {
      program {
         signal: "efl,focus,visible,on"; source: "efl";
         action: ACTION_STOP;
         target: "pulse";
         target: "pulse2";
         after: "go2";
      }
      program { name: "go2";
         action: STATE_SET "visible" 0.0;
         transition: DECELERATE 0.2;
         target: "clip";
         after: "pulse";
         after: "go3";
      }
      program { name: "go3";
         action: SIGNAL_EMIT "efl,focus,visible,on,done" "efl";
      }
      program {
         signal: "efl,focus,visible,off"; source: "efl";
         action: STATE_SET "default" 0.0;
         transition: DECELERATE 0.4;
         target: "clip";
         after: "stop2";
      }
      program { name: "stop2";
         action: SIGNAL_EMIT "efl,focus,visible,off,done" "efl";
         after: "stop3";
      }
      program { name: "stop3";
         action: ACTION_STOP;
         target: "pulse";
         target: "pulse2";
      }
      program { name: "pulse";
         action: STATE_SET "hi" 0.0;
         transition: SINUSOIDAL 0.2;
         in: 3.0 0.0;
         target: "sel";
         after: "pulse2";
      }
      program { name: "pulse2";
         action: STATE_SET "default" 0.0;
         transition: SINUSOIDAL 0.4;
         target: "sel";
         after: "pulse";
      }
      program {
         signal: "efl,state,animating,stopped"; source: "efl";
         action: STATE_SET "default" 0.0;
         target: "base";
      }
   }
}

group { name: "efl/focus_highlight/top:blank"; data.item: "version" "123";
   parts {
   }
}