8000 docs: correct the from, onReveal, fallback and package summary text by morellodev · Pull Request #339 · awesome-reveal/awesome-reveal · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions packages/astro/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ The content fades in and moves up one time, when it enters the viewport.
<Reveal from="left">From the left</Reveal>
```

For a different entrance, give a start state. The element animates from this state to its resting style. A start state replaces the default, so add `opacity: 0` if you want a fade.
For a different entrance, give a start state. The element animates from this state to neutral values: full opacity, no offset, a scale of 1, no rotation and no blur. The element's own value of an animated property applies only after the entrance ends. A start state replaces the default, so add `opacity: 0` if you want a fade.

```astro
<Reveal from={{ opacity: 0 }}>Fade only</Reveal>
Expand Down 10000 Expand Up @@ -138,13 +138,13 @@ The rendered tag dispatches a `reveal` event that bubbles, when the reveal start
```ts
document.addEventListener("reveal", (event) => {
const element = event.target as Element;
Promise.all(element.getAnimations({ subtree: true }).map((animation) => animation.finished))
Promise.all(element.getAnimations().map((animation) => animation.finished))
.then(() => element.classList.add("entered"))
.catch(() => {});
});
```

The promise rejects when the entrance stops early, for example after `when` becomes `false`. Catch the rejection. It resolves at once when no entrance plays, for example with reduced motion. It also waits for your own animations of the element and its descendants.
The promise rejects when the entrance stops early, for example after `when` becomes `false`. Catch the rejection. It resolves at once when no entrance plays, for example with reduced motion. It also waits for your own animations of the element. For a cascade, use `getAnimations({ subtree: true })`, because the children animate. An animation that repeats forever never finishes, so the promise does not resolve.

## API

Expand Down
4 changes: 2 additions & 2 deletions packages/astro/skills/adding-reveal-animations/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ Use `when` for manual control: `true` reveals the element and `false` resets the

The rendered tag dispatches a `reveal` event that bubbles, one time for each reveal. The event fires when the reveal starts, not when the entrance ends. It also fires when no entrance plays, such as with reduced motion or focus. After `when: false`, the next reveal fires it again. With reduced motion, `when: false` does not reset the reveal, so the event does not fire again.

To wait for the end of the entrance, use the `finished` promises of the animations of the event `target`. The promise waits for each animation of the element and of its descendants, also your own animations, so use it on an element that has no other animations. It resolves at once when no entrance plays. It rejects when the entrance stops early, such as after `when: false`. Catch the rejection, or the browser reports an unhandled rejection.
To wait for the end of the entrance, use the `finished` promises of the animations of the event `target`. The promise waits for each animation of the element, also your own animations. An animation that repeats forever never finishes, so use the promise on an element that has no other animations. For a cascade, use `getAnimations({ subtree: true })` on the container, because its children animate. It resolves at once when no entrance plays. It rejects when the entrance stops early, such as after `when: false`. Catch the rejection, or the browser reports an unhandled rejection.

```ts
document.addEventListener("reveal", (event) => {
const element = event.target as Element;
Promise.all(element.getAnimations({ subtree: true }).map((animation) => animation.finished))
Promise.all(element.getAnimations().map((animation) => animation.finished))
.then(() => element.classList.add("entered"))
.catch(() => {});
});
Expand Down
4 changes: 2 additions & 2 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Each element animates one time, when it enters the viewport.
| `"bottom"` (default) | y: 24 px |
| `"left"` | x: -24 px |

For a different entrance, give a start state. The element animates from this state to its resting style. A start state replaces the default, so add `opacity: 0` if you want a fade.
For a different entrance, give a start state. The element animates from this state to neutral values: full opacity, no offset, a scale of 1, no rotation and no blur. The element's own value of an animated property applies only after the entrance ends. A start state replaces the default, so add `opacity: 0` if you want a fade.

```ts
import { reveal } from "@awesome-reveal/core";
Expand Down Expand Up @@ -244,7 +244,7 @@ Core writes no `style` attribute, no inline script and no CSS. It uses `element.

## Browser support

Chrome 104, Edge 104, Firefox 74 and Safari 14.1 (iOS 14.5), or later. A native keyframe with `composite` needs Firefox 80 or Safari 16. If IntersectionObserver or `Element.animate()` is not available, the content shows immediately and does not stay hidden.
Chrome 104, Edge 104, Firefox 74 and Safari 14.1 (iOS 14.5), or later. A native keyframe with `composite` needs Firefox 80 or Safari 16. Without IntersectionObserver, the entrance plays at once. Without `Element.animate()`, the content shows with no animation. In both cases, the content does not stay hidden.

## Agent skills

Expand Down
8 changes: 4 additions & 4 deletions packages/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Reveal-on-scroll animations for React. Wrap content in `<Reveal>`, and it fades

<p align="center"><img src="https://raw.githubusercontent.com/awesome-reveal/awesome-reveal/next/.github/assets/demo.gif" alt="Elements fade, slide, scale, blur and rotate in as the page scrolls" width="640"></p>

- **Simple.** One component, a hook, and a few options.
- **Simple.** Two components, two hooks, and a few options.
- **Native.** Built on IntersectionObserver and the Web Animations API, with no animation library.
- **SSR-ready.** Server-rendered content stays hidden until it reveals, with no flash. Works with Next.js Server Components.
- **Accessible.** Obeys the reduced-motion preference, and shows waiting content on focus and in print.
Expand Down Expand Up @@ -49,7 +49,7 @@ The content fades in and moves up one time, when it enters the viewport.
<Reveal from="left">From the left</Reveal>
```

For a different entrance, give a start state. The element animates from this state to its resting style. A start state replaces the default, so add `opacity: 0` if you want a fade.
For a different entrance, give a start state. The element animates from this state to neutral values: full opacity, no offset, a scale of 1, no rotation and no blur. The element's own value of an animated property applies only after the entrance ends. A start state replaces the default, so add `opacity: 0` if you want a fade.

```jsx
<Reveal from={{ opacity: 0 }}>Fade only</Reveal>
Expand Down Expand Up @@ -154,7 +154,7 @@ import { Reveal } from "@awesome-reveal/react";
export const Card = () => (
<Reveal
=>
Promise.all(element.getAnimations({ subtree: true }).map((animation) => animation.finished))
Promise.all(element.getAnimations().map((animation) => animation.finished))
.then(() => element.classList.add("entered"))
.catch(() => {})
}
Expand All @@ -164,7 +164,7 @@ export const Card = () => (
);
```

The promise rejects when the entrance stops early, for example after `when={false}` or an unmount. Catch the rejection. It resolves at once when no entrance plays, for example with reduced motion. It also waits for your own animations of the element and its descendants.
The promise rejects when the entrance stops early, for example after `when={false}` or an unmount. Catch the rejection. It resolves at once when no entrance plays, for example with reduced motion. It also waits for your own animations of the element. For a cascade, use `getAnimations({ subtree: true })`, because the children animate. An animation that repeats forever never finishes, so the promise does not resolve.

## API

Expand Down
4 changes: 2 additions & 2 deletions packages/react/skills/adding-reveal-animations/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ Use `when` for manual control: `true` reveals the element and `false` resets the

`onReveal` gets the element one time for each reveal, or the container for a cascade. It runs when the reveal starts, not when the entrance ends. It runs also when no entrance plays, such as with reduced motion or focus. After `when: false`, the next reveal calls it again. With reduced motion, `when: false` does not reset the reveal, so `onReveal` does not run again.

To wait for the end of the entrance, use the `finished` promises of the animations in `onReveal`. The promise waits for each animation of the element and of its descendants, also your own animations, so use it on an element that has no other animations. It resolves at once when no entrance plays. It rejects when the entrance stops early, such as after `when: false` or an unmount. Catch the rejection, or the browser reports an unhandled rejection.
To wait for the end of the entrance, use the `finished` promises of the animations in `onReveal`. The promise waits for each animation of the element, also your own animations. An animation that repeats forever never finishes, so use the promise on an element that has no other animations. For a cascade, use `getAnimations({ subtree: true })` on the container, because its children animate. It resolves at once when no entrance plays. It rejects when the entrance stops early, such as after `when: false` or an unmount. Catch the rejection, or the browser reports an unhandled rejection.

```tsx
import { Reveal } from "@awesome-reveal/react";

export const Card = () => (
<Reveal
=>
Promise.all(element.getAnimations({ subtree: true }).map((animation) => animation.finished))
Promise.all(element.getAnimations().map((animation) => animation.finished))
.then(() => element.classList.add("entered"))
.catch(() => {})
}
Expand Down
8 changes: 4 additions & 4 deletions packages/vue/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Reveal-on-scroll animations for Vue. Wrap content in `<Reveal>`, or add `v-revea

<p align="center"><img src="https://raw.githubusercontent.com/awesome-reveal/awesome-reveal/next/.github/assets/demo.gif" alt="Elements fade, slide, scale, blur and rotate in as the page scrolls" width="640"></p>

- **Simple.** One component, a directive, and a few options.
- **Simple.** Two components, two directives, and a few options.
- **Native.** Built on IntersectionObserver and the Web Animations API, with no animation library.
- **SSR-ready.** Server-rendered content stays hidden until it reveals, with no flash.
- **Accessible.** Obeys the reduced-motion preference, and shows waiting content on focus and in print.
Expand Down Expand Up @@ -55,7 +55,7 @@ The content fades in and moves up one time, when it enters the viewport.
</template>
```

For a different entrance, give a start state. The element animates from this state to its resting style. A start state replaces the default, so add `opacity: 0` if you want a fade.
For a different entrance, give a start state. The element animates from this state to neutral values: full opacity, no offset, a scale of 1, no rotation and no blur. The element's own value of an animated property applies only after the entrance ends. A start state replaces the default, so add `opacity: 0` if you want a fade.

```vue
<template>
Expand Down Expand Up @@ -150,7 +150,7 @@ To play the entrance again, set `when` to `false`, then to `true`.
import { Reveal } from "@awesome-reveal/vue";

function entered(element: Element) {
Promise.all(element.getAnimations({ subtree: true }).map((animation) => animation.finished))
Promise.all(element.getAnimations().map((animation) => animation.finished))
.then(() => element.classList.add("entered"))
.catch(() => {});
}
Expand All @@ -163,7 +163,7 @@ function entered(element: Element) {
</template>
```

The promise rejects when the entrance stops early, for example after `when: false` or an unmount. Catch the rejection. It resolves at once when no entrance plays, for example with reduced motion. It also waits for your own animations of the element and its descendants.
The promise rejects when the entrance stops early, for example after `when: false` or an unmount. Catch the rejection. It resolves at once when no entrance plays, for example with reduced motion. It also waits for your own animations of the element. For a cascade, use `getAnimations({ subtree: true })`, because the children animate. An animation that repeats forever never finishes, so the promise does not resolve.

## API

Expand Down
4 changes: 2 additions & 2 deletions packages/vue/skills/adding-reveal-animations/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Use `when` for manual control: `true` reveals the element and `false` resets the

The component emits `reveal` with the element, or with the container for a cascade. The directive calls the `onReveal` function of its options with the same element. Both run one time for each reveal, when the reveal starts, not when the entrance ends. They also run when no entrance plays, such as with reduced motion or focus. After `when: false`, the next reveal runs them again. With reduced motion, `when: false` does not reset the reveal, so they do not run again.

To wait for the end of the entrance, use the `finished` promises of the animations of the element. The promise waits for each animation of the element and of its descendants, also your own animations, so use it on an element that has no other animations. It resolves at once when no entrance plays. It rejects when the entrance stops early, such as after `when: false` or an unmount. Catch the rejection, or the browser reports an unhandled rejection.
To wait for the end of the entrance, use the `finished` promises of the animations of the element. The promise waits for each animation of the element, also your own animations. An animation that repeats forever never finishes, so use the promise on an element that has no other animations. For a cascade, use `getAnimations({ subtree: true })` on the container, because its children animate. It resolves at once when no entrance plays. It rejects when the entrance stops early, such as after `when: false` or an unmount. Catch the rejection, or the browser reports an unhandled rejection.

```ts
import { h } from "vue";
Expand All @@ -72,7 +72,7 @@ export const entered = h(
Reveal,
{
onReveal: (element: Element) =>
Promise.all(element.getAnimations({ subtree: true }).map((animation) => animation.finished))
Promise.all(element.getAnimations().map((animation) => animation.finished))
.then(() => element.classList.add("entered"))
.catch(() => {}),
},
Expand Down
Loading
0