mGEff API Reference
v1.2.0
An animation framework for MiniGUI apps
|
A motion curve headfile. More...
Go to the source code of this file.
Data Structures | |
struct | _PropertyAnimationSetting |
Macros | |
#define | MGEFF_INFINITE -1 |
infinite value, can be used for set loopcount property. | |
Typedefs | |
typedef void(* | MGEFF_FINISHED_CB) (MGEFF_ANIMATION handle) |
Type of animation finished callback function. More... | |
typedef void(* | MGEFF_STATECHANGED_CB) (MGEFF_ANIMATION handle, enum EffState newEffState, enum EffState oldEffState) |
Type of animation state change callback function. More... | |
typedef void(* | MGEFF_CURLOOPCHANGED_CB) (MGEFF_ANIMATION handle) |
Type of animation current loop changed callback function. More... | |
typedef void(* | MGEFF_DIRCHANGED_CB) (MGEFF_ANIMATION handle) |
Type of animation direction changed callback function. More... | |
typedef 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 animation is running. More... | |
typedef void(* | MGEFF_CALCVALUE_CB) (MGEFF_ANIMATION handle, void *s, void *e, void *v, float factor) |
Type of animation motion curve callback function. More... | |
typedef void *(* | MGEFF_VARMALLOC_CB) (MGEFF_ANIMATION handle) |
Type of animation memory allocating callback function. More... | |
typedef struct _PropertyAnimationSetting | EffPropertyAnimationSetting |
Enumerations | |
enum | EffAnimProperty { MGEFF_PROP_DURATION = 0, MGEFF_PROP_CURLOOP = 1, MGEFF_PROP_LOOPCOUNT = 2, MGEFF_PROP_DIRECTION = 3, MGEFF_PROP_CURFRAME = 4, MGEFF_PROP_STATE = 5, MGEFF_PROP_KEEPALIVE = 6, MGEFF_PROP_MAX } |
animation property More... | |
enum | EffState { MGEFF_STATE_STOPPED = 0, MGEFF_STATE_PAUSED = 1, MGEFF_STATE_RUNNING = 2, MGEFF_STATE_READY = 3, MGEFF_STATE_REMOVE = 4 } |
animation state More... | |
enum | EffDirection { MGEFF_DIR_FORWARD = 0, MGEFF_DIR_BACKWARD = 1 } |
animation direction More... | |
enum | EffVariantType { MGEFF_INT = 0, MGEFF_FLOAT = 1, MGEFF_DOUBLE = 2, MGEFF_POINT = 3, MGEFF_POINTF = 4, MGEFF_3DPOINT = 5, MGEFF_3DPOINTF = 6, MGEFF_RECT = 7, MGEFF_COLOR = 8, MGEFF_MAX } |
animation variant More... | |
enum | EffAnimationType { MGEFF_PARALLEL = 1, MGEFF_SEQUENTIAL = 2 } |
group animation More... | |
Functions | |
MGEFF_DECLARE_HANDLE (MGEFF_ANIMATION) | |
The handle to the animation. | |
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. More... | |
MGEFF_EXPORT MGEFF_ANIMATION | mGEffAnimationCreate (void *target, MGEFF_SETPROPERTY_CB setproperty, intptr_t id, enum EffVariantType varianttype) |
Creates an animation. More... | |
MGEFF_EXPORT void | mGEffAnimationDelete (MGEFF_ANIMATION handle) |
Deletes an animation. More... | |
MGEFF_EXPORT void | mGEffAnimationStop (MGEFF_ANIMATION handle) |
Stops a running animation. More... | |
MGEFF_EXPORT void | mGEffAnimationPause (MGEFF_ANIMATION handle) |
Pauses a running animation. More... | |
MGEFF_EXPORT void | mGEffAnimationResume (MGEFF_ANIMATION handle) |
Resumes a paused animation. More... | |
MGEFF_EXPORT void | mGEffAnimationSetProperty (MGEFF_ANIMATION handle, enum EffAnimProperty id, int value) |
Sets property of an animation. More... | |
MGEFF_EXPORT int | mGEffAnimationGetProperty (MGEFF_ANIMATION handle, enum EffAnimProperty id) |
Gets property of an animation. More... | |
MGEFF_EXPORT void | mGEffAnimationSetStartValue (MGEFF_ANIMATION handle, const void *value) |
set the animation start value. More... | |
MGEFF_EXPORT const void * | mGEffAnimationGetStartValue (MGEFF_ANIMATION handle) |
Get the animation start value. More... | |
MGEFF_EXPORT void | mGEffAnimationSetEndValue (MGEFF_ANIMATION handle, const void *value) |
set the animation end value. More... | |
MGEFF_EXPORT const void * | mGEffAnimationGetEndValue (MGEFF_ANIMATION handle) |
Get the animation end value. More... | |
MGEFF_EXPORT void | mGEffAnimationSetFinishedCb (MGEFF_ANIMATION handle, MGEFF_FINISHED_CB cb) |
Sets the animation Finished callback function. More... | |
MGEFF_EXPORT void | mGEffAnimationSetStateChangedCb (MGEFF_ANIMATION handle, MGEFF_STATECHANGED_CB cb) |
Sets the animation StateChanged callback function. More... | |
MGEFF_EXPORT void | mGEffAnimationSetCurLoopChangedCb (MGEFF_ANIMATION handle, MGEFF_CURLOOPCHANGED_CB cb) |
Sets the animation CurLoopChanged callback function. More... | |
MGEFF_EXPORT void | mGEffAnimationSetDirChangedCb (MGEFF_ANIMATION handle, MGEFF_DIRCHANGED_CB cb) |
Sets the animation DirChanged callback function. More... | |
MGEFF_EXPORT void | mGEffAnimationSetContext (MGEFF_ANIMATION handle, void *context) |
Sets the animation context. More... | |
MGEFF_EXPORT void * | mGEffAnimationGetContext (MGEFF_ANIMATION handle) |
Gets the animation context. More... | |
MGEFF_EXPORT void | mGEffAnimationSetCurve (MGEFF_ANIMATION handle, enum EffMotionType type) |
Sets the motion cureve of the animation. More... | |
MGEFF_EXPORT void | mGEffAnimationSetCurveEx (MGEFF_ANIMATION handle, MGEFF_MOTIONCURVE_CB cb) |
Sets the motion cureve of the animation. More... | |
MGEFF_EXPORT MGEFF_MOTIONCURVE | mGEffAnimationGetCurve (MGEFF_ANIMATION handle) |
Gets the motion cureve of the animation. More... | |
MGEFF_EXPORT void * | mGEffAnimationGetTarget (MGEFF_ANIMATION handle) |
Gets the target of the animation. More... | |
MGEFF_EXPORT int | mGEffAnimationAsyncRun (MGEFF_ANIMATION handle) |
Run the animation in the default schedular asynchronous. More... | |
MGEFF_EXPORT int | mGEffAnimationSyncRun (MGEFF_ANIMATION handle) |
Run the animation in the default schedular synchronous. More... | |
MGEFF_EXPORT MGEFF_ANIMATION | mGEffCreatePropertyAnimation (const EffPropertyAnimationSetting *settings) |
Create an animation group ready to run. More... | |
MGEFF_EXPORT MGEFF_BOOL | mGEffAnimationWait (void *hWnd, MGEFF_ANIMATION handle) |
Wait an animation. More... | |
A motion curve headfile.
============================================================================
This file is part of mGEff, a component for MiniGUI. Copyright (C) 2008~2018, Beijing FMSoft Technologies Co., Ltd. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. Or, As this program is a library, any link to this program must follow GNU General Public License version 3 (GPLv3). If you cannot accept GPLv3, you need to be licensed from FMSoft. If you have got a commercial license of this program, please use it under the terms and conditions of the commercial license. For more information about the commercial license, please refer to <http://www.minigui.com/en/about/licensing-policy/>.
typedef struct _PropertyAnimationSetting EffPropertyAnimationSetting |
structure defines a all parameters to create a group animation ready to run.
void(* MGEFF_CALCVALUE_CB)(MGEFF_ANIMATION handle, void *s, void *e, void *v, float factor) |
Type of animation motion curve callback function.
The callback is going to be called every frame, when the animation specified by handle is created by mGEffAnimationCreateEx
handle | animation handle |
s | value |
e | value |
v | value |
factor | calc factor |
void(* MGEFF_CURLOOPCHANGED_CB)(MGEFF_ANIMATION handle) |
Type of animation current loop changed callback function.
The callback is going to be called, when animation's current loop is changed.
handle | animation handle. |
void(* MGEFF_DIRCHANGED_CB)(MGEFF_ANIMATION handle) |
Type of animation direction changed callback function.
The callback is going to be called, when animation's direction is changed.
handle | animation handle. |
void(* MGEFF_FINISHED_CB)(MGEFF_ANIMATION handle) |
Type of animation finished callback function.
The callback is going to be called,when animation is finished.
handle | animation handle |
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 animation is running.
The callback is going to be called every frame.
handle | animation handle. |
target | animation target. |
id | animation id |
value | animation current value,startvalue <= value <= endvalue |
void(* MGEFF_STATECHANGED_CB)(MGEFF_ANIMATION handle, enum EffState newEffState, enum EffState oldEffState) |
Type of animation state change callback function.
The callback is going to be called, when animation state specified by handle is changed.
handle | animation handle. |
newEffState | new animation state. |
oldEffState | old animation state. |
(* MGEFF_VARMALLOC_CB)(MGEFF_ANIMATION handle) |
Type of animation memory allocating callback function.
The callback is going to be called, when the animation is creating. The animation created by mGEffAnimationCreateEx will specify the callback.
handle | animation handle |
enum EffAnimationType |
enum EffAnimProperty |
animation property
enum EffDirection |
enum EffState |
enum EffVariantType |
int mGEffAnimationAsyncRun | ( | MGEFF_ANIMATION | handle | ) |
Run the animation in the default schedular asynchronous.
This function attachs the animation to the default schedular and start the animation. The animation run immediately if schedular is already started, otherwise it will wait until the schedular started.
handle | The handle of the animation to be attached. |
MGEFF_ANIMATION mGEffAnimationCreate | ( | void * | target, |
MGEFF_SETPROPERTY_CB | setproperty, | ||
intptr_t | id, | ||
enum EffVariantType | varianttype | ||
) |
Creates an animation.
This funcion creates an animation for the target specified by target. The animation's setproperty call back is specified by setproperty, id is the identifier for the animation, and the property of the animation is specified by varianttype.
target | The target to be animated. |
setproperty | The animation set property call back, this function is used to genareate every frame of the animation. |
id | The identifier of the animation, which may be used in SetProperty callback to distinguish different animation. |
varianttype | The data type of the property variable. |
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.
This funcion creates an animation for the target specified by target. The animation's setproperty call back is specified by setproperty, id is the identifier for the animation, the size of the animation property varible is specified by size, memory allocating function used to allocating memory for animation internal use is specified by cb1, motion curve for the animation is specified by cb2.
target | The target to be animated. |
setproperty | The animation set property call back, this function is used to genareate every frame of the animation. |
id | The identifier of the animation, which may be used in SetProperty callback to distinguish different animation. |
size | The size of the animation property variable. |
cb1 | The memory allocating callback function. |
cb2 | The motion curve value calculating callback function. |
void mGEffAnimationDelete | ( | MGEFF_ANIMATION | handle | ) |
Deletes an animation.
This function deletes an animation specified by handle.
handle | The animation to be deleted. |
void * mGEffAnimationGetContext | ( | MGEFF_ANIMATION | handle | ) |
Gets the animation context.
This function gets the context of the animation specified by handle.
handle | The hanle of the animation. |
MGEFF_MOTIONCURVE mGEffAnimationGetCurve | ( | MGEFF_ANIMATION | handle | ) |
Gets the motion cureve of the animation.
This function gets the motion curve of the animation specified by handle.
handle | The hanle of the animation. |
const void * mGEffAnimationGetEndValue | ( | MGEFF_ANIMATION | handle | ) |
Get the animation end value.
This function get the end value of the animation specified by handle.
handle | The handle of the animation. |
int mGEffAnimationGetProperty | ( | MGEFF_ANIMATION | handle, |
enum EffAnimProperty | id | ||
) |
Gets property of an animation.
This function gets the animation property specified by id.
handle | The handle of the animation. |
id | The identifier of the property. |
const void * mGEffAnimationGetStartValue | ( | MGEFF_ANIMATION | handle | ) |
Get the animation start value.
This function get the start value of the animation specified by handle
handle | the handle of the animation. |
void * mGEffAnimationGetTarget | ( | MGEFF_ANIMATION | handle | ) |
Gets the target of the animation.
This function gets the target of the animation specified by handle.
handle | The handle of the animation. |
void mGEffAnimationPause | ( | MGEFF_ANIMATION | handle | ) |
Pauses a running animation.
This function pauses a running animation specified by handle.
handle | The animation to be paused. |
void mGEffAnimationResume | ( | MGEFF_ANIMATION | handle | ) |
Resumes a paused animation.
This function resumes a paused animation specified by handle.
handle | The animation to be resumed. |
void mGEffAnimationSetContext | ( | MGEFF_ANIMATION | handle, |
void * | context | ||
) |
Sets the animation context.
This function sets the context of the animation specified by handle to context.
handle | The hanle of the animation. |
context | The context to be set. |
void mGEffAnimationSetCurLoopChangedCb | ( | MGEFF_ANIMATION | handle, |
MGEFF_CURLOOPCHANGED_CB | cb | ||
) |
Sets the animation CurLoopChanged callback function.
This function sets the CurLoopChanged callback of the animation specified by handle to cb.
handle | The handle of the animation. |
cb | The CurLoopChanged callback to be set. |
void mGEffAnimationSetCurve | ( | MGEFF_ANIMATION | handle, |
enum EffMotionType | type | ||
) |
Sets the motion cureve of the animation.
This function sets the motion curve of the animation specified by handle to the curve specified by type.
handle | The hanle of the animation. |
type | the type of the motion curve to be set. |
void mGEffAnimationSetCurveEx | ( | MGEFF_ANIMATION | handle, |
MGEFF_MOTIONCURVE_CB | cb | ||
) |
Sets the motion cureve of the animation.
This function sets the motion curve of the animation specified by handle to the curve specified by cb.
handle | The hanle of the animation. |
cb | the function of the curve be set. |
void mGEffAnimationSetDirChangedCb | ( | MGEFF_ANIMATION | handle, |
MGEFF_DIRCHANGED_CB | cb | ||
) |
Sets the animation DirChanged callback function.
This function sets the DirChanged callback of the animation specified by handle to cb.
handle | The handle of the animation. |
cb | The DirChanged callback to be set. |
void mGEffAnimationSetEndValue | ( | MGEFF_ANIMATION | handle, |
const void * | value | ||
) |
set the animation end value.
This function set the end value of the animation specified by handle to value.
handle | the handle of the animation. |
value | the end value. |
void mGEffAnimationSetFinishedCb | ( | MGEFF_ANIMATION | handle, |
MGEFF_FINISHED_CB | cb | ||
) |
Sets the animation Finished callback function.
This function sets the Finished callback of the animation specified by handle to cb.
handle | The handle of the animation. |
cb | The Finished callback to be set. |
void mGEffAnimationSetProperty | ( | MGEFF_ANIMATION | handle, |
enum EffAnimProperty | id, | ||
int | value | ||
) |
Sets property of an animation.
This function sets the property specified by id to new value specified value.
handle | The handle of the animation. |
id | The identifier of the property. |
value | The new value to be set. |
void mGEffAnimationSetStartValue | ( | MGEFF_ANIMATION | handle, |
const void * | value | ||
) |
set the animation start value.
This function set the start value of the animation specified by handle to value.
handle | the handle of the animation. |
value | the start value to be set. |
void mGEffAnimationSetStateChangedCb | ( | MGEFF_ANIMATION | handle, |
MGEFF_STATECHANGED_CB | cb | ||
) |
Sets the animation StateChanged callback function.
This function sets the StateChanged callback of the animation specified by handle to cb.
handle | The handle of the animation. |
cb | The StateChanged callback to be set. |
void mGEffAnimationStop | ( | MGEFF_ANIMATION | handle | ) |
Stops a running animation.
This function stops a running animation specified by handle.
handle | The animation to be deleted. |
int mGEffAnimationSyncRun | ( | MGEFF_ANIMATION | handle | ) |
Run the animation in the default schedular synchronous.
This function attachs the animation to the default schedular and start the animation. The animation run immediately and return until the animation finished.
handle | The handle of the animation to be attached. |
MGEFF_BOOL mGEffAnimationWait | ( | void * | hWnd, |
MGEFF_ANIMATION | handle | ||
) |
Wait an animation.
This function wait an animation specified by handle, it will return util the special animation run over, it can receive other message between the wait time.
hWnd | the window handle of that animation's timer relative. |
handle | the handle of the animation to be wait. |
MGEFF_ANIMATION mGEffCreatePropertyAnimation | ( | const EffPropertyAnimationSetting * | settings | ) |
Create an animation group ready to run.
This function creates an animation group ready to run using the input param settings.
settings | parameters for create and setup an group animation, it contains one or more animation property. |