# R3MotionExtensions

Expose tween values from a builder as an R3 Observable, bind values to a ReactiveProperty or register disposal.

Namespace: MeatMotion

Assembly: MeatMotion.Integrations.R3

```csharp
public static class R3MotionExtensions
```

Requires org.nuget.r3 / com.cysharp.r3

[Runtime/Integrations/R3/R3MotionExtensions.cs · L6](../../../source/Runtime/Integrations/R3/R3MotionExtensions.cs.html#L6)

## ToObservable

Bind the builder and expose its values as a stream. Both motion completion and cancellation finish the stream.

```csharp
public static Observable<float> ToObservable(this FloatMotionBuilder builder)
```

Parameters and return value

- `builder` (`this FloatMotionBuilder`) Configured builder, passed as the receiver for extension calls.
- Returns: `Observable<float>`

[Runtime/Integrations/R3/R3MotionExtensions.cs · L8](../../../source/Runtime/Integrations/R3/R3MotionExtensions.cs.html#L8)

```csharp
public static Observable<TValue> ToObservable<TValue, TOptions, TAdapter>(this MotionBuilder<TValue, TOptions, TAdapter> builder)
    where TValue : unmanaged
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<TValue, TOptions>
```

Parameters and return value

- `builder` (`this MotionBuilder<TValue, TOptions, TAdapter>`) Configured builder, passed as the receiver for extension calls.
- Returns: `Observable<TValue>`

[Runtime/Integrations/R3/R3MotionExtensions.cs · L11](../../../source/Runtime/Integrations/R3/R3MotionExtensions.cs.html#L11)

## BindToReactiveProperty

Write each interpolated value into the supplied ReactiveProperty.

```csharp
public static MotionHandle BindToReactiveProperty(this FloatMotionBuilder builder, ReactiveProperty<float> reactiveProperty)
```

Parameters and return value

- `builder` (`this FloatMotionBuilder`) Configured builder, passed as the receiver for extension calls.
- `reactiveProperty` (`ReactiveProperty<float>`) Reactive property that receives each sampled value.
- Returns: `MotionHandle`

[Runtime/Integrations/R3/R3MotionExtensions.cs · L21](../../../source/Runtime/Integrations/R3/R3MotionExtensions.cs.html#L21)

```csharp
public static MotionHandle BindToReactiveProperty<TValue, TOptions, TAdapter>(this MotionBuilder<TValue, TOptions, TAdapter> builder, ReactiveProperty<TValue> reactiveProperty)
    where TValue : unmanaged
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<TValue, TOptions>
```

Parameters and return value

- `builder` (`this MotionBuilder<TValue, TOptions, TAdapter>`) Configured builder, passed as the receiver for extension calls.
- `reactiveProperty` (`ReactiveProperty<TValue>`) Reactive property that receives each sampled value.
- Returns: `MotionHandle`

[Runtime/Integrations/R3/R3MotionExtensions.cs · L24](../../../source/Runtime/Integrations/R3/R3MotionExtensions.cs.html#L24)

## AddTo

Register the handle in an R3 disposable container and apply disposeBehavior on disposal.

```csharp
public static MotionHandle AddTo(this MotionHandle handle, CompositeDisposable disposable, DisposeBehavior disposeBehavior = DisposeBehavior.Cancel)
```

Parameters and return value

- `handle` (`this MotionHandle`) Handle to control or link.
- `disposable` (`CompositeDisposable`) R3 container that owns disposal of the handle.
- `disposeBehavior = DisposeBehavior.Cancel` (`DisposeBehavior`) Action to apply when the registered IDisposable is disposed.
- Returns: `MotionHandle`

[Runtime/Integrations/R3/R3MotionExtensions.cs · L28](../../../source/Runtime/Integrations/R3/R3MotionExtensions.cs.html#L28)

```csharp
public static MotionHandle AddTo(this MotionHandle handle, SerialDisposable disposable, DisposeBehavior disposeBehavior = DisposeBehavior.Cancel)
```

Parameters and return value

- `handle` (`this MotionHandle`) Handle to control or link.
- `disposable` (`SerialDisposable`) R3 container that owns disposal of the handle.
- `disposeBehavior = DisposeBehavior.Cancel` (`DisposeBehavior`) Action to apply when the registered IDisposable is disposed.
- Returns: `MotionHandle`

[Runtime/Integrations/R3/R3MotionExtensions.cs · L34](../../../source/Runtime/Integrations/R3/R3MotionExtensions.cs.html#L34)

```csharp
public static MotionHandle AddTo(this MotionHandle handle, ref DisposableBag disposable, DisposeBehavior disposeBehavior = DisposeBehavior.Cancel)
```

Parameters and return value

- `handle` (`this MotionHandle`) Handle to control or link.
- `disposable` (`ref DisposableBag`) R3 container that owns disposal of the handle.
- `disposeBehavior = DisposeBehavior.Cancel` (`DisposeBehavior`) Action to apply when the registered IDisposable is disposed.
- Returns: `MotionHandle`

[Runtime/Integrations/R3/R3MotionExtensions.cs · L40](../../../source/Runtime/Integrations/R3/R3MotionExtensions.cs.html#L40)

```csharp
public static MotionHandle AddTo(this MotionHandle handle, ref DisposableBuilder disposable, DisposeBehavior disposeBehavior = DisposeBehavior.Cancel)
```

Parameters and return value

- `handle` (`this MotionHandle`) Handle to control or link.
- `disposable` (`ref DisposableBuilder`) R3 container that owns disposal of the handle.
- `disposeBehavior = DisposeBehavior.Cancel` (`DisposeBehavior`) Action to apply when the registered IDisposable is disposed.
- Returns: `MotionHandle`

[Runtime/Integrations/R3/R3MotionExtensions.cs · L46](../../../source/Runtime/Integrations/R3/R3MotionExtensions.cs.html#L46)
