# createAnimation

Call createAnimation(Object object) to create an animation instance `animation`. You can describe the animation by chaining instance methods, and finally export the animation data through the `step` and `export` methods and pass it to the `animation` property of the component.

## Precautions
This API implements a CSS animation, and the specific effect depends on the browser implementation.

## Support

This API only supports gadget calls, and the corresponding client version support is as follows.

App capability | Android | iOS | PC | Harmony | Preview
---|---|---|---|---|---
Gadget | **✓** | **✓** | **✓** | V7.35.0+ | Preview
Web app | **X** | **X** | **X** | **X** | /

## Input

Name | Data type | Required | Default value | Description
---|---|---|---|---
duration | number | No | 400 | Animation duration in ms.
timingFunction | string | No | linear | Animation effect. Valid values:<br>- `linear`: The animation has the same speed from start to end.<br>- `ease`: The animation starts slow, accelerates in the middle, and slows down at the end.<br>- `ease-in`: The animation starts slow.<br>- `ease-in-out`: The animation starts and ends slow.<br>- `ease-out`: The animation ends slow.<br>- `step-start`: The animation jumps instantly to the final state until the end.<br>- `step-end`: The animation stays at the initial state until the end of its animation cycle, when it instantly jumps to the final state.
delay | number | No | 0 | Animation delay in ms.
transformOrigin | string | No | 50% 50% 0 | Origin for an element's transformations.

## Output

Returns an `animation` object with the following methods.
Click on the method name in the table below to view the support instructions and calling methods of the corresponding API.

Method | Description
---|---
[Animation.backgroundColor](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_backgroundcolor) | Sets the background color.
[Animation.bottom](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_bottom) | Sets the bottom value.
[Animation.export](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_export) | Exports the animation queue. The previous animation operation will be cleared after the export method is called.
[Animation.height](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_height) | Sets the height.
[Animation.left](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_left) | Sets the left value.
[Animation.matrix](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_matrix) | Specifies a 2D transformation matrix consisting of six specified values.
[Animation.matrix3d](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_matrix3d) | Defines a 3D transformation as a 4x4 homogeneous matrix.
[Animation.opacity](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_opacity) | Sets the transparency.
[Animation.right](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_right) | Sets the right value.
[Animation.rotate](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_rotate) | Rotates an element clockwise by an angle around the origin.
[Animation.rotate3d](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_rotate3d) | Rotates an element clockwise by an angle around a fixed axis.
[Animation.rotateX](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_rotatex) | Rotates an element clockwise by an angle around the X axis.
[Animation.rotateY](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_rotatey) | Rotates an element clockwise by an angle around the Y axis.
[Animation.rotateZ](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_rotatez) | Rotates an element clockwise by an angle around the Z axis.
[Animation.scale](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_scale) | Scales.
[Animation.scale3d](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_scale3d) | Scales.
[Animation.scaleX](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_scalex) | Scales an element along the X axis.
[Animation.scaleY](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_scaley) | Scales an element along the Y axis.
[Animation.scaleZ](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_scalez) | Scales an element along the Z axis.
[Animation.skew](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_skew) | Skews an element in the horizontal and vertical directions.
[Animation.skewX](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_skewx) | Skews an element in the horizontal direction.
[Animation.skewY](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_skewy) | Skews an element in the vertical direction.
[Animation.step](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_step) | Indicates the completion of a group of animations. You can call as many animation methods as needed in a group of animations. All animations in a group start simultaneously, and the next group of animations will not start until the completion of current group.
[Animation.top](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_top) | Sets the top value.
[Animation.translate](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_translate) | Translates an element.
[Animation.translate3d](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_translate3d) | Translates an element in 3D space.
[Animation.translateX](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_translatex) | Translates an element along the X axis.
[Animation.translateY](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_translatey) | Translates an element along the Y axis.
[Animation.translateZ](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_translatez) | Translates an element along the Z axis.
[Animation.width](https://open.feishu.cn/document/uYjL24iN/ucjMy4yNyIjL3IjM/animation/animation_width) | Sets the width.

## Sample code

```js
const animation = tt.createAnimation();
```
