# hsnaydd/moveto architecture

> Architecture diagram of the GitHub repository hsnaydd/moveto, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hsnaydd/moveto
- Repository: https://github.com/hsnaydd/moveto

## Overview

MoveTo is a small, dependency-free JavaScript library for animated scrolling. A consumer creates an instance and either calls `move` directly or registers a DOM trigger; trigger clicks resolve a target and apply options from data attributes before starting the same animation. The animation reads the container’s scroll position, applies an easing function over animation frames, scrolls toward the target, and calls the completion callback. Runtime behavior is concentrated in `src/moveTo.js`; edges reflect its shown calls and the README’s documented API.

Main entry points: [`src/moveTo.js`](https://github.com/hsnaydd/moveto/blob/master/src/moveTo.js) (Scroll animation)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_consumer(("Library consumer"))
node_api["MoveTo API<br/>[moveTo.js]"]
node_trigger["DOM triggers<br/>[moveTo.js]"]
node_options["Scroll options<br/>[moveTo.js]"]
node_animation["Scroll animation<br/>[moveTo.js]"]
node_easing["Easing functions<br/>[moveTo.js]"]
node_browser["Browser DOM and window"]

node_consumer -->|"calls move or registers"| node_api
node_api -->|"registers click"| node_trigger
node_trigger -->|"reads data options"| node_options
node_trigger -->|"starts on click"| node_animation
node_api -->|"starts move"| node_animation
node_animation -->|"uses settings"| node_options
node_animation -->|"applies easing"| node_easing
node_trigger -->|"attaches listener"| node_browser
node_animation -->|"reads and scrolls"| node_browser
node_animation -->|"requests frames"| node_browser

click node_api "https://github.com/hsnaydd/moveto/blob/master/src/moveTo.js"
click node_trigger "https://github.com/hsnaydd/moveto/blob/master/src/moveTo.js"
click node_options "https://github.com/hsnaydd/moveto/blob/master/src/moveTo.js"
click node_animation "https://github.com/hsnaydd/moveto/blob/master/src/moveTo.js"
click node_easing "https://github.com/hsnaydd/moveto/blob/master/src/moveTo.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_consumer toneIndigo
class node_api toneMint
class node_trigger,node_options,node_animation,node_easing toneTeal
class node_browser toneBlue
```

## Components

### Other components

- **Library consumer**
- [MoveTo API](https://github.com/hsnaydd/moveto/blob/master/src/moveTo.js): `src/moveTo.js`
- [DOM triggers](https://github.com/hsnaydd/moveto/blob/master/src/moveTo.js): `src/moveTo.js`
- [Scroll options](https://github.com/hsnaydd/moveto/blob/master/src/moveTo.js): `src/moveTo.js`
- [Scroll animation](https://github.com/hsnaydd/moveto/blob/master/src/moveTo.js): `src/moveTo.js`
- [Easing functions](https://github.com/hsnaydd/moveto/blob/master/src/moveTo.js): `src/moveTo.js`
- **Browser DOM and window**

## Connections

- Library consumer → MoveTo API: calls move or registers (evidence: `README.md`)
- MoveTo API → DOM triggers: registers click (evidence: `src/moveTo.js`)
- DOM triggers → Scroll options: reads data options (evidence: `src/moveTo.js`)
- DOM triggers → Scroll animation: starts on click (evidence: `src/moveTo.js`)
- MoveTo API → Scroll animation: starts move (evidence: `src/moveTo.js`)
- Scroll animation → Scroll options: uses settings (evidence: `src/moveTo.js`)
- Scroll animation → Easing functions: applies easing (evidence: `src/moveTo.js`)
- DOM triggers → Browser DOM and window: attaches listener (evidence: `src/moveTo.js`)
- Scroll animation → Browser DOM and window: reads and scrolls (evidence: `src/moveTo.js`)
- Scroll animation → Browser DOM and window: requests frames (evidence: `src/moveTo.js`)
