Skip to content

Commit 6e82072

Browse files
committed
feat: add anniversary video
1 parent df950f2 commit 6e82072

21 files changed

+38763
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ A set of videos made using [Motion Canvas](https://motioncanvas.io).
1616

1717
## Available examples
1818

19+
### One Year of Motion Canvas
20+
21+
```shell
22+
npm run anniversary
23+
```
24+
25+
<a href="https://youtu.be/4kjEwvrDKlg">
26+
<img alt="One Year of Motion Canvas" src="https://img.youtube.com/vi/4kjEwvrDKlg/maxresdefault.jpg" width=480 />
27+
</a>
28+
1929
### Smooth Parallax
2030

2131
```shell

examples/anniversary/package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "@examples/anniversary",
3+
"private": true,
4+
"description": "Source code for the Motion Canvas anniversary video",
5+
"license": "MIT",
6+
"scripts": {
7+
"serve": "vite"
8+
}
9+
}

examples/anniversary/src/commits.json

Lines changed: 37866 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
export interface Commit {
2+
sha: string;
3+
commit: {
4+
committer: {
5+
date: string;
6+
};
7+
message: string;
8+
};
9+
author: {
10+
login: string;
11+
avatar_url: string;
12+
};
13+
}
14+
15+
export interface ParsedCommit {
16+
date: Date;
17+
avatar?: string;
18+
message: string;
19+
raw: Commit;
20+
}
21+
22+
const SINCE = '2fa61267c8fa3b12495df3c5d001718d5db9551a';
23+
const PER_PAGE = 100;
24+
25+
async function fetchCommits(): Promise<ParsedCommit[]> {
26+
const url = new URL(
27+
'https://api.github.com/repos/motion-canvas/motion-canvas/commits',
28+
);
29+
url.searchParams.set('per_page', PER_PAGE.toString());
30+
let page = 1;
31+
32+
const parsed: ParsedCommit[] = [];
33+
let commits: Commit[] = [];
34+
do {
35+
url.searchParams.set('page', page.toString());
36+
const response = await fetch(url.toString());
37+
commits = await response.json();
38+
39+
for (const commit of commits) {
40+
parsed.push({
41+
date: new Date(commit.commit.committer.date),
42+
avatar: commit.author?.avatar_url,
43+
message: commit.commit.message,
44+
raw: commit,
45+
});
46+
if (commit.sha === SINCE) return parsed;
47+
}
48+
49+
page++;
50+
} while (commits.length == PER_PAGE);
51+
52+
return parsed;
53+
}
134 KB
Loading
176 KB
Loading
Lines changed: 1 addition & 0 deletions
Loading
74 KB
Loading
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="@motion-canvas/core/project" />

examples/anniversary/src/projects/intro.meta

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)