dataset / README.md
anya-ji's picture
Update README.md
f8a0a07 verified
|
Raw History Blame Contribute Delete
4.26 kB
---
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},
}
```