Fluxion Text DSL

ブラウザで書ける、編集可能なアニメーション DSL

Fluxion は短い宣言的な Text DSL を .fluxion.json に変換し、SVG ランタイムでその場で再生します。 Python や任意コードをブラウザで実行せず、図形の配置・表示タイミング・プロパティアニメーションを安全に試せます。

scene / circle / rect / line / text show と at block animate with easing Generated JSON preview

DSL の使い方

まず scene を宣言し、node を配置し、timeline に show / animate を追加します。左のエディタに貼り付けて Compile または Live compile で確認できます。

1. Scene を設定

scene width=1280 height=720 fps=60 のようにキャンバスサイズと FPS を指定します。省略時は 1280x720 / 60fps です。

2. Node を宣言

circlerectlinetext に一意な id を付け、at x,yfill で見た目を指定します。

3. Timeline を書く

show id で表示し、animate id.x from 0 to 100 duration=1s のようにプロパティを動かします。

最小サンプル

このサンプルはタイトルと円を表示し、円の x 座標を 1.5 秒で移動させます。

scene width=1280 height=720 fps=60
text title "Fluxion MVP" at 640,110 size=32 fill="#e2e8f0"
circle c1 r=48 at 220,360 fill="#38bdf8" stroke="#0f172a" strokeWidth=4

at 0s:
  show title
  show c1

animate c1.x from 220 to 640 duration=1.5s easing=easeInOut

ライブデモ

DSL を編集するとブラウザ内で Fluxion IR にコンパイルされ、右側の SVG プレビューと JSON 出力が更新されます。

0.00 / 0.00
Generated .fluxion.json

            

クイックリファレンス

Text DSL は現在サポートしている小さな構文に絞っています。より詳しい仕様は正本の site/src/content/docs/reference/text-dsl.md を参照してください。

Statements

  • scene width=<number> height=<number> fps=<number>
  • circle <id> r=<number> at x,y
  • rect <id> w=<number> h=<number> at x,y
  • line <id> x1=<number> y1=<number> x2=<number> y2=<number>
  • text <id> "label" at x,y size=<number>
  • math <id> "e^{i\\pi}+1=0" renderer=katex|mathjax size=<number>

Timeline / Properties

  • at 1.5s: で block 内の開始時刻を指定
  • show <id> で node を作成
  • animate <id>.<property> from <value> to <value> duration=1s
  • Property: x, y, scale, rotation, opacity, fill, stroke, strokeWidth, geometry fields
  • Easing: linear, smooth, easeInOut, easeIn, easeOut