# Animation duration, delay and threshold

> Change the duration and the delay of a scroll reveal animation, and set the visible fraction of the element that starts it with the threshold option.

Three options set when the entrance plays and how long it takes: [`duration`](/reference/options/#duration), [`delay`](/reference/options/#delay) and [`threshold`](/reference/options/#threshold).

## Change the duration

`duration` sets the duration of the entrance, in milliseconds. The default is 600. Select a duration to see the effect:

## Delay the entrance

`delay` sets the time between the reveal and the start of the entrance, in milliseconds. The default is 0. The element keeps its start state during the delay.

In this example, the title takes 800 milliseconds. The text starts 200 milliseconds after its reveal, so it starts while the title still moves:

Keep `delay` below about 300 milliseconds. A long delay makes content appear late when the user scrolls quickly.

## Reveal later with a threshold

`threshold` sets the [visible fraction](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#thresholds) of the element that reveals it, from 0 to 1. The default is 0, so the element reveals when its first pixel enters the viewport. With 0.5, the element reveals when half of it is visible:

* React

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

  export function DownloadsChart() {
    return (
      <Reveal threshold={0.5}>
        <img src="/chart.svg" alt="Downloads for each month" />
      </Reveal>
    );
  }
  ```

* Vue

  ```vue
  <script setup>
  import { Reveal } from "@awesome-reveal/vue";
  </script>

  <template>
    <Reveal :threshold="0.5">
      <img src="/chart.svg" alt="Downloads for each month" />
    </Reveal>
  </template>
  ```

* Astro

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

  <Reveal threshold={0.5}>
    <img src="/chart.svg" alt="Downloads for each month" />
  </Reveal>
  ```

* JavaScript

  ```js
  import { reveal } from "@awesome-reveal/core";

  reveal(".chart", { threshold: 0.5 });
  ```

A change to `threshold` applies immediately in React, Vue and Astro. A change to `duration` or `delay` applies at the next reveal.

### Tall elements and small scroll containers

* If the viewport is too small to show the threshold fraction of the element, the element reveals when it enters the viewport.
* In a [scroll container](https://developer.mozilla.org/en-US/docs/Glossary/Scroll_container) that is too small, the element reveals when it leaves the visible area of the container.

Keep the default threshold for tall elements and for [long cascades](/guides/lists/#reveal-a-long-list-or-a-tall-grid).

### The start state moves the box of `reveal()`

React, Vue and Astro hide a waiting element with CSS at its resting position. They create the entrance at the reveal, so the start state does not change the box that the viewport check uses.

`reveal()` of the JavaScript API holds a waiting element at the first keyframe of a paused entrance. A [start state](/guides/entrances/) with `opacity: 0`, such as each side, waits at the resting position of the element. Other start states and [your own keyframes](/guides/keyframes/) wait at their first keyframe. Their offset, scale and rotation change the box that the viewport check uses. For example, with the start state `{ y: 80 }`, the element waits 80 pixels lower, so it reveals later.

`cascade()` holds each child at its first keyframe, but the viewport check uses the box of the container. So the start state of the children does not change when the cascade reveals.
