ManimCat / src /prompts /api-index.ts
Bin29's picture
Sync from main: 68df783 feat: support multimodal studio reference images
d47b053
/**
* Manim API index - codebook-compressed version
*/
export const API_INDEX = `# Manim API Index (AI, codebook-compressed)
Notes:
1) Look up params in codebook first: full_param:abbr
2) Index sets only use abbreviations
3) ThreeDVMobject inherits VMobject base args via @VMobject
4) Low-level rendering/cache args are intentionally omitted
### Core Methods
method_codebook = {
shift: sh,
move_to: mv,
next_to: nx,
scale: sc,
rotate: rt,
become: bc,
play: pl,
wait: wt,
add: ad,
remove: rm,
arrange: ar,
arrange_in_grid: aig,
to_corner: tc,
to_edge: te,
align_to: at,
set_color: stc,
set_opacity: sto,
set_fill: stf,
set_stroke: sts,
set_width: swi,
set_height: shi,
save_state: svs,
restore: rst,
flip: fl,
center: cen
}
method_param_codebook = {
vectors: vecs,
target: tgt,
mob: mob,
dir: dir,
buff: buf,
factor: fac,
angle: ang,
animations: anims,
run_time: run_t,
duration: dur,
mobjects: mobs,
rows: rows,
cols: cols,
cell_alignment: c_al,
corner: cnr,
edge: edg,
color: col,
opacity: op,
family: fam
}
method_index = {
Mobject_methods: [sh(vecs), mv(tgt), nx(mob, dir, buf), sc(fac), rt(ang), bc(tgt), ar(dir, buf), aig(rows, cols, buf), tc(cnr, buf), te(edg, buf), at(mob, dir), stc(col), sto(op), stf(col, op), sts(col, s_w), swi(wid), shi(hgt), svs(), rst(), fl(dir), cen()],
Scene_methods: [pl(anims, run_t), wt(dur), ad(mobs), rm(mobs)]
}
### Args Codebook
args_codebook = {
angle: ang,
buff: buf,
mobjects: mobs,
background_image: bg_i,
fill_color: f_c,
fill_opacity: f_o,
joint_type: j_t,
shade_in_3d: sh3,
sheen_direction: sh_d,
sheen_factor: sh_f,
stroke_color: s_c,
stroke_opacity: s_o,
stroke_width: s_w,
line1: l1,
line2: l2,
radius: rad,
quadrant: quad,
other_angle: o_ang,
dot: dot,
dot_radius: d_rad,
dot_distance: d_dis,
dot_color: d_col,
elbow: elb,
inner_radius: i_rad,
outer_radius: o_rad,
mark_paths_closed: mpc,
start_angle: s_ang,
start: st,
end: ed,
num_components: n_comp,
arc_center: a_ctr,
vertices: verts,
arc_config: a_cfg,
mobject: mobj,
scale_factor: sc_f,
start_anchor: sa,
start_handle: shd,
end_handle: ehd,
end_anchor: ea,
main_shape: m_sh,
subject: subj,
clip: clip,
point: pt,
width: wid,
height: hgt,
vmobjects: vms,
vertex_groups: v_gps,
grid_xstep: gx,
grid_ystep: gy,
n: n,
num_vertices: n_v,
density: dns,
length: len,
corner_radius: c_rad,
aspect_ratio: asp_r,
side_length: sd_l,
thickness: thk,
base_radius: b_rad,
resolution: res,
direction: dir,
show_base: sh_b,
v_range: v_r,
u_min: u_min,
checkerboard_colors: cb_cols,
show_ends: sh_e,
edge_length: e_len,
dimensions: dims,
vertex_coords: v_coords,
faces_list: f_list,
faces_config: f_cfg,
graph_config: g_cfg,
center: ctr,
u_range: u_r,
major_radius: mj_rad,
minor_radius: mn_rad,
items: items,
dot_scale_factor: d_scf,
tex_environment: tex_env,
code_file: c_file,
code_string: c_str,
language: lang,
formatter_style: fmt_style,
tab_width: tab_w,
add_line_numbers: aln,
line_numbers_from: lnf,
background: bg,
background_config: bg_cfg,
paragraph_config: p_cfg,
text: text,
font_size: fs,
line_spacing: ls,
font: font,
slant: slant,
weight: wgt,
justify: just,
gradient: grad,
should_center: sh_ctr,
disable_ligatures: dis_lig,
warn_missing_font: wmf,
tex_strings: texs,
arg_separator: arg_sep,
substrings_to_isolate: s2i,
tex_to_color_map: t2cm,
tex_string: tex1,
organize_left_to_right: oltr,
tex_template: tex_tpl,
t2c: t2c,
t2f: t2f,
t2g: t2g,
t2s: t2s,
t2w: t2w,
use_svg_cache: usc,
text_parts: t_parts,
include_underline: inc_ul,
match_underline_width_to_text: muwtt,
underline_buff: ul_buf,
alignment: align,
x_range: x_r,
y_range: y_r,
z_range: z_r,
x_length: x_l,
y_length: y_l,
z_length: z_l,
axis_config: ax_cfg,
x_axis_config: xax_cfg,
y_axis_config: yax_cfg,
z_axis_config: zax_cfg,
tips: tips,
values: vals,
bar_names: b_names,
bar_colors: b_cols,
bar_width: b_w,
bar_fill_opacity: b_fo,
bar_stroke_width: b_sw,
edges: eds,
labels: lbls,
label_fill_color: lfc,
layout: layout,
layout_scale: lay_s,
layout_config: lay_cfg,
vertex_type: v_type,
vertex_config: v_cfg,
vertex_mobjects: v_mobs,
edge_type: e_type,
partitions: parts,
root_vertex: r_vert,
edge_config: e_cfg,
unit_size: u_size,
include_ticks: inc_ticks,
tick_size: tick_s,
numbers_with_elongated_ticks: nwet,
longer_tick_multiple: ltm,
exclude_origin_tick: eot,
rotation: rot,
include_tip: inc_tip,
tip_width: tip_w,
tip_height: tip_h,
tip_shape: tip_shape,
include_numbers: inc_nums,
label_direction: l_dir,
label_constructor: l_ctor,
scaling: scaling,
line_to_number_buff: ltnb,
decimal_number_config: dec_cfg,
numbers_to_exclude: n_ex,
numbers_to_include: n_in,
radius_max: r_max,
size: size,
radius_step: r_step,
azimuth_step: az_step,
azimuth_units: az_units,
azimuth_compact_fraction: az_cf,
azimuth_offset: az_off,
azimuth_direction: az_dir,
azimuth_label_buff: az_lb,
azimuth_label_font_size: az_lfs,
radius_config: r_cfg,
background_line_style: bls,
faded_line_style: fls,
faded_line_ratio: flr,
z_normal: z_n,
num_axis_pieces: nap,
light_source: l_src,
depth: depth,
gloss: gloss,
tip_length: tip_l,
sharpness: shrp,
num_dashes: n_d,
num_decimal_places: ndp,
include_sign: inc_s,
group_with_commas: gwc,
unit: unit,
data: data,
row_labels: r_lbls,
col_labels: c_lbls,
include_outer_lines: iol,
function: func,
t_range: t_r,
use_smoothing: u_sm,
amplitude: amp,
time_width: t_w,
lag_ratio: lag_r,
n_times: n_t,
flash_radius: fl_r,
line_length: ln_l
}
### Args Index Sets (abbr only)
base_args_index = {
VMobject: [bg_i, f_c, f_o, j_t, sh3, sh_d, sh_f, s_c, s_o, s_w]
}
unique_args_index = {
shape_2d: {
Angle: [l1, l2, rad, quad, o_ang, dot, d_rad, d_dis, d_col, elb],
AnnularSector: [i_rad, o_rad, ang, s_ang],
Annulus: [i_rad, o_rad, mpc],
Arc: [rad, s_ang, ang, n_comp, a_ctr],
ArcBetweenPoints: [st, ed, ang, rad],
ArcPolygon: [verts, ang, rad, a_cfg],
Circle: [rad],
Cross: [mobj, sc_f],
CubicBezier: [sa, shd, ehd, ea],
Cutout: [m_sh, mobs],
Difference: [subj, clip],
Dot: [pt, rad],
Elbow: [wid, ang],
Ellipse: [wid, hgt],
Exclusion: [subj, clip],
Intersection: [vms],
Polygon: [verts],
Polygram: [v_gps],
Rectangle: [hgt, wid, gx, gy, mpc],
RegularPolygon: [n],
RegularPolygram: [n_v, dns, rad, s_ang],
RightAngle: [l1, l2, len],
RoundedRectangle: [c_rad],
ScreenRectangle: [asp_r, hgt],
Sector: [rad],
Square: [sd_l],
Star: [n, o_rad, i_rad, dns, s_ang],
Union: [vms],
Arrow: [st, ed, buf, s_w, tip_l],
DoubleArrow: [st, ed, buf, s_w, tip_l],
Vector: [dir],
Brace: [mobj, dir, buf, shrp],
SurroundingRectangle: [mobj, buf, c_rad, s_w],
DashedLine: [st, ed, n_d],
VGroup: [mobs],
Group: [mobs]
},
shape_3d: {
Arrow3D: [st, ed, thk, hgt, b_rad, res],
Cone: [b_rad, hgt, dir, sh_b, v_r, u_min, cb_cols],
Cube: [sd_l],
Cylinder: [rad, hgt, dir, v_r, sh_e, res],
Dodecahedron: [e_len],
Dot3D: [pt, rad, res],
Icosahedron: [e_len],
Line3D: [st, ed, thk, res],
Octahedron: [e_len],
Prism: [dims],
Polyhedron: [v_coords, f_list, f_cfg, g_cfg],
Sphere: [ctr, rad, res, u_r, v_r],
Tetrahedron: [e_len],
Torus: [mj_rad, mn_rad, u_r, v_r, res],
Surface: [func, u_r, v_r, res, cb_cols],
ThreeDVMobject: [@VMobject]
},
text_formula: {
BulletedList: [items, buf, d_scf, tex_env],
Code: [c_file, c_str, lang, fmt_style, tab_w, aln, lnf, bg, bg_cfg, p_cfg],
MarkupText: [text, fs, ls, font, slant, wgt, just, grad, tab_w, hgt, wid, sh_ctr, dis_lig, wmf],
MathTex: [texs, arg_sep, s2i, t2cm, tex_env],
Paragraph: [text, ls, align],
SingleStringMathTex: [tex1, sh_ctr, hgt, oltr, tex_env, tex_tpl, fs],
Tex: [texs, arg_sep, tex_env],
Text: [text, fs, ls, font, slant, wgt, t2c, t2f, t2g, t2s, t2w, grad, tab_w, hgt, wid, sh_ctr, dis_lig, wmf, usc],
Title: [t_parts, inc_ul, muwtt, ul_buf],
DecimalNumber: [ndp, inc_s, gwc, fs, unit]
},
coordinate: {
Axes: [x_r, y_r, x_l, y_l, ax_cfg, xax_cfg, yax_cfg, tips],
BarChart: [vals, b_names, y_r, x_l, y_l, b_cols, b_w, b_fo, b_sw],
DiGraph: [verts, eds, lbls, lfc, layout, lay_s, lay_cfg, v_type, v_cfg, v_mobs, e_type, parts, r_vert, e_cfg],
Graph: [verts, eds, lbls, lfc, layout, lay_s, lay_cfg, v_type, v_cfg, v_mobs, e_type, parts, r_vert, e_cfg],
NumberLine: [x_r, len, u_size, inc_ticks, tick_s, nwet, ltm, eot, rot, inc_tip, tip_w, tip_h, tip_shape, inc_nums, fs, l_dir, l_ctor, scaling, ltnb, dec_cfg, n_ex, n_in],
NumberPlane: [x_r, y_r, x_l, y_l, bls, fls, flr],
PolarPlane: [r_max, size, r_step, az_step, az_units, az_cf, az_off, az_dir, az_lb, az_lfs, r_cfg, bls, fls, flr],
ThreeDAxes: [x_r, y_r, z_r, x_l, y_l, z_l, zax_cfg, z_n, nap, l_src, depth, gloss],
ParametricFunction: [func, t_r, u_sm],
Table: [data, r_lbls, c_lbls, iol],
MathTable: [data, r_lbls, c_lbls, iol],
ArrowVectorField: [func]
}
}
`
/**
* Manim Soul API - Supplemental Codebook
* Focus: Animations, Updaters, Camera Control, and Constants
*/
export const SOUL_INDEX = `# Manim Soul Index (Compressed)
### 1. Animation Codebook (The 'How it moves')
anim_codebook = {
Create: cr,
Write: wr,
FadeIn: fi,
FadeOut: fo,
Transform: tr,
ReplacementTransform: rttr,
TransformMatchingTex: tmtex,
TransformMatchingShapes: tmsh,
FadeTransform: ftr,
TransformFromCopy: tfc,
MoveAlongPath: map,
Rotate: rot_anim,
ScaleInPlace: sip,
GrowFromCenter: gfc,
ShrinkToCenter: stca,
Indicate: ind,
Circumscribe: circ,
Flash: flsh,
FocusOn: fon,
ShowPassingFlash: spf,
Wiggle: wgl,
ApplyWave: aw,
LaggedStart: ls,
Succession: succ,
AnimationGroup: agp
}
### 2. Rate Function Codebook (The 'Feel')
rate_codebook = {
smooth: sm,
linear: ln,
double_smooth: dsm,
ease_in_sine: eis,
ease_out_sine: eos,
ease_in_out_sine: eios,
ease_in_out_quad: eioq,
ease_in_cubic: eic,
ease_out_cubic: eoc,
rush_from: rf,
rush_into: ri,
slow_into: si,
there_and_back: tab,
there_and_back_with_pause: tabp,
lingering: ling,
wiggle: wig,
running_start: rs
}
### 3. Logic & Updater Codebook (The 'Brain')
logic_codebook = {
ValueTracker: vt,
DecimalNumber: dn,
add_updater: au,
remove_updater: ru,
always_redraw: alr,
get_value: gv,
set_value: sv,
increment_value: iv
}
### 4. Camera & 3D Codebook (The 'Eyes')
camera_codebook = {
set_camera_orientation: sco,
move_camera: mc,
add_fixed_in_frame_mobjects: afif,
phi: p,
theta: t,
gamma: g,
zoom: z,
focal_distance: fd
}
# 2D Camera Control: MovingCameraScene
# IMPORTANT: self.camera.frame is ONLY available in MovingCameraScene.
# Regular Scene does NOT have camera.frame — using it will raise AttributeError.
# Usage: class MyScene(MovingCameraScene)
MovingCamera_methods = {
self.camera.frame.animate.move_to(target),
self.camera.frame.animate.set_width(w),
self.camera.frame.animate.scale(factor),
self.camera.frame.save_state(),
self.camera.frame.animate.restore()
}
### 5. Constants Codebook (The 'Rules')
const_codebook = {
ORIGIN: O,
UP: U, DOWN: D, LEFT: L, RIGHT: R,
UL: UL, UR: UR, DL: DL, DR: DR,
IN: IN, OUT: OUT,
PI: PI, TAU: TAU, DEGREES: DEG,
COLORS: [BLUE, RED, GREEN, YELLOW, GOLD, WHITE, BLACK]
}
### Soul Method Index Sets
soul_index = {
Anim_Args: [run_time, rate_func, lag_ratio],
Updater_Logic: [vt(val), au(func), alr(func)],
Camera_Control_3D: [sco(p, t, g), mc(p, t, g, z, run_t), afif(mobs)],
Camera_Control_2D: [MovingCameraScene → self.camera.frame.animate.move_to/set_width/scale]
}
`