summaryrefslogtreecommitdiff
path: root/src/lib/elementary/efl_ui_animation_view.eo
blob: 1d7d0c23ae0b8b71cab451f9d8cac94f3ca7ba45 (plain) (blame)
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239

enum @beta Efl.Ui.Animation_View_State
{
   [[State of animation view]]
   not_ready, [[Animation is not ready to play. (Probably, it didn't file set yet or failed to read file.]]
   playing, [[Animation is playing.]]
   playing_backwards, [[Animation is playing backwards (rewinding).]]
   paused, [[Animation has been paused.]]
   stopped [[Animation view successfully loaded a file then readied for playing.
          Otherwise after finished animation or stopped forcibly by request.]]
}

class @beta Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View, Efl.File, Efl.Player
{
   [[Elementary Animation view class.
     Animation view is designed to show and play animation of
     vector graphics based content. It hides all @Efl.Canvas.Vg.Object details
     but just open an API to read vector data from file. Also, it implements
     details of animation control methods of Vector.

     Vector data could contain static or animatable vector elements including
     animation information. Available vector data file formats are SVG, JSON and EET.
     @Efl.Ui.Animation_View currently only supports the animation information contained in
     JSON (known as Lottie file as well) and EET files.
   ]]
   event_c_prefix: efl_ui_animation_view;
   methods {
      @property autoplay {
         [[Animation will be started automatically when it's possible.

           If @.autoplay is $true, animation will be started when it's readied.
           The condition of $auto play is when animation view opened file successfully,
           yet to play it plus when the object is visible.
           If animation view is disabled, invisible,
           it turns to pause state then resume animation when it's visible again.

           $true Enable auto play mode, disable otherwise.

           Warning: This auto play will be only affected to the next animation source.
           So must be called before setting animation file.
         ]]
         set {
         }
         get {
         }
         values {
            autoplay: bool(false); [[Auto play mode.]]
         }
      }
      @property autorepeat {
         [[Turn on/off animation looping.

           If @.autorepeat is $true, it repeats animation when animation frame is reached to
           end. This auto repeat mode is valid to both playing and playing_backwards cases.

           $true Enable auto play mode, disable otherwise.
         ]]
         set {
         }
         get {
         }
         values {
            autorepeat: bool; [[Loop mode, Default is $false.]]
         }
      }
      @property duration_time {
         [[Get the duration of animation in seconds.

           This API returns total duration time of current animation in the seconds.
           If current animation source isn't animatable, it returns zero.
         ]]
         get {
         }
         values {
            frame_duration: double; [[duration time in the seconds]]
         }
      }
      @property progress {
         [[Set current progress position of animation view object.

           When you required to jump on a certain frame instantly,
           you can change current position by using this API.

           Warning: The range of progress is 0 ~ 1.
         ]]
         set {
         }
         values {
            progress: double; [[Progress position. Value must be 0 ~ 1.]]
         }
      }
      @property frame {
         [[Number of current frame.

           Ranges from 0 to @.frame_count - 1.
         ]]
         set {
         }
         get {
         }
         values {
            frame_num: int; [[Current frame number.]]
         }
      }
      playing_sector {
         [[Play animation of sector one time instantly when it's available.

           If end sector is NULL, only start sector is referenced.
           If both the start and end sectors are valid,
           Play is played and stoped at starting point of each sector.

           If start is null and end is valid, playback starts from 0 frame to the start frame of the end sector.
           If both sectors start and end are invalid. Play from 0 frame to the last frame of animation view object.

           Note: This method use to @.min_frame, @.max_frame (@.min_progress, @.max_progress) internally.
                 So if you have changed the min or max frame(progress) it can be changed to the sector frame.
         ]]
         params {
            @in start: string; [[ The name of start sector ]]
            @in end: string; [[ The name of end sector ]]
         }
         return: bool; [[$true when it's successful. $false otherwise.]]
      }
      @property default_view_size {
         [[The default view size that specified from vector resource.
         ]]
         get {
         }
         values {
            size: Eina.Size2D;
         }
      }
      @property state {
         [[Current animation view state.
           See @Efl.Ui.Animation_View_State
         ]]
         get{
         }
         values {
            state: Efl.Ui.Animation_View_State; [[Current animation view state]]
         }
      }
      @property frame_count {
         [[The index of end frame of the animation view, if it's animated.
           Note : frame number starts with 0.
         ]]
         get {
         }
         values {
            frame_count: int; [[The number of frames. 0, if it's not animated.]]
         }
      }
      @property min_progress {
         [[The start progress of the play.
         ]]
         set {
         }
         get {
         }
         values {
            min_progress: double(0.0); [[The minimum progress. Value must be 0 ~ 1.]]
         }
      }
      @property max_progress {
         [[The last progress of the play.
         ]]
         set {
         }
         get {
         }
         values {
            max_progress: double(1.0); [[The maximum progress. Value must be 0 ~ 1.]]
         }
      }
      @property min_frame {
         [[The start frame of the play.
         ]]
         set {
         }
         get {
         }
         values {
            min_frame: int(0); [[The minimum frame for play. Value must be 0 ~ @.max_frame]]
         }
      }
      @property max_frame {
         [[The last frame of the play.
         ]]
         set {
         }
         get {
         }
         values {
            max_frame: int; [[The maximum frame for play. Value must be @.min_frame ~ (@.frame_count - 1).
                              The default value is @.frame_count - 1.
                            ]]
         }
      }
      value_provider_override{
         [[Override each value of the animation object.
           Values can be properties of Efl.Gfx.Vg.Value_provider such as color and matrix information.

           Example:
           Eo *vp = efl_add(EFL_GFX_VG_VALUE_PROVIDER_CLASS, NULL);
           @Efl.Gfx.Vg.Value_Provider.keypath.set(vp, "SomeLayer:SomeObject:SomeContents");
           // Set vp property
           @.value_provider_override(target_animation_view, vg);
           See @Efl.Gfx.Vg.Value_Provider
         ]]
         params {
            value_provider: Efl.Gfx.Vg.Value_Provider; [[ Override the values of the animation object. this should have keypath infomation. See @Efl.Gfx.Vg.Value_Provider ]]
         }
      }
   }
   implements {
      Efl.Object.constructor;
      Efl.Object.destructor;
      Efl.File.load;
      Efl.File.unload;
      Efl.Gfx.Entity.visible { set; }
      Efl.Gfx.Entity.position { set; }
      Efl.Gfx.Entity.size { set; }
      Efl.Gfx.View.view_size { set; get; }
      Efl.Player.playing { set; get; }
      Efl.Player.paused { set; get; }
      Efl.Player.playback_position { set; get; }
      Efl.Player.playback_progress { get; }
      Efl.Player.playback_speed { set; get; }
   }
   events {
      play,start: void; [[Called when animation is just started]]
      play,repeat: void; [[Called when animation is just repeated]]
      play,done: void; [[Called when animation is just finished]]
      play,pause: void; [[Called when animation is just paused]]
      play,resume: void; [[Called when animation is just resumed]]
      play,stop: void; [[Called when animation is just stopped]]
      play,update: void; [[Called when animation is just updated]]
   }
}