Skip to content

Commit 248a96c

Browse files
committed
add DrawTex
1 parent cbaf55b commit 248a96c

File tree

5 files changed

+709
-132
lines changed

5 files changed

+709
-132
lines changed

docs/docs/lib/animation.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,24 @@ const Impact = () => (
8686
</FillFrame>
8787
)
8888
```
89+
90+
## Effects: DrawText
91+
92+
`<DrawText />` renders text as animated SVG strokes using a supplied font file.
93+
94+
```tsx
95+
import { DrawText } from "../src/lib/animation/effect/draw-text"
96+
97+
<DrawText text="Hello" fontUrl="assets/Roboto.ttf" fontSize={96} />
98+
```
99+
100+
## Effects: DrawTex
101+
102+
`<DrawTex />` renders TeX as animated SVG strokes (MathJax SVG output).
103+
MathJax must be available in the build (this project uses a static import in `draw-text.tsx`).
104+
105+
```tsx
106+
import { DrawTex } from "../src/lib/animation/effect/draw-text"
107+
108+
<DrawTex tex={"\\sum_{i=1}^{n} i = \\frac{n(n+1)}{2}"} fontSize={96} />
109+
```

docs/i18n/ja/docusaurus-plugin-content-docs/current/lib/animation.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,24 @@ const Impact = () => (
8686
</FillFrame>
8787
)
8888
```
89+
90+
## Effects: DrawText
91+
92+
`<DrawText />` はフォントファイルを使ってテキストを SVG ストロークで描画します。
93+
94+
```tsx
95+
import { DrawText } from "../src/lib/animation/effect/draw-text"
96+
97+
<DrawText text="Hello" fontUrl="assets/Roboto.ttf" fontSize={96} />
98+
```
99+
100+
## Effects: DrawTex
101+
102+
`<DrawTex />` は TeX を SVG ストロークとして描画します(MathJax の SVG 出力)。
103+
MathJax がビルドに含まれている必要があります(このプロジェクトでは `draw-text.tsx` で静的 import しています)。
104+
105+
```tsx
106+
import { DrawTex } from "../src/lib/animation/effect/draw-text"
107+
108+
<DrawTex tex={"\\sum_{i=1}^{n} i = \\frac{n(n+1)}{2}"} fontSize={96} />
109+
```

package-lock.json

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

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@
2929
"dependencies": {
3030
"@ffmpeg-installer/ffmpeg": "^1.1.0",
3131
"@ffprobe-installer/ffprobe": "^2.1.2",
32-
"opentype.js": "^1.3.4",
3332
"@types/opentype.js": "^1.3.4",
33+
"mathjax-full": "^3.2.1",
34+
"opentype.js": "^1.3.4",
3435
"puppeteer": "^24.1.1",
3536
"react": "^19.2.0",
3637
"react-dom": "^19.2.0",

0 commit comments

Comments
 (0)