FloatMotionBuilder
Configure a float tween created by MMotion.Create. A stateful Bind passes the target to the setter without a captured lambda.
public struct FloatMotionBuilderFloatMotionBuilder.cs · L11Members
- WithScheduler
- ToMotionSettings
- AsMotionBuilder
- WithEase
- WithImmediateBind
- WithCancelOnError
- WithDelay
- WithLoops
- WithOnLoopComplete
- WithOnComplete
- WithDebugName
- WithOnCancel
- RunWithoutBinding
- Bind
WithScheduler
Choose the automatic update phase or manual world before binding.
public FloatMotionBuilder WithScheduler(MotionWorld world)Parameters and return value
worldMotionWorldMotionWorld in which to schedule the tween.- Returns
FloatMotionBuilder
public FloatMotionBuilder WithScheduler(IMotionScheduler scheduler)Parameters and return value
schedulerIMotionSchedulerScheduler that determines where the motion is registered and updated.- Returns
FloatMotionBuilder
ToMotionSettings
Capture the configuration before binding and pass it to MMotion.Create to reuse it.
public MotionSettings<float, NoOptions> ToMotionSettings()Return value
AsMotionBuilder
Copy the current configuration into a single-use generic float builder.
public MotionBuilder<float, NoOptions, FloatMotionAdapter> AsMotionBuilder()Return value
WithEase
Choose the curve that maps normalized time to progress. When used with Bind, an AnimationCurve is sampled from a snapshot taken at bind time.
public FloatMotionBuilder WithEase(Easing easing)Parameters and return value
easingEasingEasing function mapping normalized time to progress.- Returns
FloatMotionBuilder
public FloatMotionBuilder WithEase(Ease ease)Parameters and return value
easeEaseEasing function mapping normalized time to progress.- Returns
FloatMotionBuilder
public FloatMotionBuilder WithEase(AnimationCurve animationCurve)Parameters and return value
animationCurveAnimationCurveUnity AnimationCurve with its keys and pre/post wrap modes.- Returns
FloatMotionBuilder
WithImmediateBind
Pass false to suppress the initial write at bind time, for example on a later sequence child targeting the same property.
public FloatMotionBuilder WithImmediateBind(bool enabled = true)Parameters and return value
enabled = trueboolWhether to enable this setting.- Returns
FloatMotionBuilder
WithCancelOnError
Choose whether an exception from the bound setter cancels this tween.
public FloatMotionBuilder WithCancelOnError(bool enabled = true)Parameters and return value
enabled = trueboolWhether to enable this setting.- Returns
FloatMotionBuilder
WithDelay
Set a delay in seconds and choose which loops receive it. skipValuesDuringDelay controls writes while waiting.
public FloatMotionBuilder WithDelay(float delay, DelayType delayType = DelayType.FirstLoop, bool skipValuesDuringDelay = true)Parameters and return value
delayfloatDelay before interpolation, in seconds.delayType = DelayType.FirstLoopDelayTypeApply the delay once or before every loop.skipValuesDuringDelay = trueboolWhether to skip setter writes during a delay.- Returns
FloatMotionBuilder
WithLoops
Set the loop count and LoopType. Stop an infinite loop by canceling it.
public FloatMotionBuilder WithLoops(int loops, LoopType loopType = LoopType.Restart)Parameters and return value
loopsintLoop count. Use -1 for an infinite loop.loopType = LoopType.RestartLoopTypeHow progress is evaluated on successive passes.- Returns
FloatMotionBuilder
WithOnLoopComplete
Register a callback that receives the completed loop count at a loop boundary.
public FloatMotionBuilder WithOnLoopComplete(Action<int> callback)Parameters and return value
callbackAction<int>Register a callback that receives the completed loop count at a loop boundary.- Returns
FloatMotionBuilder
WithOnComplete
Register work to run on completion, including explicit completion.
public FloatMotionBuilder WithOnComplete(Action action)Parameters and return value
actionActionRegister work to run on completion, including explicit completion.- Returns
FloatMotionBuilder
WithDebugName
Set a name for identifying the tween in the Editor or a Development Build.
public FloatMotionBuilder WithDebugName(string debugName)Parameters and return value
debugNamestringName used to identify the tween while debugging.- Returns
FloatMotionBuilder
WithOnCancel
Register work to run when the motion is canceled.
public FloatMotionBuilder WithOnCancel(Action action)Parameters and return value
actionActionRegister work to run when the motion is canceled.- Returns
FloatMotionBuilder
RunWithoutBinding
Schedule without a value setter and return a handle for timing and callbacks.
public MotionHandle RunWithoutBinding()Return value
- Returns
MotionHandle
Bind
Schedule the tween with a value setter. Stateful overloads pass the bound state after the interpolated value.
public MotionHandle Bind(Action<float> setter)Parameters and return value
setterAction<float>Callback receiving the sampled value.- Returns
MotionHandle
public MotionHandle Bind<T>(T state, Action<float, T> setter)
where T : classParameters and return value
stateTState passed to the setter after the interpolated value.setterAction<float, T>Callback receiving the sampled value.- Returns
MotionHandle
public MotionHandle Bind<T1, T2>(T1 state0, T2 state1, Action<float, T1, T2> setter)
where T1 : class
where T2 : classParameters and return value
state0T1State passed to the setter after the interpolated value.state1T2State passed to the setter after the interpolated value.setterAction<float, T1, T2>Callback receiving the sampled value.- Returns
MotionHandle
public MotionHandle Bind<T1, T2, T3>(T1 state0, T2 state1, T3 state2, Action<float, T1, T2, T3> setter)
where T1 : class
where T2 : class
where T3 : classParameters and return value
state0T1State passed to the setter after the interpolated value.state1T2State passed to the setter after the interpolated value.state2T3State passed to the setter after the interpolated value.setterAction<float, T1, T2, T3>Callback receiving the sampled value.- Returns
MotionHandle
Related types
- AudioMotionExtensions
- CameraMotionExtensions
- LoggerMotionExtensions
- MaterialMotionExtensions
- ProgressMotionExtensions
- RectTransformMotionExtensions
- Rigidbody2DMotionExtensions
- RigidbodyMotionExtensions
- SpriteRendererMotionExtensions
- TextMeshProMotionExtensions
- TransformMotionExtensions
- UGUIMotionExtensions
- UIToolkitMotionExtensions
- VisualEffectMotionExtensions
- VolumeMotionExtensions
- MotionBuilderExtensions
- R3MotionExtensions
- UniRxMotionExtensions
- UniTaskMotionExtensions
MeatMotion