Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Time property and Preserve() method to MotionHandle #146

Merged
merged 11 commits into from
Nov 23, 2024

Conversation

AnnulusGames
Copy link
Owner

@AnnulusGames AnnulusGames commented Nov 23, 2024

This PR adds a Time property to the MotionHandle, which allows you to manually control the playback of individual motions.

It also adds a Preserve() method to the MotionHandle, so that it won't be automatically destroyed after the motion is complete.

Example

public class Example : MonoBehaviour
{
    [SerializeField] Transform target;
    [SerializeField] Slider slider;

    MotionHandle handle;

    void Start()
    {
        handle = LMotion.Create(-5f, 5f, 1f)
            .WithEase(Ease.OutQuad)
            .BindToPositionX(target)
            .AddTo(target);

        handle.Preserve();
    }

    void Update()
    {
        handle.Time = slider.value;
    }
}

@AnnulusGames AnnulusGames changed the base branch from main to v2.0 November 23, 2024 12:54
@AnnulusGames AnnulusGames changed the title Add MotionHandle.Time property Add Time property and Preserve() method to MotionHandle Nov 23, 2024
@AnnulusGames AnnulusGames merged commit 46bedd5 into v2.0 Nov 23, 2024
@AnnulusGames AnnulusGames deleted the add-motionhandle-time-property branch November 23, 2024 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant