> For the complete documentation index, see [llms.txt](https://yoyo840821.gitbook.io/android-learning/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yoyo840821.gitbook.io/android-learning/android-animation-she-ji.md).

# Android Animation設計

## alpha值和經過時間

```
view.animate().alpha(0).setDuration(2000); //過2秒後，變透明
view.animate().alpha(1).setDuration(2000); //過2秒後，出現
```

## X軸移動-translationXBy

正號向右，負號向左

```
view.animate().translationXBy(1000).setDuration(2000); //向右
view.animate().translationXBy(-1000).setDuration(2000); //向左
```

## Y軸移動-translationYBy

```
view.animate().translationYBy(1000).setDuration(2000); //向下
view.animate().translationYBy(-1000).setDuration(2000); //向上
```

## 旋轉-rotation

```
view.animate().rotation(1000).setDuration(1000); //旋轉
view.animate().rotation(1000).alpha(0).setDuration(1000); //邊旋轉邊隱形
```

## 縮放-size&#x20;

```
view.animate().scaleX(0.5F).scaleY(0.5f).setDuration(1000);
```

##
