UI animation
UI Animation
| Title |
UI Animation |
| Author(s) |
WangTian? |
| Date |
2007/9/30 |
| File |
script/ide/UIAnim/UIAnimation.lua |
Description
Sample Code
NPL.load("(gl)script/ide/UIAnim/UIAnimation.lua");
local ctl = UIAnimation:new{
name = "UIAnimation1",
text = "blarrrr",
... = 0,
*** = 300,
};
ctl:getValue(1, 400);
UI Animation
| Title |
UI Animation |
| Author(s) |
WangTian? |
| Date |
2007/9/29 |
| File |
script/ide/UIAnim/UIAnimBlock.lua |
Description
Sample Code
NPL.load("(gl)script/ide/UIAnim/UIAnimBlock.lua");
local ctl = UIAnimBlock:new{
name = "UIAnimBlock1",
text = "blarrrr",
... = 0,
*** = 300,
};
ctl:getValue(1, 400);
Member Functions
UIAnimBlock:SetConstantKey
if all animated values equals to the key, this animation will be set unused
syntax
function UIAnimBlock:SetConstantKey(key)
parameters
UIAnimBlock:SetConstantKey
if all animated values are very close to a given key, this animation will be set unused
syntax
function UIAnimBlock:SetConstantKey(key, fEpsilon)
parameters
UIAnimBlock:getDefaultValue
default value
syntax
function UIAnimBlock:getDefaultValue()
UIAnimBlock:getValue
get value with motion blending with a specified blending frame.
- param nCurrentAnim : current animation sequence ID
- param currentFrame : an absolute ParaX? frame number denoting the current animation frame. It is always within the range of the current animation sequence's start and end frame number.
- param nBlendingAnim : the animation sequence with which the current animation should be blended.
- param blendingFrame : an absolute ParaX? frame number denoting the blending animation frame. It is always within the range of the blending animation sequence's start and end frame number.
- param blendingFactor : by how much the blending frame should be blended with the current frame.
- 0 will use solely the blending frame, whereas 0.0 will use only the current frame. [0,1), blendingFrame*(blendingFactor)+(1-blendingFactor)*currentFrame
syntax
function UIAnimBlock:getValue(nCurrentAnim, currentFrame, nBlendingAnim, blendingFrame, blendingFactor)
parameters
| nCurrentAnim |
current animation sequence ID |
| currentFrame |
|
| nBlendingAnim |
the animation sequence with which the current animation should be blended. |
| blendingFrame |
|
|
blendingFactor | by how much the blending frame should be blended with the current frame.
-
- 0 will use solely the blending frame, whereas 0.0 will use only the current frame. [0,1), blendingFrame*(blendingFactor)+(1-blendingFactor)*currentFrame |
UIAnimBlock:getValue
it accept anim index of both local and external animation
rangeID: Index.nIndex
time: Index.nCurrentFrame
syntax
function UIAnimBlock:getValue(Index)
parameters
UIAnimBlock:getValue
it accept anim index of both local and external animation
rangeID:
CurrentAnim? .nIndex,
BlendingAnim? .nIndex
time:
CurrentAnim? .nCurrentFrame,
BlendingAnim? .nCurrentFrame
syntax
function UIAnimBlock:getValue(CurrentAnim, BlendingAnim, blendingFactor)
parameters
| CurrentAnim |
|
| BlendingAnim |
|
| blendingFactor |
|
UIAnimBlock:InterpolateLinear
linear interpolation
syntax
function UIAnimBlock:InterpolateLinear(range, v1, v2)
parameters
UIAnimBlock:BlendValues
blend the two values use linear interpolation
syntax
function UIAnimBlock:BlendValues(currentValue, blendingValue, blendingFactor)
parameters
| currentValue |
|
| blendingValue |
|
| blendingFactor |
|
UIAnimBlock:InterpolateHermite
hermite interpolation
syntax
function UIAnimBlock:InterpolateHermite(range, v1, v2, inVal, outVal)
parameters
UI Animation
| Title |
UI Animation |
| Author(s) |
WangTian? |
| Date |
2007/9/30 |
| File |
script/ide/UIAnim/UIAnimFile.lua |
Description
Sample Code
NPL.load("(gl)script/ide/UIAnim/UIAnimFile.lua");
local ctl = UIAnimFile:new{
name = "UIAnimFile1",
text = "blarrrr",
... = 0,
*** = 300,
};
ctl:getValue(1, 400);
UI Object Animation Index
| Title |
UI Object Animation Index |
| Author(s) |
WangTian? |
| Date |
2007/11/1 |
| File |
script/ide/UIAnim/UIAnimIndex.lua |
Description
Sample Code
NPL.load("(gl)script/ide/UIAnim/UIAnimIndex.lua");
Member Functions
UIAnimIndex:new
NPL.load("(gl)script/ide/UIAnim/UIAnimBlock.lua");
if(not
UIAnimIndex? ) then
UIAnimIndex? = {}; end
if(not
AllObjects? ) then
AllObjects? = {}; end
AutoCounter? = 1;
syntax
function UIAnimIndex:new(o)
parameters
UI Object Animation Instance
| Title |
UI Object Animation Instance |
| Author(s) |
WangTian? |
| Date |
2007/11/1 |
| File |
script/ide/UIAnim/UIAnimInstance.lua |
Description
Sample Code
NPL.load("(gl)script/ide/UIAnim/UIAnimInstance.lua");
Member Functions
UIObjectAnimInstance:new
NPL.load("(gl)script/ide/UIAnim/UIAnimBlock.lua");
NPL.load("(gl)script/ide/UIAnim/UIAnimIndex.lua");
if(not
UIObjectAnimInstance? ) then
UIObjectAnimInstance? = {}; end
if(not
AllObjects? ) then
AllObjects? = {}; end
AutoCounter? = 1;
syntax
function UIObjectAnimInstance:new(o)
parameters
UI Animation
| Title |
UI Animation |
| Author(s) |
WangTian? |
| Date |
2007/9/30 |
| File |
script/ide/UIAnim/UIAnimManager.lua |
Description
Sample Code
NPL.load("(gl)script/ide/UIAnim/UIAnimManager.lua");
local ctl = UIAnimManager:new{
name = "UIAnimManager1",
text = "blarrrr",
... = 0,
*** = 300,
};
ctl:getValue(1, 400);
Member Functions
UIAnimManager.LoadUIAnimationFile
load the UI animation file
syntax
function UIAnimManager.LoadUIAnimationFile(fileName)
parameters
UIAnimManager.PlayUIAnimationSequence
play UI animation according to the filename and the animation ID and range ID
function
PlayUIAnimationSingle? (obj, fileName,
AnimID? ,
RangeID? )
---- TODO: load the UI animation file
end
play UI animation according to the filename and the sequence ID
syntax
function UIAnimManager.PlayUIAnimationSequence(obj, fileName, ID, bLooping)
parameters
UIAnimManager.GetUIObjectFromPathString
get the ui object from object path string
path string format: [@index][@index]..
- param string : object path string
syntax
function UIAnimManager.GetUIObjectFromPathString(path)
parameters
UIAnimManager.GetPathStringFromUIObject
get the object path string from the ui object
path string format: [name@][name@]..
syntax
function UIAnimManager.GetPathStringFromUIObject(obj)
parameters
UIAnimManager.DoAnimation
animate the ui objects in the
UIAnimationPool?
syntax
function UIAnimManager.DoAnimation()
UIDirectAnimBlock:new
direct x, y, width, height animation
direct animation block
NOTE: this kind of animation block contains x, y, width and height data required during animation
and a callback function that is called after the animation is complete
if(not
UIDirectAnimBlock? ) then
UIDirectAnimBlock? = {}; end
syntax
function UIDirectAnimBlock:new(o)
parameters
UIDirectAnimBlock:SetUIObject
set direct animation UI object target
NOTE: the direct animation block object only stores the UI object path string
- param obj : the UI object to be animated
syntax
function UIDirectAnimBlock:SetUIObject(obj)
parameters
| obj |
the UI object to be animated |
UIDirectAnimBlock:SetTime
set the animation time duration
- param time : time to complete the animation block
syntax
function UIDirectAnimBlock:SetTime(time)
parameters
| time |
time to complete the animation block |
UIDirectAnimBlock:SetXRange
set the animation X animation
- param src : source position
- param dst : destination position
syntax
function UIDirectAnimBlock:SetXRange(src, dst)
parameters
UIDirectAnimBlock:SetYRange
set the animation Y animation
- param src : source position
- param dst : destination position
syntax
function UIDirectAnimBlock:SetYRange(src, dst)
parameters
UIDirectAnimBlock:SetWidthRange
set the animation width animation
- param src : source width
- param dst : destination width
syntax
function UIDirectAnimBlock:SetWidthRange(src, dst)
parameters
UIDirectAnimBlock:SetHeightRange
set the animation height animation
- param src : source height
- param dst : destination height
syntax
function UIDirectAnimBlock:SetHeightRange(src, dst)
parameters
UIDirectAnimBlock:SetCallback
callback function to call after the animation is complete
- callbackFunc __ : if type function direct call if type string DoString?
syntax
function UIDirectAnimBlock:SetCallback(callbackFunc)
parameters
UIAnimManager.PlayDirectUIAnimation
direct animation pool
ui object in this pool is directly manipulated on the x, y, width, height
NOTE: there is a performance issue if you use this kind of animation instead of
the standard tranlation, scaling, rotation, alpha and color animation.
Events and other interaction related data will be reset on every move.
if(not
UIDirectAnimationPool? ) then
UIDirectAnimationPool? = {}; end
play direct animation
- param block : of type UIDirectAnimBlock? NOTE: one can call this funciton multiple times to append animation block to the previous ones
syntax
function UIAnimManager.PlayDirectUIAnimation(block)
parameters
|
block | of type
UIDirectAnimBlock?
NOTE: one can call this funciton multiple times to append animation block to the previous ones |
UIAnimManager.DoDirectAnimation
animate the ui object in the direct animation pool
this will directly manipulate the ui object's x, y, width, height
NOTE: this function is called by the original
DoAnimation? on every timer animation.
TODO: test performance on some old GPUs
syntax
function UIAnimManager.DoDirectAnimation(dTimeDelta)
parameters
UI Animation
| Title |
UI Animation |
| Author(s) |
WangTian? |
| Date |
2007/9/30 |
| File |
script/ide/UIAnim/UIAnimSeq.lua |
Description
Sample Code
NPL.load("(gl)script/ide/UIAnim/UIAnimSeq.lua");
local ctl = UIAnimSeq:new{
name = "UIAnimSeq1",
text = "blarrrr",
... = 0,
*** = 300,
};
ctl:getValue(1, 400);