Make animation time of subspan relative.
This commit is contained in:
@@ -9,7 +9,6 @@ namespace Cryville.Crtr.Components {
|
||||
SubmitProperty("iteration", new PropOp.Float(v => Iteration = v));
|
||||
SubmitProperty("direction", new PropOp.Enum<AnimationDirection>(v => Direction = v, v => (AnimationDirection)v));
|
||||
SubmitProperty("delay", new PropOp.Float(v => Delay = v));
|
||||
_rtimeSrc = new PropSrc.Float(() => _rtime);
|
||||
Iteration = 1;
|
||||
}
|
||||
|
||||
@@ -42,8 +41,6 @@ namespace Cryville.Crtr.Components {
|
||||
public float Delay { get; private set; }
|
||||
|
||||
double _startTime;
|
||||
float _rtime;
|
||||
readonly PropSrc _rtimeSrc;
|
||||
|
||||
public override void Init() {
|
||||
_skinContext = new SkinContext(transform);
|
||||
@@ -52,7 +49,7 @@ namespace Cryville.Crtr.Components {
|
||||
_startTime = time;
|
||||
}
|
||||
public override void Tick(SkinContainer c, double time) {
|
||||
_rtime = (float)(time - _startTime - Delay) / Duration;
|
||||
float _rtime = (float)(time - _startTime - Delay) / Duration;
|
||||
if (_rtime < 0) _rtime = 0;
|
||||
else if (_rtime > Iteration) {
|
||||
if (Direction.HasFlag(AnimationDirection.alternate)) {
|
||||
@@ -74,10 +71,7 @@ namespace Cryville.Crtr.Components {
|
||||
}
|
||||
}
|
||||
if (Direction.HasFlag(AnimationDirection.reverse)) _rtime = 1 - _rtime;
|
||||
_rtimeSrc.Invalidate();
|
||||
ChartPlayer.etor.ContextSelfValue = _rtimeSrc;
|
||||
if (_anim != null) c.MatchAnimation(_anim, _rtime, new RuntimeSkinContext(_skinContext));
|
||||
ChartPlayer.etor.ContextSelfValue = null;
|
||||
}
|
||||
protected override void OnDestroy() { }
|
||||
}
|
||||
|
Reference in New Issue
Block a user