A LaTeX element renders mathematical formulas and expressions using LaTeX syntax. It supports frame-based content switching with configurable transitions.
LaTeX elements share the common fields from Basic Element and View Element.
| Prop | Type | Required | Example | Value Range | Description |
|---|---|---|---|---|---|
| type | string | true | - | LaTeX | The type of the element. For LaTeX elements, this is always "LaTeX". |
| frames | array | true | - | - | An array of LaTeX frames. Each frame defines a LaTeX expression to display at a specific time range. |
| displayMode | boolean | false | - | - | Whether to render in display mode (block-level, centered) or inline mode. |
| detail | number | false | - | - | The rendering detail level. Higher values produce smoother curves. |
| targetWidth | number | false | - | - | The target width for the rendered LaTeX content, in pixels. |
| color | string | false | - | - | The color of the rendered LaTeX text, in hex format. |
Each item in the frames array defines a LaTeX expression and the time range during which it is displayed:
| Prop | Type | Required | Example | Value Range | Description |
|---|---|---|---|---|---|
| latex | string | true | E = mc^2 | - | The LaTeX expression string to render. |
| start | number | true | - | >= 0 | The start time of this frame relative to the element, in seconds. |
| end | number | true | - | > start | The end time of this frame relative to the element, in seconds. Must be greater than start. |
| transition | object | false | - | - | Transition effect when switching to this frame. |
| style | object | false | - | - | Per-frame style overrides for color, displayMode, and targetWidth. |
Transition Object:
type (string) - Transition type: 'fade', 'instant', or 'morph'. Default: 'instant'duration (number) - Duration of the transition in seconds. Default: 0.5Style Object (per-frame overrides):
color (string) - Override the element-level color for this framedisplayMode (boolean) - Override the display mode for this frametargetWidth (number) - Override the target width for this frame1
2{
3 "id": "latex-001",
4 "type": "LaTeX",
5 "start": 0,
6 "duration": 5,
7 "trackIndex": 0,
8 "x": 200,
9 "y": 300,
10 "width": 400,
11 "height": 100,
12 "anchorX": 200,
13 "anchorY": 50,
14 "rotation": 0,
15 "scaleX": 1,
16 "scaleY": 1,
17 "alpha": 1,
18 "color": "#000000",
19 "displayMode": true,
20 "targetWidth": 400,
21 "frames": [
22 {
23 "latex": "E = mc^2",
24 "start": 0,
25 "end": 5
26 }
27 ]
28}
291
2{
3 "id": "latex-002",
4 "type": "LaTeX",
5 "start": 0,
6 "duration": 10,
7 "trackIndex": 0,
8 "x": 200,
9 "y": 300,
10 "width": 500,
11 "height": 120,
12 "anchorX": 250,
13 "anchorY": 60,
14 "rotation": 0,
15 "scaleX": 1,
16 "scaleY": 1,
17 "alpha": 1,
18 "color": "#1a1a1a",
19 "displayMode": true,
20 "targetWidth": 500,
21 "frames": [
22 {
23 "latex": "f(x) = ax^2 + bx + c",
24 "start": 0,
25 "end": 5,
26 "transition": {
27 "type": "fade",
28 "duration": 0.5
29 }
30 },
31 {
32 "latex": "x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}",
33 "start": 5,
34 "end": 10,
35 "transition": {
36 "type": "morph",
37 "duration": 0.8
38 }
39 }
40 ]
41}
42frames array must contain at least one frame with a valid latex string.start to end) should cover the element's duration for continuous display.morph transition creates a smooth animation between two LaTeX expressions.