LockingBehavior
@ExperimentalUserSubspaceApi
abstract class LockingBehavior
A LockingBehavior controls the motion of content as it is following (or "locked" to) another entity, such as a user's head. Currently the options include "static", which does not continuously follow the target, and "lazy", which gradually catches up to the target.
Summary
Constants |
|
|---|---|
const Int |
DEFAULT_LAZY_DURATION_MS = 1500 |
const Long |
MIN_LAZY_DURATION_MS = 100 |
Public companion functions |
|
|---|---|
LockingBehavior |
Creates a behavior where the content smoothly animates to follow the user's movements, creating a comfortable "lazy follow" effect. |
LockingBehavior |
static()The content is placed once based on the user's initial pose and does not follow subsequent movements. |
Protected properties |
|
|---|---|
Pose |
Constants
Public companion functions
lazy
fun lazy(durationMs: @IntRange(from = 100) Int = DEFAULT_LAZY_DURATION_MS): LockingBehavior
Creates a behavior where the content smoothly animates to follow the user's movements, creating a comfortable "lazy follow" effect. This is implemented with the Hermite easing algorithm, which accelerates the content then slows it down towards the end of the motion, giving it a sense of real world physics. The use of the Hermite algorithm is not optional but the total duration of the motion can be modified.
| Parameters | |
|---|---|
durationMs: @IntRange(from = 100) Int = DEFAULT_LAZY_DURATION_MS |
Amount of milliseconds it takes for the content to catch up to the user. Default is |
| Returns | |
|---|---|
LockingBehavior |
A |
static
fun static(): LockingBehavior
The content is placed once based on the user's initial pose and does not follow subsequent movements.