---
name: "Animation.backgroundColor"
mode: "api"
versionRequirements:
  - { name: "基础库", version: "2.21.8" }
title: "Animation.backgroundColor - 设置背景色"
---

## Animation.backgroundColor

> [VERSION] 基础库 >= 2.21.8

### 描述

设置背景色

### 参数

`Params`

| 参数 | 类型 | 必填 | 描述 |
| --- | --- | --- | --- |
| `color` | `string` | 是 | 颜色值 |

### 返回值

类型: `Animation`

Animation 实例

### 示例代码

#### 设置背景色

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