# FollowTarget

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/animation/follow/FollowTarget.kt+class:androidx.xr.compose.subspace.animation.follow.FollowTarget) Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)


```
@ExperimentalFollowingSubspaceApi
abstract class FollowTarget
```

<br />

*** ** * ** ***

A FollowTarget can be used to have an element follow a target such as an anchor or view.

## Summary

| ### Public companion functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/animation/follow/FollowTarget` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/animation/follow/FollowTarget#anchor(androidx.xr.arcore.Anchor,androidx.xr.compose.subspace.animation.follow.FollowMode)(anchor: https://developer.android.com/reference/kotlin/androidx/xr/arcore/Anchor, mode: https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/animation/follow/FollowMode)` Targeting an anchor allows content to be positioned relative to that anchor's location. |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/animation/follow/FollowTarget` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/animation/follow/FollowTarget#view(androidx.xr.compose.subspace.animation.follow.FollowMode)(mode: https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/animation/follow/FollowMode)` By designating content to follow the user's view, it will keep that content near the user and typically within the field of view, even as the user moves around. |

## Public companion functions

### anchor

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

```
fun anchor(anchor: Anchor, mode: FollowMode = FollowMode.tight()): FollowTarget
```

Targeting an anchor allows content to be positioned relative to that anchor's location.

| Parameters |
|---|---|
| `anchor: https://developer.android.com/reference/kotlin/androidx/xr/arcore/Anchor` | represents the anchor which the trailing element will be tethered to. As the anchor moves, so will the element. |
| `mode: https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/animation/follow/FollowMode = FollowMode.tight()` | determines how the trailing element follows the target. It can be made to move faster and be more responsive. The default is FollowMode.tight(). |

### view

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

```
fun view(mode: FollowMode = FollowMode.soft()): FollowTarget
```

By designating content to follow the user's view, it will keep that content near the user and typically within the field of view, even as the user moves around.

| Parameters |
|---|---|
| `mode: https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/animation/follow/FollowMode = FollowMode.soft()` | determines how the trailing element follows the target. It can be made to move faster and be more responsive. The default is FollowMode.soft(). |