Trouble with AppendInterval timing
« on: February 15, 2016, 01:00:25 AM »
I'm trying to create a strobing platform using the following Sequence:

Code: [Select]
_seq = DOTween.Sequence()
            .SetLoops(-1, LoopType.Restart)                 // loop forever
            .Append(_ren.DOFade(1f, 0))                     // instantly fade the sprite renderer to 100% opaque
            .AppendCallback(() => _coll.enabled = true)     // enable the platform collider
            .AppendInterval(StrobeOnTime)                   // wait for the designated "platform on" time
            .Append(_ren.DOFade(0.25f, 0))                  // instantly fade the sprite renderer to 25% opaque
            .AppendCallback(() => _coll.enabled = false)    // disable the platform collider
            .AppendInterval(StrobeOffTime);                 // wait the designated "platform off" time

The idea is to have a platform that's "on" (opaque, collider enabled) for a given amount of time and then "off" (see through, collider disabled) for a given amount of time - and loop forever.

The above works as expected, except the two "intervals" don't seem right.  If I set the two values equally, the last one (StrobeOffTiime) is always shorter than the first one.  I'm not exactly sure which one is wrong, but the timing is not as expected.

Is there anything wrong with the above?


Re: Trouble with AppendInterval timing
« Reply #1 on: February 16, 2016, 07:29:18 PM »
So, the timing issue in the above Sequence seems to be caused by the Ease setting.  If I change the ease to "Linear" and change the StrobeOnTime and StrobeOffTime properties to be the same value (say, 1 second), the on/off times look reasonably equivalent (visually).

That said, I don't understand why the Ease setting has any bearing on this particular Sequence, since it's made up of only:

- zero-length tweens
- callbacks
- intervals

Why does an ease setting impact any of the above?  Seems wrong to me, but maybe I'm missing something...
« Last Edit: February 16, 2016, 09:17:55 PM by jgodfrey »

Trouble with AppendInterval t
« Reply #2 on: March 02, 2016, 06:49:25 AM »
As Forest Gump said I'm not a smart man  and The only thing I brought up was The Drinking and Racing and you know that's wrong
30 !!! !!!