# @animotion/motion

> Svelte animation library

Latest version **2.0.3** (published 2026-05-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @animotion/motion
pnpm add @animotion/motion
yarn add @animotion/motion
bun add @animotion/motion
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 2.0.3 |
| Published | 2026-05-02 |
| First published | 2023-11-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 1 |
| Unpacked size | 13.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 59 |
| Author | animotionjs |
| Maintainers | mattcroat |
| Keywords | svelte, sveltekit, animation, library |

## Links

- npm: https://www.npmjs.com/package/@animotion/motion
- Repository: https://github.com/animotionjs/motion
- Homepage: https://animotion.pages.dev
- Issues: https://github.com/animotionjs/motion/issues
- npm.io page: https://npm.io/package/@animotion/motion

## Dependencies (1)

- [d3-interpolate](https://npm.io/package/d3-interpolate.md) ^3.0.1

## Alternatives

- [@luma.gl/experimental](https://npm.io/package/@luma.gl/experimental.md) — 77.1K weekly downloads
- [persona-harness](https://npm.io/package/persona-harness.md) — 4.7K weekly downloads
- [@tsparticles/effect-bubble](https://npm.io/package/@tsparticles/effect-bubble.md) — 4.6K weekly downloads
- [f3d](https://npm.io/package/f3d.md) — 730 weekly downloads
- [spark-html-motion](https://npm.io/package/spark-html-motion.md) — 298 weekly downloads

## Recent versions

- 2.0.3 (latest) — 2026-05-02
- 2.0.2 — 2026-04-23
- 2.0.1 — 2025-01-22
- 2.0.0 — 2025-01-22
- 1.0.1 — 2024-09-17
- 1.0.0 — 2024-08-18
- 0.0.9 — 2024-08-17
- 0.0.8 — 2024-06-30
- 0.0.7 — 2024-06-28
- 0.0.6 — 2024-05-19
- 0.0.5 — 2024-05-13
- 0.0.4 — 2024-05-12
- 0.0.3 — 2023-11-13
- 0.0.2 — 2023-11-13
- 0.0.1 — 2023-11-09

## README

# Motion

https://github.com/animotionjs/motion/assets/38083522/7cd87b1b-016f-46d3-b2c9-67e849d4559f

## What Is Motion?

Motion is a simple Svelte animation library. Instead of being limited to animating CSS properties using a JavaScript animation library, or the [Web Animations API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API), it uses values that change over time, to animate any property.

## Installation

```sh
npm i @animotion/motion
```

## Methods

- `tween` is the value over time which can be a single value, such as `tween(0)`, or an object `tween({ count: 0 })`
- `reset` is a helper function to reset the animation to its default values

## Usage

- `to` method is used to animate values
- `sfx` method is used to play sounds
- `tween` and `to` method accept an options object for `duration`, `delay`, and `easing`
- `await` keyword can be used to wait for animations to finish

## Example

```svelte
<script>
	import { tween } from '@animotion/motion';

	const sfx = {
		transition: 'sfx/transition.mp3',
		tally: 'sfx/tally.mp3',
	};

	const camera = tween({ x: -2, y: -2, w: 24, h: 24 });
	const circle = tween({ x: 2.5, y: 2.5, r: 1.5, fill: '#00ffff' });
	const text = tween({ count: 0, opacity: 0 });

	async function animate() {
		await camera.sfx(sfx.transition).to({ x: 0, y: 0, w: 10, h: 10 });
		circle.sfx(sfx.transition).to({ x: 10, y: 10, r: 3, fill: '#ffff00' });
		camera.to({ x: 5, y: 5 });
		await text.to({ opacity: 1 }, { duration: 300 });
		text.sfx(sfx.tally).to({ count: 10_000 }, { duration: 600 });
	}
</script>

<svg viewBox="{camera.x} {camera.y} {camera.w} {camera.h}">
	{@render grid()}

	<circle cx={circle.x} cy={circle.y} r={circle.r} fill={circle.fill} />

	<text
		x={circle.x}
		y={circle.y}
		font-size={circle.r * 0.4}
		opacity={text.opacity}
		text-anchor="middle"
		dominant-baseline="middle"
		fill="#000"
	>
		{text.count}
	</text>
</svg>

<button onclick={animate}>Animate</button>
```

---
_Source: https://npm.io/package/@animotion/motion · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
