UITweener:动画组件基类,通过enabled控制动画的开始结束
Begin-enable-Update-DoUpdate-Sample
property:
method:轨迹,例如透明度线性变化、递增变化等
style:循环方式,单次不循环、循环(头-尾,头-尾)、PingPong(头-尾,尾-头)
animationCurve:渐变轨迹
ignoreTimeScale:游戏暂停时,是否继续播放动画
delay:启动延迟,Play后几秒开始动画
duration:动画持续时间,不包括delay时间
mStarted/mStartTime:动画运行时属性,是否开始、开始事件
mAmountPerDelta:每帧播放进度,1/duration
mFactor: mFactor += amountPerDelta * delta,当前动画播放的进度,这边值的正负代表方向
function:
DoUpdate:计算factor,然后根据style修正mFactor,计算动画是否结束,调用Sample
Sample:针对Method类型修正最终的进度值,通过OnUpdate把factor进度、isFinished通知子类
public float value { set { if (!mCached) Cache(); if (mRect != null) { mRect.alpha = value; } else if (mSr != null) { Color c = mSr.color; c.a = value; mSr.color = c; } else if (mMat != null) { Color c = mMat.color; c.a = value; mMat.color = c; } else if (mLight != null) { mLight.intensity = mBaseIntensity * value; } } }
原文:https://www.cnblogs.com/wang-jin-fu/p/13509114.html