-
Notifications
You must be signed in to change notification settings - Fork 119
Open
Description
This repo is great, especially with the "native" async/awaitable/cancellation token handling, but I really miss some of the other tweening library APIs that make it easy to tween from the current value to a target.
Eg Dotweens: transform.DOPositionTo(targetValue, duration) method.
I've made an extension methods to do something similar in LitMotion:
public static MotionHandle LMPositionTo( this Transform transform,
Vector3 targetPosition,
float duration,
Action<MotionBuilder<Vector3, NoOptions, Vector3MotionAdapter>> addSettingsCallback = null ) {
var motionBuilder = LMotion.Create( transform.position, targetPosition, duration );
addSettingsCallback?.Invoke( motionBuilder );
return motionBuilder.BindToPosition( transform );
}Which can be called like:
transform.LMPositionTo( Vector3.zero, 5f )or
transform.LMPositionTo( Vector3.zero, 5f, m => m.WithEase( Ease.OutCubic ) )But it's a bit clunky having to workaround the current API. Would be great to have something similar (or at least a From binding) built in! If not, hope this helps someone
Metadata
Metadata
Assignees
Labels
No labels