---
name: "Animation.translateX"
mode: "api"
versionRequirements:
  - { name: "Base Library", version: "2.21.8" }
title: "Animation.translateX - 对 X 轴平移"
---

## Animation.translateX

> [VERSION] Base Library >= 2.21.8

### Description

Translate along the X axis

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `translateX` | `number` | No | Translation distance on the X axis, in px |

### Return Value

Type: `Animation`

Animation instance

### Examples

#### X-axis translation

```ts
Page({
  data: {
    animationData: {},
  },
  onReady() {
    const animation = ty.createAnimation({ duration: 500 });
    animation.translateX(100).step();
    this.setData({ animationData: animation.export() });
  },
});
```
