MagicTween icon indicating copy to clipboard operation
MagicTween copied to clipboard

How to Tween from the middle?

Open KazukiKuriyama opened this issue 2 years ago • 4 comments

Is there a way to start from a time in the middle of defining Tween? For example, I want to start from the 0.5 second point in the code below (currentValue==0.5f) and transition to 1 in the remaining 0.5 seconds.

        float x = 0;
        await Tween.To(
            () => 0,
            currentValue1 => x = currentValue1,
            1,
            1
        );

KazukiKuriyama avatar Sep 29 '23 20:09 KazukiKuriyama

There is currently no way to move halfway through Tween. However, you can use Tween.FromTo instead. For example:

float x = 0;
await Tween.FromTo(
    currentValue1 => x = currentValue1,
    0.5f // start value
    1f, // end value
    0.5f // duration
);

nuskey8 avatar Sep 30 '23 00:09 nuskey8

すみません、説明が不足していました。 Tweenの定義部分の変更をを行わずにDOTweenでいうところのtween.Gotoのスキップ機能を使いたいです。

KazukiKuriyama avatar Sep 30 '23 10:09 KazukiKuriyama

現バージョンではGotoに相当する機能は存在しません。 今後のバージョンで追加を予定しています。

nuskey8 avatar Oct 01 '23 00:10 nuskey8

いくつかの実装を検討した結果、この機能の追加はMagic Tweenの設計上難しいことが判明しました。 引き続き検討を続けていきますが、将来的にGotoがサポートされない可能性があります。

nuskey8 avatar Nov 05 '23 02:11 nuskey8