summaryrefslogtreecommitdiff
path: root/src/examples/edje
diff options
context:
space:
mode:
authorkumar navneet <k.navneet@samsung.com>2015-05-18 15:22:00 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-05-18 15:22:02 +0900
commitc38e477364081c81c3edb05e78ca2962314e015c (patch)
treebbef5d2d91cdd637de99f8a5a103238427edeee6 /src/examples/edje
parentf3c78cd69ec28793fcbc8b5e8bf626b15eafe096 (diff)
set_tween_state_anim API added.
Summary: Issue: Current embryo script do not provide any mechanism to set transition type in animation, by default supports only linear e.g: set_tween_state API Solution: To not break backward compatibility, a new API set_tween_state_anim is added in which we can even specify type of transition required. Signed-Off by: Kumar Navneet <k.navneet@samsung.com> Signed-Off by: Shilpa Singh <shilpa.singh@samsung.com> Test Plan: A test edc (embryo_tween_anim.edc) is added to edje examples to test set_tween_state_anim API. Reviewers: raster, cedric, shilpasingh, Hermet Reviewed By: shilpasingh Subscribers: poornima.srinivasan, SubodhKumar, rajeshps, cedric, govi Differential Revision: https://phab.enlightenment.org/D2344
Diffstat (limited to 'src/examples/edje')
-rw-r--r--src/examples/edje/Makefile.am3
-rw-r--r--src/examples/edje/embryo_tween_anim.edc169
2 files changed, 171 insertions, 1 deletions
diff --git a/src/examples/edje/Makefile.am b/src/examples/edje/Makefile.am
index a311c5b93f..4ef72fd75e 100644
--- a/src/examples/edje/Makefile.am
+++ b/src/examples/edje/Makefile.am
@@ -46,7 +46,8 @@ swallow.edc \
46table.edc \ 46table.edc \
47text.edc \ 47text.edc \
48toggle_using_filter.edc \ 48toggle_using_filter.edc \
49box_example.edc 49box_example.edc \
50embryo_tween_anim.edc \
50 51
51DIST_EDCS = $(EDCS) 52DIST_EDCS = $(EDCS)
52 53
diff --git a/src/examples/edje/embryo_tween_anim.edc b/src/examples/edje/embryo_tween_anim.edc
new file mode 100644
index 0000000000..79577fd074
--- /dev/null
+++ b/src/examples/edje/embryo_tween_anim.edc
@@ -0,0 +1,169 @@
1collections {
2 group { name: "main";
3 script {
4 public g_duration = 0, g_stopslide, g_timer_id, g_anim_id, toggle=0;
5
6 public slide_to_end_anim(val, Float:pos) {
7 new stopflag;
8 new id;
9 new Float:duration;
10 stopflag = get_int(g_stopslide);
11 duration = get_float(g_duration);
12 if (stopflag == 1) return;
13 set_tween_state_anim(PART:"move","slide_end", 0.0, "slide_begin", 0.0, ACCEL , pos);
14 if (pos >= 1.0) {
15 id = anim(duration, "slide_to_start_anim", 1);
16 set_int(g_timer_id, id);
17 }
18 }
19 public slide_to_start_anim(val, Float:pos) {
20 new stopflag;
21 new id;
22 new Float:duration;
23 stopflag = get_int(g_stopslide);
24 duration = get_float(g_duration);
25 if (stopflag == 1) return;
26 set_tween_state_anim(PART:"move","slide_begin", 0.0, "slide_end", 0.0, DECEL , pos);
27 if (pos >= 1.0) {
28 id = anim(duration, "slide_to_end_anim", 1);
29 set_int(g_timer_id, id);
30 }
31 }
32 public slide_to_end() {
33 new stopflag;
34 new id;
35 new Float:duration;
36 stopflag = get_int(g_stopslide);
37 if (stopflag == 1) return;
38 duration = get_float(g_duration);
39 id = anim(duration, "slide_to_end_anim", 1);
40 set_int(g_anim_id, id);
41 }
42 public slide_to_begin() {
43 new stopflag;
44 new id;
45 stopflag = get_int(g_stopslide);
46 if (stopflag == 1) return;
47 set_state(PART:"move", "slide_begin", 0.0);
48 id = timer(0.5, "slide_to_end", 1);
49 set_int(g_timer_id, id);
50 }
51 public start_slide() {
52 set_int(g_stopslide, 0);
53 set_float(g_duration, 1.3);
54 set_state(PART:"move", "slide_begin", 0.0);
55 slide_to_end();
56 }
57 public stop_slide() {
58 new id;
59 set_int(g_stopslide, 1);
60 id = get_int(g_anim_id);
61 cancel_anim(id);
62 id = get_int(g_timer_id);
63 cancel_timer(id);
64 set_state(PART:"move", "default", 0.0);
65 }
66 }
67 parts {
68 part { name: "bg";
69 type: RECT;
70 description { state: "default" 0.0;
71 color: 255 255 255 255;
72 }
73 }
74 part { name: "label";
75 type: TEXT;
76 description { state: "default" 0.0;
77 color: 255 0 0 255;
78 text {
79 text: "Click me.";
80 font: "Sans";
81 size: 12;
82 align: 0.5 0.8;
83 }
84 }
85 }
86 part { name: "rect1";
87 type: RECT;
88 description { state: "default" 0.0;
89 color: 255 0 0 255;
90 min: 30 30;
91 max: 30 30;
92 fixed: 1 1;
93 align: 0.1 0.2;
94 }
95 }
96 part { name: "rect2";
97 type: RECT;
98 description { state: "default" 0.0;
99 color: 0 255 0 255;
100 min: 30 30;
101 max: 30 30;
102 fixed: 1 1;
103 align: 0.9 0.2;
104 }
105 }
106 part { name: "rect";
107 type: RECT;
108 description { state: "default" 0.0;
109 rel1 {
110 to: "rect1";
111 relative: 1.0 0.0;
112 }
113 rel2 {
114 to:"rect2";
115 relative: 0.0 1.0;
116 }
117 }
118 }
119 part {
120 name: "move";
121 type: RECT;
122 description {
123 state: "default" 0.0;
124 align: 0.0 0.0;
125 min: 30 30;
126 max: 30 30;
127 fixed: 1 1;
128 color: 0 0 255 255;
129 rel1 {
130 to: "rect1";
131 relative: 1.0 0.0;
132 }
133 rel2 {
134 to:"rect1";
135 relative: 1.0 1.0;
136 }
137 }
138 description {
139 state: "slide_end" 0.0;
140 inherit: "default" 0.0;
141 }
142 description {state: "slide_begin" 0.0;
143 inherit: "default" 0.0;
144 align: 1.0 1.0;
145 rel1 {
146 to: "rect2";
147 relative: 0.0 0.0;
148 }
149 rel2 {
150 to:"rect2";
151 relative: 0.0 1.0;
152 }
153 }
154 }
155 }
156 programs {
157 program {signal: "mouse,down,1";
158 source: "label";
159 script{
160 start_slide();
161 }
162 }
163 program { name: "go_left";
164 script{
165 stop_slide();
166 }
167 }
168 }
169 }