# Animations & Interactions

## Animations & Interactions

**Files:** `src/config/config.toml`, section content files · **Skill level:** Beginner

Givo's motion is calm on purpose: content fades in with a small rise, once, as it scrolls into view; amounts count up once; progress bars fill once. Hover effects change color or underline only. Every animation respects the visitor's **reduce motion** setting.

### Fade-In On Scroll
```toml
[settings.animation]
  enable               = true
  respectReducedMotion = true
  easing               = "cubic-bezier(0.215, 0.61, 0.355, 1)" # standard ease-out; avoid springy curves
  duration             = "700ms"   # reveal and intro duration
  distance             = "1.25rem" # how far content rises while fading in
  rootMargin           = "0px 0px -8% 0px"
  threshold            = 0.14      # how much of an element is visible before it starts
```

- `enable = false` shows everything at once, with no fade.
- Keep `respectReducedMotion = true`: some visitors get dizzy from motion.
- Keep `distance` small for a calm feel.

Content already in view when the page loads fades in right away, without waiting for a scroll. Without JavaScript, everything shows with no fade. The hero copy rises in once on page load, and the hero photo only fades.

Developers can add the effect to any element with the `data-scroll-reveal` attribute (most theme sections use `data-scroll-reveal="fade-up"`). `data-scroll-reveal-delay` and `data-scroll-reveal-duration` set the timing of one element, in milliseconds. The script is in `src/layouts/components/widgets/GlobalScripts.astro`, and the styles in `src/styles/animation.css`.

### Count-Up Figures
Amounts and figures count up from zero once when they scroll into view:

- the raised amount, goal, and donor count on cause cards and at the top of each cause page
- the impact numbers (`metrics-section.md`), on the homepages and wherever the section is used
- the spending percentages of the gift split section
- the figures on `/impact/`

```yaml
# src/content/sections/english/metrics-section.md
list:
  - value: 18400 # sample
    label: "children started the school year with a full kit"
  - value: 6 # sample
    label: "wells drilled, tested, and handed to village committees"
```

- Write `value` as a plain number. Text before or after it goes in `prependValue` or `appendValue` (for example `appendValue: "+"`).
- The number follows the page language: `18,400` in English shows as `18 400` in French. Arabic pages keep Western digits.
- The page's HTML always holds the final value, so search engines, screen readers, and visitors without JavaScript see the real number.
- With reduced motion, or `[settings.animation] enable = false`, the final value shows at once.

Developers can add the effect to any element whose final text is already in the HTML with `data-count-up` (`src/lib/countUp.ts`). The number is counted, and the text around it stays as it is ("$48,900", "86%").

### Progress Bars
The green bar of each cause (the goal thread) fills from empty to its share of the goal once, when it scrolls into view. With reduced motion, or without JavaScript, it is drawn full at once. The share comes from `raised` and `goal` in the cause file; see [Causes & Campaign Progress](/givo/customization/causes-campaigns/).

### Accordions And Disclosures
Questions in the FAQ sections slide open and closed. Other disclosures (the mobile menu groups, the footer columns on phones, Markdown accordions) slide too, in browsers that can animate to an automatic height; in others they open at once. With reduced motion, they all open without animation. The styles are in `src/styles/animation.css`.

### The Header Menu
On large screens, every dropdown and the Causes mega menu share one panel. When a menu opens, the panel moves into place while it fades in. Moving between menus, the panel changes width, height, and position while the content slides across. With reduced motion, the panel only fades, and the mobile menu fades instead of sliding. There is no setting for it; the styles are in `src/styles/navigation.css`. See [Navigation](/givo/features/navigation/).

### Gallery Lightbox
On `/gallery/` and in the photo grid of a cause page, a photo opens full size in a lightbox with a short fade. Arrow keys and swipes move between photos, and <kbd>Esc</kbd> closes it. With reduced motion, it opens without the fade.

### Smooth Scrolling
Givo ships with smooth scrolling on, powered by Lenis. It turns itself off on touch devices and for visitors who ask for reduced motion:

```toml
[settings.smoothScroll]
  enable                = true
  respectReducedMotion  = true
  duration              = 1.1 # Higher value feels slower and smoother
  easing                = "expo" # expo | linear | easeOutQuad | easeOutCubic
  smoothWheel           = true
  syncTouch             = false
  wheelMultiplier       = 1
  touchMultiplier       = 1
  anchors               = true
  autoRaf               = true
  stopInertiaOnNavigate = true
```

Set `enable = false` to use the browser's normal scrolling. Keep `respectReducedMotion = true`. Your own scripts can reach Lenis as `window.__themeLenis`, which only exists where smooth scroll is running. [Smooth Scroll](/givo/features/smooth-scroll/) explains every key.

### Other Interactions
These are not animations to configure, but they respond as visitors use them:

| Where | What it does |
| --- | --- |
| Donation form | Choosing an amount or switching between one-time and monthly updates the impact receipt and the button total at once |
| Donate bar on phones | Slides away while the footer is visible, while a form field has focus, and while the menu or a dialog is open (`[settings.mobileActionBar]`) |
| Buttons | `hoverEffect: "text-flip"` flips the label on hover (see [Common Changes](/givo/customization/common-changes/#button-options)) |
| Light/dark switch | Changes the colors at once, with no fade |

<Aside type="note">
  With reduced motion on, scrolling is the browser's own, content appears without
  fading, figures show their final value, progress bars are drawn full,
  accordions open at once, the header panel and the mobile menu only fade, and
  the lightbox opens without a fade.
</Aside>

### Do It With AI
```text
Make the animations on my Givo site [calmer | off]: in [settings.animation] of
src/config/config.toml, [set enable = false | set duration to "500ms" and distance to "0.75rem"].
Keep respectReducedMotion = true and don't change [settings.smoothScroll]. Then tell me which pages
to check.
```