Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions src/pages/utilities/animations.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ createAnimation()
.duration(3000)
.iterations(Infinity)
.keyframes([
{ offset: 0, background: 'red' },
{ offset: 0.72, background: 'var(--background)' },
{ offset: 1, background: 'green' }
{ offset: 0, transform: "rotate(0deg) scale(1)" },
{ offset: 0.72, transform: "rotate(180deg) scale(2)" },
{ offset: 1, transform: "rotate(360deg) scale(1)" }
]);
```
</docs-tab>
Expand All @@ -176,9 +176,9 @@ this.animationCtrl.create()
.duration(3000)
.iterations(Infinity)
.keyframes([
{ offset: 0, background: 'red' },
{ offset: 0.72, background: 'var(--background)' },
{ offset: 1, background: 'green' }
{ offset: 0, transform: "rotate(0deg) scale(1)" },
{ offset: 0.72, transform: "rotate(180deg) scale(2)" },
{ offset: 1, transform: "rotate(360deg) scale(1)" }
]);
```
</docs-tab>
Expand All @@ -189,9 +189,9 @@ this.animationCtrl.create()
duration={3000}
iterations={Infinity}
keyframes={[
{ offset: 0, background: 'red' },
{ offset: 0.72, background: 'var(--background)' },
{ offset: 1, background: 'green' }
{ offset: 0, transform: "rotate(0deg) scale(1)" },
{ offset: 0.72, transform: "rotate(180deg) scale(2)" },
{ offset: 1, transform: "rotate(360deg) scale(1)" }
]}
>
...
Expand All @@ -200,6 +200,8 @@ this.animationCtrl.create()
</docs-tab>
</docs-tabs>

You can view a live example of this in Angular [here](https://stackblitz.com/edit/ionic-angular-animation-keyframes) and in React [here](https://stackblitz.com/edit/ionic-react-animation-keyframes).

In the example above, the `.square` element will transition from a red background color, to a background color defined by the `--background` variable, and then transition on to a green background color.

Each keyframe object contains an `offset` property. `offset` is a value between 0 and 1 that defines the keyframe step. Offset values must go in ascending order and cannot repeat.
Expand Down