# FollowBehavior

Artifact: [androidx.xr.compose:compose](https://developer.android.com/jetpack/androidx/releases/xr-compose) [View Source](https://cs.android.com/search?q=file:androidx/xr/compose/subspace/FollowBehavior.kt+class:androidx.xr.compose.subspace.FollowBehavior) Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02) Deprecated in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)


```
@ExperimentalFollowingSubspaceApi
sealed class FollowBehavior
```

<br />

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
> FollowingSubspace has been deprecated. Migrate to Subspace using androidx.xr.compose.subspace.animation.follow.FollowMode instead.

A FollowBehavior controls the motion of content as it is following another target, such as a user's head. Currently the options include "soft", which gradually catches up to the target and "static", which does not continuously follow the target.

FollowingSubspace has been deprecated. Use `https://developer.android.com/reference/kotlin/androidx/xr/compose/spatial/Subspace.composable#Subspace(androidx.xr.compose.subspace.layout.SubspaceModifier,kotlin.Function1)` with `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/animation/follow/FollowMode` instead.

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/FollowBehavior#DEFAULT_SOFT_DURATION_MS() = 1500` **This property is deprecated.** FollowingSubspace has been deprecated. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/FollowBehavior#MIN_SOFT_DURATION_MS() = 100` **This property is deprecated.** FollowingSubspace has been deprecated. |

| ### Public companion functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/FollowBehavior` | `[Soft](https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/FollowBehavior#Soft(kotlin.Int))(durationMs: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 100) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` **This function is deprecated.** FollowingSubspace has been deprecated. |

| ### Public companion properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/FollowBehavior` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/FollowBehavior#Static()` **This property is deprecated.** FollowingSubspace has been deprecated. |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/FollowBehavior` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/FollowBehavior#Tight()` **This property is deprecated.** FollowingSubspace has been deprecated. |

| ### Protected constructors |
|---|
| `[FollowBehavior](https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/FollowBehavior#FollowBehavior())()` **This function is deprecated.** FollowingSubspace has been deprecated. |

## Constants

### DEFAULT_SOFT_DURATION_MS

```
const val DEFAULT_SOFT_DURATION_MS = 1500: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> FollowingSubspace has been deprecated.

The default duration, in milliseconds, for a soft follow animation.

FollowingSubspace has been deprecated.

### MIN_SOFT_DURATION_MS

```
const val MIN_SOFT_DURATION_MS = 100: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> FollowingSubspace has been deprecated.

The minimum allowable duration in milliseconds for a soft follow animation.

FollowingSubspace has been deprecated.

## Public companion functions

### Soft

Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02) Deprecated in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
fun [Soft](https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/FollowBehavior#Soft(kotlin.Int))(durationMs: @IntRange(from = 100) Int = DEFAULT_SOFT_DURATION_MS): FollowBehavior
```

> [!CAUTION]
> **This function is deprecated.**   
> FollowingSubspace has been deprecated. Migrate to Subspace using androidx.xr.compose.subspace.animation.follow.FollowMode.soft instead.

Creates a behavior where the content smoothly animates to follow the target's movements.

This behavior is driven by a critically damped spring physics model, which uses exponential decay to smoothly decelerate the trailing entity as it approaches the target. The entity will accelerate to catch up and then decelerate without overshoot, simulating real-world physical inertia.

The use of this spring/exponential decay model is not optional, but the total duration of the motion can be configured via `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/FollowBehavior.Companion#Soft(kotlin.Int)`.

FollowingSubspace has been deprecated. Use `https://developer.android.com/reference/kotlin/androidx/xr/compose/spatial/Subspace.composable#Subspace(androidx.xr.compose.subspace.layout.SubspaceModifier,kotlin.Function1)` with `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/animation/follow/FollowMode#soft(androidx.xr.compose.subspace.animation.follow.TrackedDimensions,kotlin.Long,kotlin.Long,androidx.xr.compose.subspace.animation.follow.FollowThresholds)` instead.

| Parameters |
|---|---|
| `durationMs: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 100) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = DEFAULT_SOFT_DURATION_MS` | Amount of milliseconds it takes for the content to catch up to the user. Default is `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/FollowBehavior#DEFAULT_SOFT_DURATION_MS()` milliseconds. A value less than `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/FollowBehavior#MIN_SOFT_DURATION_MS()` will be rounded up to `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/FollowBehavior#MIN_SOFT_DURATION_MS()` to allow enough time to complete the content movement. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/FollowBehavior` | A `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/FollowBehavior` instance configured for soft following. |

## Public companion properties

### Static

Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02) Deprecated in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
val Static: FollowBehavior
```

> [!CAUTION]
> **This property is deprecated.**   
> FollowingSubspace has been deprecated. Migrate to Subspace using androidx.xr.compose.subspace.animation.follow.FollowMode.snap instead.

The content is placed once based on the target's initial pose and does not follow subsequent movements.

FollowingSubspace has been deprecated. Use `https://developer.android.com/reference/kotlin/androidx/xr/compose/spatial/Subspace.composable#Subspace(androidx.xr.compose.subspace.layout.SubspaceModifier,kotlin.Function1)` with `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/animation/follow/FollowMode#snap(androidx.xr.compose.subspace.animation.follow.TrackedDimensions)` instead.

### Tight

Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02) Deprecated in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
val Tight: FollowBehavior
```

> [!CAUTION]
> **This property is deprecated.**   
> FollowingSubspace has been deprecated. Migrate to Subspace using androidx.xr.compose.subspace.animation.follow.FollowMode.tight instead.

The content follows the target as closely as possible.

FollowingSubspace has been deprecated. Use `https://developer.android.com/reference/kotlin/androidx/xr/compose/spatial/Subspace.composable#Subspace(androidx.xr.compose.subspace.layout.SubspaceModifier,kotlin.Function1)` with `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/animation/follow/FollowMode#tight(androidx.xr.compose.subspace.animation.follow.TrackedDimensions)` instead.

## Protected constructors

### FollowBehavior

```
protected [FollowBehavior](https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/FollowBehavior#FollowBehavior())()
```

> [!CAUTION]
> **This function is deprecated.**   
> FollowingSubspace has been deprecated. Migrate to Subspace using androidx.xr.compose.subspace.animation.follow.FollowMode instead.