动画修改器(modifier)有很多种,常用的有一下几种:
1.AlphaModifier:透明度修改器,有以下几种构造:
- <font color="#000"><font face="Arial">public AlphaModifier(final float pDuration, final float pFromAlpha, final float pToAlpha) {
- this(pDuration, pFromAlpha, pToAlpha, null, EaseLinear.getInstance());
- }
- public AlphaModifier(final float pDuration, final float pFromAlpha, final float pToAlpha, final IEaseFunction pEaseFunction) {
- this(pDuration, pFromAlpha, pToAlpha, null, pEaseFunction);
- }
- public AlphaMod</font></font>ifier(final float pDu<font color="#000"><font face="Arial">ration, final float pFromAlpha, final float pToAlpha, final IEntityModifierListener pEntityModifierListener) {
- super(pDuration, pFromAlpha, pToAlpha, pEntityModifierListener, EaseLinear.getInstance());
- }
- public AlphaModifier(final float pDuration, final float pFromAlpha, final float pToAlpha, final IEntityModifierListener pEntityModifierListener, final IEaseFunction pEaseFunction) {
- super(pDuration, pFromAlpha, pToAlpha, pEntityModifierListener, pEaseFunction);
- }
- protected AlphaModifier(final AlphaModifier pAlphaModifier) {
- super(pAlphaModifier);
- }</font></font>
复制代码
pDuration代表动画修改周期,就是就是完成整个透明度变化所要的时间,单位为秒.
pFromAlpha代表起始透明度
pToAlpha代表目标透明度
2.ScaleModifier,比例修改器.主要是对动画的大小比例进行修改:
- public ScaleModifier(final float pDuration, final float pFromScale, final float pToScale) {
- this(pDuration, pFromScale, pToScale, null, EaseLinear.getInstance());
- }
- public ScaleModifier(final float pDuration, final float pFromScale, final float pToScale, final IEaseFunction pEaseFunction) {
- this(pDuration, pFromScale, pToScale, null, pEaseFunction);
- }
- public ScaleModifier(final float pDuration, final float pFromScale, final float pToScale, final IEntityModifierListener pEntityModifierListener) {
- this(pDuration, pFromScale, pToScale, pFromScale, pToScale, pEntityModifierListener, EaseLinear.getInstance());
- }
- public ScaleModifier(final float pDuration, final float pFromScale, final float pToScale, final IEntityModifierListener pEntityModifierListener, final IEaseFunction pEaseFunction) {
- this(pDuration, pFromScale, pToScale, pFromScale, pToScale, pEntityModifierListener, pEaseFunction);
- }
- public ScaleModifier(final float pDuration, final float pFromScaleX, final float pToScaleX, final float pFromScaleY, final float pToScaleY) {
- this(pDuration, pFromScaleX, pToScaleX, pFromScaleY, pToScaleY, null, EaseLinear.getInstance());
- }
- public ScaleModifier(final float pDuration, final float pFromScaleX, final float pToScaleX, final float pFromScaleY, final float pToScaleY, final IEaseFunction pEaseFunction) {
- this(pDuration, pFromScaleX, pToScaleX, pFromScaleY, pToScaleY, null, pEaseFunction);
- }
- public ScaleModifier(final float pDuration, final float pFromScaleX, final float pToScaleX, final float pFromScaleY, final float pToScaleY, final IEntityModifierListener pEntityModifierListener) {
- super(pDuration, pFromScaleX, pToScaleX, pFromScaleY, pToScaleY, pEntityModifierListener, EaseLinear.getInstance());
- }
- public ScaleModifier(final float pDuration, final float pFromScaleX, final float pToScaleX, final float pFromScaleY, final float pToScaleY, final IEntityModifierListener pEntityModifierListener, final IEaseFunction pEaseFunction) {
- super(pDuration, pFromScaleX, pToScaleX, pFromScaleY, pToScaleY, pEntityModifierListener, pEaseFunction);
- }
- protected ScaleModifier(final ScaleModifier pScaleModifier) {
- super(pScaleModifier);
- }
复制代码
pDuration代表动画修改周期,就是就是完成整个变化所要的时间,单位为秒.
pFromScale代表起始透大小比例
pToScale代表目标大小比例
3.位置相关的Modifier:
MoveModifier(final float pDuration ,final float pFromX,final float pToX,final float pFromY,final float pToY,final IEntityModifierListener pEntityModifierListener,final IEaseFunction pEaseFunction)
红色为可选参数,表示修改器的完成时的监听回调和缓动函数
pDuration为移动所持续的秒数。
除此之外,还有MoveXModifier(...),及MoveYModifier(...),顾名思义,当实体只要在一个正交方向上移动时可以使用。
4.延迟相关的Modifier:
DelayModifier(final float pDurationfinal IEntityModifierListener pEntityModifierListener)
pDuration为延迟的时间, pEntityModifierListener会在延迟动作完成时回调。
5.旋转相关的Modifier:
RotationModifier(float pDuration, float pFromRotation, float pToRotation)
R otationAtModifie(...)
6.透明度相关的Modifier:
AlphaModifier(float pDuration, float pFromAlpha, float pToAlpha)
7.颜色相关的Modifier:
ColorModofier(....)
8.Modifier的组合
有时候,仅仅一种效果是不够用的。此时,就需要构建一系列的Modifier组合来改变。
ParallelEntityModifier:当需要对某个Entity同时应用两个以上Modifier时使用
ParallelEntityModifier(IEntityModifier... pEntityModifiers)
SequenceEntityModifier:当需要对某个Entity顺序地应用两个以上Modfier时使用
SequenceEntityModifier(IEntityModifier... pEntityModifiers)
http://www.eoeandroid.com/forum-863-1.html
OGEngine使用Modifier修改动画