# 5.8 播放狀態 animation-play-state

## animation-play-state 說明

動畫效果在執行的時候，狀態是 running，然而我們可以透過 `animation-play-state` 來設定暫停與播放的切換。

常見設定的值：

* **`running`**：這是預設值。
* **`paused`**：暫停。

## 範例

一個無限左右滑動的 div 區塊，若點擊的話，會暫停，再點擊的話，會恢復動畫的執行，JS 只是單純的切換 class：

{% embed url="<https://codepen.io/carlos411/pen/LYEbPrO>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.webmix.cc/css-animation/dong-hua-xiao-guo-animation/5.8-animation-play-state.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
