> For the complete documentation index, see [llms.txt](https://tobyisme.gitbook.io/sass/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tobyisme.gitbook.io/sass/keyframes.md).

# Keyframes

### *直接是用CSS來呈現動畫效果，主要是依賴@keyframes下面我要介紹透過Sass設定*

## CSS中的keyframes

簡單的回憶一下，如果要使用`animation`創建一個動畫，當然必須要先創見一個`keyframes`

```css
@keyframes animation-name {
    ...
}
```

## SCSS中的keyframes

SCSS幫助我們解決一些前綴的事項，言外之意，就是給`keyframes`定義一個`mixins`

```css
@mixin keyframes($animationName) {
    @-webkit-keyframes #{$animationName} {
        @content;
    }
    @-moz-keyframes #{$animationName} {
        @content;
    }
    @-o-keyframes #{$animationName} {
        @content;
    }
    @keyframes #{$animationName} {
        @content;
    }
}
```

在要用的時候，可以直接這樣使用

```css
@include keyframes(move-the-object) {
    0%   {
        transform: translateX(0);
    }
    100% {
        transform: translateX(200px);
    }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://tobyisme.gitbook.io/sass/keyframes.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.
