Skip to content

Commit 3711846

Browse files
author
吴至波
committed
docs: organize assets and add animation previews
1 parent a13fcc2 commit 3711846

301 files changed

Lines changed: 364 additions & 240 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# Python files
22
__pycache__/
33
.DS_Store
4+
tmp/

README-En.md

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,53 @@ If this project helps you, a GitHub Star is appreciated and helps the project st
1010

1111
[Website animations](https://www.algomooc.com/leetcode-animation) · [Problem index](docs/leetcode-animation-index.md) · [Structured data](data/manifest.json)
1212

13+
## Website-Style Animation Previews
14+
15+
These GIFs are captured from the current website player. GitHub is good for a fast preview and search; use the website version for full step playback, code walkthroughs, and the interactive reading experience.
16+
17+
<table>
18+
<tr>
19+
<td width="50%">
20+
<a href="https://www.algomooc.com/leetcode-animation/two-sum">
21+
<img src="assets/previews/two-sum.gif" alt="Two Sum animation preview" width="420">
22+
</a>
23+
<br>
24+
<strong>Two Sum</strong>
25+
<br>
26+
Scan the array while the hash table grows, then see exactly where the complement is found.
27+
</td>
28+
<td width="50%">
29+
<a href="https://www.algomooc.com/leetcode-animation/trapping-rain-water">
30+
<img src="assets/previews/trapping-rain-water.gif" alt="Trapping Rain Water animation preview" width="420">
31+
</a>
32+
<br>
33+
<strong>Trapping Rain Water</strong>
34+
<br>
35+
Bar heights, boundaries, and trapped water are shown as separate moving states.
36+
</td>
37+
</tr>
38+
<tr>
39+
<td width="50%">
40+
<a href="https://www.algomooc.com/leetcode-animation/number-of-islands">
41+
<img src="assets/previews/number-of-islands.gif" alt="Number of Islands animation preview" width="420">
42+
</a>
43+
<br>
44+
<strong>Number of Islands</strong>
45+
<br>
46+
The DFS coloring process unfolds cell by cell, making connected components easier to inspect.
47+
</td>
48+
<td width="50%">
49+
<a href="https://www.algomooc.com/leetcode-animation/linked-list-cycle">
50+
<img src="assets/previews/linked-list-cycle.gif" alt="Linked List Cycle animation preview" width="420">
51+
</a>
52+
<br>
53+
<strong>Linked List Cycle</strong>
54+
<br>
55+
Slow and fast pointers move on the same list, so the meeting point becomes visible.
56+
</td>
57+
</tr>
58+
</table>
59+
1360
## Highlights
1461

1562
- **Animation-first notes**: many problems keep GIFs or step-by-step animation assets.
@@ -39,16 +86,17 @@ If this project helps you, a GitHub Star is appreciated and helps the project st
3986
| Search animations by problem number | [`docs/leetcode-animation-index.md`](docs/leetcode-animation-index.md) |
4087
| Search animations by topic | [`docs/index-by-topic.md`](docs/index-by-topic.md) |
4188
| Process problem data with scripts | [`data/manifest.json`](data/manifest.json) |
42-
| Read earlier notes | [`notes/`](notes) or each problem's `Article/` folder |
43-
| Check earlier animation assets | Each problem's `Animation/` folder |
89+
| Read earlier notes | [`notes/`](notes) or each problem's `Article/` folder under [`problems/`](problems) |
90+
| Check earlier animation assets | Each problem's `Animation/` folder under [`problems/`](problems) |
91+
| View README preview GIFs | [`assets/previews/`](assets/previews) |
4492
| Read sync history | [`docs/sync-log.md`](docs/sync-log.md) |
4593
| Sync the website-side index | [`scripts/sync-algomooc-index.js`](scripts/sync-algomooc-index.js) |
4694

4795
## Usage
4896

4997
1. Search by problem number in [`docs/leetcode-animation-index.md`](docs/leetcode-animation-index.md).
5098
2. Use [`data/manifest.json`](data/manifest.json) for scripts or downstream tooling.
51-
3. Check `notes/`, `Article/`, and `Animation/` for historical assets.
99+
3. Check `notes/` and each problem folder under `problems/` for historical `Article/` and `Animation/` assets.
52100
4. Run the sync script after the website-side index changes.
53101

54102
## Repository And Website
@@ -91,9 +139,11 @@ See [`docs/sync-workflow.md`](docs/sync-workflow.md) for the full workflow and c
91139
| `scripts/review-site-changes.js` | Review whether website changes should be synced |
92140
| `scripts/sync-algomooc-index.js` | Sync script for the website-side index |
93141
| `scripts/validate-manifest.js` | Manifest validator |
142+
| `assets/previews/` | Website-style animation preview GIFs used by the README |
94143
| `notes/` | Historical notes |
95-
| `*/Animation/` | Historical animation assets |
96-
| `*/Article/` | Historical article assets |
144+
| `problems/` | Historical per-problem notes, code, and animation assets |
145+
| `problems/*/Animation/` | Historical animation assets |
146+
| `problems/*/Article/` | Historical article assets |
97147

98148
## Feedback
99149

Readme.md

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,53 @@
1010

1111
[网站版动画](https://www.algomooc.com/leetcode-animation) · [题目索引](docs/leetcode-animation-index.md) · [结构化数据](data/manifest.json)
1212

13+
## 网站版动画预览
14+
15+
下面这些 GIF 取自当前网站播放器的关键帧。GitHub 适合快速预览和检索;完整的步骤播放、代码讲解和交互体验建议打开网站版本。
16+
17+
<table>
18+
<tr>
19+
<td width="50%">
20+
<a href="https://www.algomooc.com/leetcode-animation/two-sum">
21+
<img src="assets/previews/two-sum.gif" alt="两数之和动画预览" width="420">
22+
</a>
23+
<br>
24+
<strong>两数之和</strong>
25+
<br>
26+
边扫数组边维护哈希表,看清 complement 是怎么被找到的。
27+
</td>
28+
<td width="50%">
29+
<a href="https://www.algomooc.com/leetcode-animation/trapping-rain-water">
30+
<img src="assets/previews/trapping-rain-water.gif" alt="接雨水动画预览" width="420">
31+
</a>
32+
<br>
33+
<strong>接雨水</strong>
34+
<br>
35+
用柱状图把左右边界和蓄水过程拆开,直观看懂为什么能接住水。
36+
</td>
37+
</tr>
38+
<tr>
39+
<td width="50%">
40+
<a href="https://www.algomooc.com/leetcode-animation/number-of-islands">
41+
<img src="assets/previews/number-of-islands.gif" alt="岛屿数量动画预览" width="420">
42+
</a>
43+
<br>
44+
<strong>岛屿数量</strong>
45+
<br>
46+
DFS 染色过程一格一格展开,连通块边界会更容易看清。
47+
</td>
48+
<td width="50%">
49+
<a href="https://www.algomooc.com/leetcode-animation/linked-list-cycle">
50+
<img src="assets/previews/linked-list-cycle.gif" alt="环形链表动画预览" width="420">
51+
</a>
52+
<br>
53+
<strong>环形链表</strong>
54+
<br>
55+
快慢指针在链表上同步移动,什么时候相遇一眼能看到。
56+
</td>
57+
</tr>
58+
</table>
59+
1360
## 项目特点
1461

1562
- **动画题解**:很多题目保留了 GIF 或分步动画素材,适合先看清算法过程,再回到代码。
@@ -39,16 +86,17 @@
3986
| 按题号查动画 | [`docs/leetcode-animation-index.md`](docs/leetcode-animation-index.md) |
4087
| 按专题查动画 | [`docs/index-by-topic.md`](docs/index-by-topic.md) |
4188
| 用脚本处理题目数据 | [`data/manifest.json`](data/manifest.json) |
42-
| 查看早期题解文章 | [`notes/`](notes) 或各题目录的 `Article/` |
43-
| 查看早期动画素材 | 各题目录的 `Animation/` |
89+
| 查看早期题解文章 | [`notes/`](notes)[`problems/`](problems) 下各题的 `Article/` |
90+
| 查看早期动画素材 | [`problems/`](problems) 下各题的 `Animation/` |
91+
| 查看 README 预览动图 | [`assets/previews/`](assets/previews) |
4492
| 查看同步记录 | [`docs/sync-log.md`](docs/sync-log.md) |
4593
| 同步网站侧新索引 | [`scripts/sync-algomooc-index.js`](scripts/sync-algomooc-index.js) |
4694

4795
## 如何使用
4896

4997
1. 按题号查找:打开 [`docs/leetcode-animation-index.md`](docs/leetcode-animation-index.md),表格按 LeetCode 题号排序。
5098
2. 按程序处理:读取 [`data/manifest.json`](data/manifest.json),其中包含题号、slug、中文标题、难度、分类、仓库目录和网站路径。
51-
3. 查历史素材:早期题解在 `notes/` 和各题目录的 `Article/``Animation/` 中。
99+
3. 查历史素材:早期题解在 `notes/` `problems/` 下各题目录的 `Article/``Animation/` 中。
52100
4. 同步新内容:网站侧新增或调整动画后,运行同步脚本更新本仓库索引。
53101

54102
## 仓库和网站的关系
@@ -91,9 +139,11 @@ npm run validate
91139
| `scripts/review-site-changes.js` | 判断网站侧改动是否需要同步到 GitHub |
92140
| `scripts/sync-algomooc-index.js` | 从网站侧 `study_index.js` 同步索引 |
93141
| `scripts/validate-manifest.js` | 校验 manifest |
142+
| `assets/previews/` | README 使用的网站版动画预览 GIF |
94143
| `notes/` | 早期题解文章 |
95-
| `*/Animation/` | 早期动画素材 |
96-
| `*/Article/` | 早期文章素材 |
144+
| `problems/` | 早期按题目组织的文章、代码和动画素材 |
145+
| `problems/*/Animation/` | 早期动画素材 |
146+
| `problems/*/Article/` | 早期文章素材 |
97147

98148
## 反馈
99149

anima/base.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@
44

55
def get_project_path() -> Path:
66
script_path = os.path.realpath(__file__)
7-
project_path = Path(script_path).parent.parent
8-
return project_path
7+
repo_path = Path(script_path).parent.parent
8+
problems_path = repo_path / 'problems'
9+
problems_path.mkdir(exist_ok=True)
10+
return problems_path
911

1012

1113
def get_md_template_path() -> Path:
12-
return get_project_path() / 'template' / 'template.md'
14+
script_path = os.path.realpath(__file__)
15+
repo_path = Path(script_path).parent.parent
16+
return repo_path / 'template' / 'template.md'
73.4 KB
Loading
84.7 KB
Loading
152 KB
Loading

assets/previews/two-sum.gif

150 KB
Loading

0 commit comments

Comments
 (0)