File size: 4,261 Bytes
5907948
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
---
license: cc-by-4.0
pretty_name: Animation2Code
task_categories:
  - video-text-to-text
language:
  - en
tags:
  - code
  - html
  - css
  - javascript
  - animation
  - web
  - codepen
  - video-to-code
  - benchmark
size_categories:
  - 1K<n<10K
---

# Animation2Code

**Animation2Code** is a benchmark for video-to-code generation of web animations. It contains 1,069 examples, each with a rendered web animation video and self-contained HTML/CSS/JavaScript that produced it.

- **Paper:** *Animation2Code: Evaluating Temporal Visual Reasoning in Video-to-Code Generation* (NeurIPS 2026)
- **Project page:** https://anya-ji.github.io/animation2code-website/

## Dataset Structure

```
data/
├── train/   769 examples
├── val/      86 examples
└── test/    214 examples
    └── codepen-<collection_id>-<pen_id>[-<k>]/
        ├── animation.mp4
        ├── full.html
        └── metadata.json
```

Each example directory contains exactly three files:

| File | Description |
|------|-------------|
| `animation.mp4` | The rendered reference video (the task input). H.264 (`yuv444p`), 1024×768, 30 fps, about 2–8 s. |
| `full.html` | A self-contained HTML document with inline `<style>` and `<script>` tags (the ground-truth target). |
| `metadata.json` | Provenance and dependency information (see below). |

### Example IDs
`codepen-<collection_id>-<pen_id>` names the CodePen collection and pen the example came from. When a single pen contained several independent animations, it was split into sub-examples with a `-<k>` suffix (e.g. `codepen-DrPkOq-poyOMgr-1` … `-4`). All sub-examples of a pen are in the same split.

### Metadata fields

In `metadata.json`:

| Field | Presence | Description |
|-------|----------|-------------|
| `title` | always | Pen title given by the original author. |
| `url` | always | Canonical CodePen URL, kept for attribution. |
| `external_resources` | 486 / 1,069 | `{"scripts": [...], "stylesheets": [...]}`: URLs of external libraries and stylesheets the pen loads. These are **not** inlined into `full.html` and must be loaded from the network when rendering. |
| `jquery_translated` | 41 / 1,069 | The jQuery URL that was removed when the pen's jQuery code was translated to vanilla JavaScript. |

Example:

```json
{
  "title": "Merry Christmas Tree!",
  "url": "https://codepen.io/chrisgannon/pen/dypvKvR",
  "external_resources": {
    "scripts": [
      "https://unpkg.co/gsap@3/dist/gsap.min.js",
      "https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/MorphSVGPlugin3.min.js"
    ]
  }
}
```

## Usage

The data is stored as raw files (one directory per example), so download it with `huggingface_hub`:

```python
import json
from pathlib import Path
from huggingface_hub import snapshot_download

root = Path(snapshot_download("anim2code/dataset", repo_type="dataset"))
# For a single split only: snapshot_download(..., allow_patterns="data/test/*")

for ex_dir in sorted((root / "data" / "test").iterdir()):
    video_path = ex_dir / "animation.mp4"
    html = (ex_dir / "full.html").read_text()
    meta = json.loads((ex_dir / "metadata.json").read_text())
```

Or with the CLI:

```bash
hf download anim2code/dataset --repo-type dataset --local-dir anim2code_data
```

## Dataset Statistics

| Split | Examples |
|-------|----------|
| train | 769 |
| val   | 86 |
| test  | 214 |
| **total** | **1,069** |

**Durations:** 2–8 s (mean 5.1 ± 2.4 s). Looping animations are captured for at least one full cycle.

## License

This dataset is released under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). The original code comes from public CodePen pens, which are MIT-licensed ([CodePen licensing](https://blog.codepen.io/documentation/licensing/)). Each example's `metadata.json` keeps the original pen URL so the original author can be credited.

## Citation

```bibtex
@article{ji2026animation2code,
  title         = {Animation2Code: Evaluating Temporal Visual Reasoning in Video-to-Code Generation},
  author        = {Ji, Anya and Mudunuri, Abhijith Varma and Chan, David M. and Suhr, Alane},
  year          = {2026},
  eprint        = {2606.28593},
  archivePrefix = {arXiv},
  url           = {https://arxiv.org/abs/2606.28593},
}
```