group { name: "e/gadget/batman/main"; alias: "e/gadget/batman/main_vert"; images.image: "bat_base.png" COMP; script { public message(Msg_Type:type, id, ...) { if ((type == MSG_FLOAT) && (id == 1)) { new Float:val = getfarg(2); val = 0.05 + (0.9 * (1.0 - val)); custom_state(PART:"fill_clip", "default", 0.0); set_state_val(PART:"fill_clip", STATE_REL1, 0.0, val); set_state(PART:"fill_clip", "custom", 0.0); } } } parts { part { name: "pulse_clip"; type: RECT; description { state: "default" 0.0; rel1.to: "bg"; rel2.to: "bg"; } description { state: "faded" 0.0; inherit: "default" 0.0; color: 255 255 255 128; } } part { name: "fill_clip_dim"; type: RECT; clip_to: "pulse_clip"; description { state: "default" 0.0; rel1.to: "bg"; rel2.to: "bg"; } description { state: "visible" 0.0; inherit: "default" 0.0; color: 128 128 128 255; } } part { name: "fill_clip"; type: RECT; clip_to: "fill_clip_dim"; description { state: "default" 0.0; rel1.to: "bg"; rel2.to: "bg"; } } part { name: "bg"; clip_to: "pulse_clip"; description { state: "default" 0.0; aspect: 1.0 1.0; aspect_preference: BOTH; image.normal: "bat_base.png"; color: 0 0 0 64; } } part { name: "fill"; clip_to: "fill_clip"; description { state: "default" 0.0; rel1.to: "bg"; rel2.to: "bg"; image.normal: "bat_base.png"; color: 160 160 160 255; } description { state: "charging" 0.0; inherit: "default" 0.0; color: 51 153 255 255; } } part { name: "over"; type: RECT; description { state: "default" 0.0; color: 0 0 0 0; } } } programs { program { signal: "e,state,charging"; source: "e"; action: STATE_SET "charging" 0.0; target: "fill"; } program { signal: "e,state,discharging"; source: "e"; action: STATE_SET "default" 0.0; target: "fill"; } program { name: "pulse"; signal: "e,action,pulse,start"; source: "e"; action: STATE_SET "faded" 0.0; transition: ACCELERATE 0.3; after: "pulse2"; target: "pulse_clip"; } program { name: "pulse2"; action: STATE_SET "default" 0.0; transition: ACCELERATE 0.1; target: "pulse_clip"; after: "pulse"; } program { signal: "e,action,pulse,stop"; source: "e"; action: ACTION_STOP; target: "pulse"; target: "pulse2"; after: "pulse3"; } program { name: "pulse3"; signal: "e,action,pulse,stop"; source: "e"; action: STATE_SET "default" 0.0; target: "pulse_clip"; } program { signal: "mouse,in"; source: "over"; action: STATE_SET "visible" 0.0; transition: SINUSOIDAL 0.3; target: "fill_clip_dim"; } program { signal: "mouse,out"; source: "over"; action: STATE_SET "default" 0.0; transition: SINUSOIDAL 0.3; target: "fill_clip_dim"; } } } group { name: "e/gadget/batman/popup"; min: 320 60; parts { part { name: "e.swallow.batman"; type: SWALLOW; description { state: "default" 0.0; aspect: 1.0 1.0; aspect_preference: VERTICAL; min: 1 1; max: 240 160; align: 0.0 0.5; } } part { name: "e.text.title"; type: TEXT; scale: 1; description { state: "default" 0.0; rel1.relative: 1.0 0.0; rel1.to_x: "e.swallow.batman"; rel2.relative: 1.0 0.5; color: 160 160 160 255; text { font: "Sans:style=Bold"; size: 10; text: "Your battery is low!"; min: 1 1; ellipsis: -1; text_class: "module_large"; } } } part { name: "e.text.label"; type: TEXT; scale: 1; description { state: "default" 0.0; rel1.relative: 1.0 0.5; rel1.to_x: "e.swallow.batman"; color: 160 160 160 255; text { font: "Sans"; size: 10; text: "AC power is recommended."; min: 1 1; ellipsis: -1; text_class: "module_normal"; } } } } }