---
title: "TextMotion"
description: "Defines ways to render and place glyphs to provide readability and smooth animations for text."
type: "class"
---

<div class='type'>Class</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
expect class TextMotion
```


Defines ways to render and place glyphs to provide readability and smooth animations for text.


## Companion Object

#### Properties

<div class='sourceset sourceset-common'>Common</div>


```kotlin
val Static: TextMotion
```


Optimizes glyph shaping, placement, and overall rendering for maximum readability.
Intended for text that is not animated. This is the default `TextMotion`.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val Animated: TextMotion
```


Text is rendered for maximum linearity which provides smooth animations for text.
Trade-off is the readability of the text on some low DPI devices, which still should not
be a major concern. Use this `TextMotion` if you are planning to scale, translate, or
rotate text.




<div class='sourceset sourceset-android'>Android</div>


```kotlin
actual class TextMotion
internal constructor(
    internal val linearity: Linearity,
    internal val subpixelTextPositioning: Boolean,
)
```


Implementation of possible TextMotion configurations on Android.


## Companion Object

#### Properties

<div class='sourceset sourceset-android'>Android</div>


```kotlin
actual val Static: TextMotion
```


<div class='sourceset sourceset-android'>Android</div>


```kotlin
actual val Animated: TextMotion
```




## Code Examples

### TextMotionSample
```kotlin
/**
 * This sample demonstrates how to define TextMotion on a Text composable that scales up and down
 * repeatedly.
 */
@Composable
fun TextMotionSample() {
    val infiniteTransition = rememberInfiniteTransition()
    val scale by
        infiniteTransition.animateFloat(
            initialValue = 1f,
            targetValue = 8f,
            animationSpec = infiniteRepeatable(tween(1000), RepeatMode.Reverse),
        )
    Text(
        text = "Hello",
        modifier =
            Modifier.graphicsLayer {
                scaleX = scale
                scaleY = scale
                transformOrigin = TransformOrigin.Center
            },
        // Text composable does not take TextMotion as a parameter.
        // Provide it via style argument but make sure that we are copying from current theme
        style = LocalTextStyle.current.copy(textMotion = TextMotion.Animated),
    )
}
```

