File tree Expand file tree Collapse file tree
i18n/ja/docusaurus-plugin-content-docs/current/lib Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -92,9 +92,19 @@ const Impact = () => (
9292` <DrawText /> ` renders text as animated SVG strokes using a supplied font file.
9393
9494``` tsx
95+ import { useAnimation , useVariable } from " ../src/lib/animation"
9596import { DrawText } from " ../src/lib/animation/effect/draw-text"
97+ import { seconds } from " ../src/lib/frame"
98+
99+ const Title = () => {
100+ const progress = useVariable (0 )
96101
97- <DrawText text = " Hello" fontUrl = " assets/Roboto.ttf" fontSize = { 96 } />
102+ useAnimation (async (context ) => {
103+ await context .move (progress ).to (1 , seconds (2 ))
104+ })
105+
106+ return <DrawText text = " Hello" fontUrl = " assets/Roboto.ttf" fontSize = { 96 } progress = { progress } />
107+ }
98108```
99109
100110## Effects: DrawTex
@@ -103,7 +113,19 @@ import { DrawText } from "../src/lib/animation/effect/draw-text"
103113MathJax must be available in the build (this project uses a static import in ` draw-text.tsx ` ).
104114
105115``` tsx
116+ import { useAnimation , useVariable } from " ../src/lib/animation"
106117import { DrawTex } from " ../src/lib/animation/effect/draw-text"
118+ import { seconds } from " ../src/lib/frame"
119+
120+ const Formula = () => {
121+ const progress = useVariable (0 )
122+
123+ useAnimation (async (context ) => {
124+ await context .move (progress ).to (1 , seconds (2 ))
125+ })
107126
108- <DrawTex tex = { " \\ sum_{i=1}^{n} i = \\ frac{n(n+1)}{2}" } fontSize = { 96 } />
127+ return (
128+ <DrawTex tex = { " \\ sum_{i=1}^{n} i = \\ frac{n(n+1)}{2}" } fontSize = { 96 } progress = { progress } />
129+ )
130+ }
109131```
Original file line number Diff line number Diff line change @@ -92,9 +92,19 @@ const Impact = () => (
9292` <DrawText /> ` はフォントファイルを使ってテキストを SVG ストロークで描画します。
9393
9494``` tsx
95+ import { useAnimation , useVariable } from " ../src/lib/animation"
9596import { DrawText } from " ../src/lib/animation/effect/draw-text"
97+ import { seconds } from " ../src/lib/frame"
98+
99+ const Title = () => {
100+ const progress = useVariable (0 )
96101
97- <DrawText text = " Hello" fontUrl = " assets/Roboto.ttf" fontSize = { 96 } />
102+ useAnimation (async (context ) => {
103+ await context .move (progress ).to (1 , seconds (2 ))
104+ })
105+
106+ return <DrawText text = " Hello" fontUrl = " assets/Roboto.ttf" fontSize = { 96 } progress = { progress } />
107+ }
98108```
99109
100110## Effects: DrawTex
@@ -103,7 +113,19 @@ import { DrawText } from "../src/lib/animation/effect/draw-text"
103113MathJax がビルドに含まれている必要があります(このプロジェクトでは ` draw-text.tsx ` で静的 import しています)。
104114
105115``` tsx
116+ import { useAnimation , useVariable } from " ../src/lib/animation"
106117import { DrawTex } from " ../src/lib/animation/effect/draw-text"
118+ import { seconds } from " ../src/lib/frame"
119+
120+ const Formula = () => {
121+ const progress = useVariable (0 )
122+
123+ useAnimation (async (context ) => {
124+ await context .move (progress ).to (1 , seconds (2 ))
125+ })
107126
108- <DrawTex tex = { " \\ sum_{i=1}^{n} i = \\ frac{n(n+1)}{2}" } fontSize = { 96 } />
127+ return (
128+ <DrawTex tex = { " \\ sum_{i=1}^{n} i = \\ frac{n(n+1)}{2}" } fontSize = { 96 } progress = { progress } />
129+ )
130+ }
109131```
Original file line number Diff line number Diff line change 1+ import { useAnimation , useVariable } from "../src/lib/animation"
12import { DrawText } from "../src/lib/animation/effect/draw-text"
3+ import { BEZIER_SMOOTH } from "../src/lib/animation/functions"
24import { Clip } from "../src/lib/clip"
35import { seconds } from "../src/lib/frame"
46import { FillFrame } from "../src/lib/layout/fill-frame"
@@ -13,13 +15,21 @@ export const PROJECT_SETTINGS: ProjectSettings = {
1315}
1416
1517const HelloScene = ( ) => {
18+ const progress = useVariable ( 0 )
19+
20+ useAnimation ( async ( context ) => {
21+ await context . move ( progress ) . to ( 1 , seconds ( 2 ) , BEZIER_SMOOTH )
22+ await context . sleep ( seconds ( 1 ) )
23+ await context . move ( progress ) . to ( 0 , seconds ( 2 ) , BEZIER_SMOOTH )
24+ } , [ ] )
25+
1626 return (
1727 < FillFrame style = { { alignItems : "center" , justifyContent : "center" } } >
1828 < DrawText
1929 text = "Hello, world!"
2030 fontUrl = "assets/NotoSerifCJKJP-Medium.ttf"
2131 strokeWidth = { 2 }
22- durationFrames = { seconds ( 2 ) }
32+ progress = { progress }
2333 />
2434 </ FillFrame >
2535 )
@@ -29,7 +39,7 @@ export const PROJECT = () => {
2939 return (
3040 < Project >
3141 < TimeLine >
32- < Clip label = "Hello" duration = { seconds ( 5 ) } >
42+ < Clip label = "Hello" >
3343 < HelloScene />
3444 </ Clip >
3545 </ TimeLine >
You can’t perform that action at this time.
0 commit comments