mGEff API Reference  v1.2.0
An animation framework for MiniGUI apps
mgeff-animation.h
Go to the documentation of this file.
1 
41 #ifndef _MGEFF_ANIMATION_H_
42 #define _MGEFF_ANIMATION_H_
43 
44 #include <stdint.h>
45 #include "mgeff-motioncurve.h"
46 
50 MGEFF_DECLARE_HANDLE(MGEFF_ANIMATION);
51 
56 #define MGEFF_INFINITE -1
57 
70  MGEFF_PROP_MAX
71 };
72 
77 enum EffState {
83 };
84 
92 };
93 
99  MGEFF_INT = 0,
108  MGEFF_MAX
109 };
110 
118 };
119 
128 typedef void (*MGEFF_FINISHED_CB)(MGEFF_ANIMATION handle);
129 
142 typedef void (*MGEFF_STATECHANGED_CB)(MGEFF_ANIMATION handle,
143  enum EffState newEffState, enum EffState oldEffState);
144 
153 typedef void (*MGEFF_CURLOOPCHANGED_CB)(MGEFF_ANIMATION handle);
154 
163 typedef void (*MGEFF_DIRCHANGED_CB)(MGEFF_ANIMATION handle);
164 
178 typedef void (*MGEFF_SETPROPERTY_CB)(MGEFF_ANIMATION handle,
179  void *target, intptr_t id, void *value);
180 
195 typedef void (*MGEFF_CALCVALUE_CB)(MGEFF_ANIMATION handle,
196  void *s, void *e, void *v, float factor);
197 
209 typedef void *(*MGEFF_VARMALLOC_CB)(MGEFF_ANIMATION handle);
210 
237 MGEFF_EXPORT MGEFF_ANIMATION mGEffAnimationCreateEx(void *target,
238  MGEFF_SETPROPERTY_CB setproperty, intptr_t id, int size,
240 
263 MGEFF_EXPORT MGEFF_ANIMATION mGEffAnimationCreate(void *target,
264  MGEFF_SETPROPERTY_CB setproperty, intptr_t id,
265  enum EffVariantType varianttype);
266 
277 MGEFF_EXPORT void mGEffAnimationDelete(MGEFF_ANIMATION handle);
278 
289 MGEFF_EXPORT void mGEffAnimationStop(MGEFF_ANIMATION handle);
290 
301 MGEFF_EXPORT void mGEffAnimationPause(MGEFF_ANIMATION handle);
302 
313 MGEFF_EXPORT void mGEffAnimationResume(MGEFF_ANIMATION handle);
314 
329 MGEFF_EXPORT void mGEffAnimationSetProperty(MGEFF_ANIMATION handle,
330  enum EffAnimProperty id, int value);
331 
346 MGEFF_EXPORT int mGEffAnimationGetProperty(MGEFF_ANIMATION handle,
347  enum EffAnimProperty id);
348 
362 static inline void mGEffAnimationSetDuration(MGEFF_ANIMATION handle,
363  int duration_ms)
364 {
365  mGEffAnimationSetProperty(handle, MGEFF_PROP_DURATION, duration_ms);
366 }
367 
380 static inline int mGEffAnimationGetDuration(MGEFF_ANIMATION handle)
381 {
383 }
384 
398 MGEFF_EXPORT void mGEffAnimationSetStartValue(MGEFF_ANIMATION handle,
399  const void *value);
400 
413 MGEFF_EXPORT const void *mGEffAnimationGetStartValue(MGEFF_ANIMATION handle);
414 
429 MGEFF_EXPORT void mGEffAnimationSetEndValue(MGEFF_ANIMATION handle,
430  const void *value);
431 
444 MGEFF_EXPORT const void *mGEffAnimationGetEndValue(MGEFF_ANIMATION handle);
445 
446 
460 MGEFF_EXPORT void mGEffAnimationSetFinishedCb(MGEFF_ANIMATION handle,
461  MGEFF_FINISHED_CB cb);
462 
476 MGEFF_EXPORT void mGEffAnimationSetStateChangedCb(MGEFF_ANIMATION handle,
478 
492 MGEFF_EXPORT void mGEffAnimationSetCurLoopChangedCb(MGEFF_ANIMATION handle,
494 
508 MGEFF_EXPORT void mGEffAnimationSetDirChangedCb(MGEFF_ANIMATION handle,
510 
524 MGEFF_EXPORT void mGEffAnimationSetContext(MGEFF_ANIMATION handle,
525  void *context);
526 
539 MGEFF_EXPORT void *mGEffAnimationGetContext(MGEFF_ANIMATION handle);
540 
557 MGEFF_EXPORT void mGEffAnimationSetCurve(MGEFF_ANIMATION handle,
558  enum EffMotionType type);
559 
575 MGEFF_EXPORT void mGEffAnimationSetCurveEx(MGEFF_ANIMATION handle,
577 
590 MGEFF_EXPORT MGEFF_MOTIONCURVE mGEffAnimationGetCurve(MGEFF_ANIMATION handle);
591 
604 MGEFF_EXPORT void *mGEffAnimationGetTarget(MGEFF_ANIMATION handle);
605 
620 MGEFF_EXPORT int mGEffAnimationAsyncRun(MGEFF_ANIMATION handle);
621 
635 MGEFF_EXPORT int mGEffAnimationSyncRun(MGEFF_ANIMATION handle);
636 
641  void *property;
643  const void *start_value;
644  const void *end_value;
646  int duration;
649 
665 
679 MGEFF_EXPORT MGEFF_BOOL mGEffAnimationWait(void *hWnd, MGEFF_ANIMATION handle);
680 
681 #endif
682 
Definition: mgeff-animation.h:69
void(* MGEFF_STATECHANGED_CB)(MGEFF_ANIMATION handle, enum EffState newEffState, enum EffState oldEffState)
Type of animation state change callback function.
Definition: mgeff-animation.h:142
MGEFF_EXPORT void mGEffAnimationSetContext(MGEFF_ANIMATION handle, void *context)
Sets the animation context.
MGEFF_EXPORT void mGEffAnimationStop(MGEFF_ANIMATION handle)
Stops a running animation.
int duration
Definition: mgeff-animation.h:646
EffDirection
animation direction
Definition: mgeff-animation.h:89
MGEFF_EXPORT void mGEffAnimationSetCurveEx(MGEFF_ANIMATION handle, MGEFF_MOTIONCURVE_CB cb)
Sets the motion cureve of the animation.
Definition: mgeff-animation.h:82
MGEFF_EXPORT int mGEffAnimationGetProperty(MGEFF_ANIMATION handle, enum EffAnimProperty id)
Gets property of an animation.
Definition: mgeff-animation.h:105
Definition: mgeff-animation.h:116
Definition: mgeff-animation.h:100
MGEFF_EXPORT MGEFF_ANIMATION mGEffAnimationCreateEx(void *target, MGEFF_SETPROPERTY_CB setproperty, intptr_t id, int size, MGEFF_VARMALLOC_CB cb1, MGEFF_CALCVALUE_CB cb2)
Create an animation.
EffMotionType
the type of predefined motion curve
Definition: mgeff-motioncurve.h:71
Definition: mgeff-animation.h:67
Definition: mgeff-animation.h:64
MGEFF_EXPORT MGEFF_MOTIONCURVE mGEffAnimationGetCurve(MGEFF_ANIMATION handle)
Gets the motion cureve of the animation.
MGEFF_EXPORT int mGEffAnimationSyncRun(MGEFF_ANIMATION handle)
Run the animation in the default schedular synchronous.
MGEFF_EXPORT void mGEffAnimationSetCurLoopChangedCb(MGEFF_ANIMATION handle, MGEFF_CURLOOPCHANGED_CB cb)
Sets the animation CurLoopChanged callback function.
float(* MGEFF_MOTIONCURVE_CB)(float progress)
Type of the value calculating callback of the motion curve fuction.
Definition: mgeff-motioncurve.h:55
MGEFF_EXPORT void mGEffAnimationPause(MGEFF_ANIMATION handle)
Pauses a running animation.
Definition: mgeff-animation.h:102
Definition: mgeff-animation.h:65
MGEFF_EXPORT int mGEffAnimationAsyncRun(MGEFF_ANIMATION handle)
Run the animation in the default schedular asynchronous.
Definition: mgeff-animation.h:68
enum EffVariantType type
Definition: mgeff-animation.h:642
void(* MGEFF_SETPROPERTY_CB)(MGEFF_ANIMATION handle, void *target, intptr_t id, void *value)
Type of animation set property function. This fuction is used to produce every animation frame when a...
Definition: mgeff-animation.h:178
void(* MGEFF_CURLOOPCHANGED_CB)(MGEFF_ANIMATION handle)
Type of animation current loop changed callback function.
Definition: mgeff-animation.h:153
void(* MGEFF_FINISHED_CB)(MGEFF_ANIMATION handle)
Type of animation finished callback function.
Definition: mgeff-animation.h:128
MGEFF_EXPORT const void * mGEffAnimationGetStartValue(MGEFF_ANIMATION handle)
Get the animation start value.
MGEFF_EXPORT void * mGEffAnimationGetTarget(MGEFF_ANIMATION handle)
Gets the target of the animation.
Definition: mgeff-animation.h:91
Definition: mgeff-animation.h:90
Definition: mgeff-animation.h:107
Definition: mgeff-animation.h:63
A motion curve headfile.
EffAnimationType
group animation
Definition: mgeff-animation.h:115
Definition: mgeff-animation.h:640
Definition: mgeff-animation.h:80
MGEFF_EXPORT void mGEffAnimationDelete(MGEFF_ANIMATION handle)
Deletes an animation.
MGEFF_DECLARE_HANDLE(MGEFF_ANIMATION)
The handle to the animation.
Definition: mgeff-animation.h:101
EffAnimProperty
animation property
Definition: mgeff-animation.h:62
MGEFF_EXPORT void mGEffAnimationSetProperty(MGEFF_ANIMATION handle, enum EffAnimProperty id, int value)
Sets property of an animation.
const void * end_value
Definition: mgeff-animation.h:644
#define MGEFF_EXPORT
Definition: mgeff-common.h:52
void * property
Definition: mgeff-animation.h:641
enum EffMotionType curve
Definition: mgeff-animation.h:645
const void * start_value
Definition: mgeff-animation.h:643
int MGEFF_BOOL
type of MGEFF_BOOL
Definition: mgeff-common.h:67
MGEFF_EXPORT void mGEffAnimationSetStateChangedCb(MGEFF_ANIMATION handle, MGEFF_STATECHANGED_CB cb)
Sets the animation StateChanged callback function.
Definition: mgeff-animation.h:99
void(* MGEFF_CALCVALUE_CB)(MGEFF_ANIMATION handle, void *s, void *e, void *v, float factor)
Type of animation motion curve callback function.
Definition: mgeff-animation.h:195
void *(* MGEFF_VARMALLOC_CB)(MGEFF_ANIMATION handle)
Type of animation memory allocating callback function.
Definition: mgeff-animation.h:209
MGEFF_EXPORT const void * mGEffAnimationGetEndValue(MGEFF_ANIMATION handle)
Get the animation end value.
MGEFF_EXPORT void mGEffAnimationSetEndValue(MGEFF_ANIMATION handle, const void *value)
set the animation end value.
MGEFF_EXPORT MGEFF_BOOL mGEffAnimationWait(void *hWnd, MGEFF_ANIMATION handle)
Wait an animation.
EffVariantType
animation variant
Definition: mgeff-animation.h:98
Definition: mgeff-animation.h:117
MGEFF_EXPORT void mGEffAnimationSetDirChangedCb(MGEFF_ANIMATION handle, MGEFF_DIRCHANGED_CB cb)
Sets the animation DirChanged callback function.
Definition: mgeff-animation.h:78
MGEFF_EXPORT void mGEffAnimationSetFinishedCb(MGEFF_ANIMATION handle, MGEFF_FINISHED_CB cb)
Sets the animation Finished callback function.
Definition: mgeff-animation.h:103
Definition: mgeff-animation.h:81
Definition: mgeff-animation.h:66
void(* MGEFF_DIRCHANGED_CB)(MGEFF_ANIMATION handle)
Type of animation direction changed callback function.
Definition: mgeff-animation.h:163
Definition: mgeff-animation.h:106
MGEFF_FINISHED_CB cb
Definition: mgeff-animation.h:647
MGEFF_EXPORT void * mGEffAnimationGetContext(MGEFF_ANIMATION handle)
Gets the animation context.
struct _PropertyAnimationSetting EffPropertyAnimationSetting
MGEFF_EXPORT MGEFF_ANIMATION mGEffAnimationCreate(void *target, MGEFF_SETPROPERTY_CB setproperty, intptr_t id, enum EffVariantType varianttype)
Creates an animation.
MGEFF_EXPORT void mGEffAnimationSetCurve(MGEFF_ANIMATION handle, enum EffMotionType type)
Sets the motion cureve of the animation.
EffState
animation state
Definition: mgeff-animation.h:77
Definition: mgeff-animation.h:79
MGEFF_EXPORT void mGEffAnimationSetStartValue(MGEFF_ANIMATION handle, const void *value)
set the animation start value.
Definition: mgeff-animation.h:104
MGEFF_EXPORT MGEFF_ANIMATION mGEffCreatePropertyAnimation(const EffPropertyAnimationSetting *settings)
Create an animation group ready to run.
MGEFF_EXPORT void mGEffAnimationResume(MGEFF_ANIMATION handle)
Resumes a paused animation.