LaTeX Element

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.

LaTeX Properties

PropTypeRequiredExampleValue RangeDescription
typestringtrue-LaTeXThe type of the element. For LaTeX elements, this is always "LaTeX".
framesarraytrue--An array of LaTeX frames. Each frame defines a LaTeX expression to display at a specific time range.
displayModebooleanfalse--Whether to render in display mode (block-level, centered) or inline mode.
detailnumberfalse--The rendering detail level. Higher values produce smoother curves.
targetWidthnumberfalse--The target width for the rendered LaTeX content, in pixels.
colorstringfalse--The color of the rendered LaTeX text, in hex format.

Frame Object

Each item in the frames array defines a LaTeX expression and the time range during which it is displayed:

PropTypeRequiredExampleValue RangeDescription
latexstringtrueE = mc^2-The LaTeX expression string to render.
startnumbertrue->= 0The start time of this frame relative to the element, in seconds.
endnumbertrue-> startThe end time of this frame relative to the element, in seconds. Must be greater than start.
transitionobjectfalse--Transition effect when switching to this frame.
styleobjectfalse--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.5

Style Object (per-frame overrides):

  • color (string) - Override the element-level color for this frame
  • displayMode (boolean) - Override the display mode for this frame
  • targetWidth (number) - Override the target width for this frame

Example

Single Frame LaTeX

latexElement.json
1 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} 29

Multi-Frame with Transitions

latexMultiFrame.json
1 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} 42

Notes

  • LaTeX elements use vector rendering for crisp output at any scale.
  • The frames array must contain at least one frame with a valid latex string.
  • Frame time ranges (start to end) should cover the element's duration for continuous display.
  • The morph transition creates a smooth animation between two LaTeX expressions.