Skip to content

TransformSequence.Expire() doesn't work correctly in nested sequences #2941

@smoogipoo

Description

@smoogipoo
public class TestSceneScratch : FrameworkTestScene
{
    [Test]
    public void TestMethod1() => AddStep("reset", () =>
    {
        var box = new Box { Size = new Vector2(100) };

        Child = box;

        using (box.BeginAbsoluteSequence(Time.Current - 1000))
        {
            box.FadeColour(Color4.Green) // Transform in the past
               .Delay(2000).FadeColour(Color4.White) // Transform a little in the future
               .Delay(10000).Expire(true); // Delay is not important
        }
    });

    [Test]
    public void TestMethod2() => AddStep("reset", () =>
    {
        var box = new Box { Size = new Vector2(100) };

        Child = box;

        using (box.BeginAbsoluteSequence(Time.Current - 1000))
        {
            box.FadeColour(Color4.Green).Expire(true); // Transform in the past

            box.Delay(2000).FadeColour(Color4.White) // Transform a little in the future
               .Delay(10000).Expire(); // Delay is not important
        }
    });
}

Both of the methods above are expected to work exactly the same, however only method 2 provides the expected result. The lifetime of the box is expected to be the full range of green -> white.

It seems like since the past transform is immediately applied (due to endtime < current time), the .Expire(true) call from a nested TransformSequence does not consider it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions