Skip to content

Axes & Function Plots

<Axes> creates a 2D coordinate system with labeled tick marks, and <FunctionPlot> draws a mathematical function curve on those axes. Together they form the foundation for any math visualization.

-4-3-2-11234-2-1123
0.00s / 3.97s · F0
PropTypeDefaultDescription
origin[number, number][200, 200]Pixel position of the origin
xRange[number, number][-5, 5]Visible range on the x-axis
yRange[number, number][-5, 5]Visible range on the y-axis
scalenumber40Pixels per unit
colorstring'currentColor'Axis line color
labelColorstring'currentColor'Tick label color
showGridbooleanfalseShow background grid lines
gridColorstring'#e2e8f0'Grid line color
tickSizenumber6Length of tick marks in pixels
PropTypeDefaultDescription
fn(x: number) => numberThe function to plot
domain[number, number][-5, 5]x-domain to evaluate
origin[number, number][200, 200]Pixel position of the origin (must match Axes)
scalenumber40Pixels per unit (must match Axes)
colorstring'#4f46e5'Stroke color of the curve
strokeWidthnumber2Stroke width
samplesnumber200Number of evaluation points
import { Player, Draw, Axes, FunctionPlot } from '@elucim/core';
<Player width={500} height={350} fps={30} durationInFrames={90}>
<Axes origin={[250, 200]} xRange={[-4, 4]} yRange={[-2, 3]} scale={50}
color="currentColor" labelColor="currentColor" showGrid />
<Draw duration={40}>
<FunctionPlot fn={(x) => Math.sin(x)} domain={[-4, 4]}
origin={[250, 200]} scale={50} color="#6c5ce7" strokeWidth={2.5} />
</Draw>
</Player>