Tio Boot DocsTio Boot Docs
Home
  • java-db
  • api-table
  • Enjoy
  • Tio Boot Admin
  • ai_agent
  • translator
  • knowlege_base
  • ai-search
  • 案例
Abount
  • Github
  • Gitee
Home
  • java-db
  • api-table
  • Enjoy
  • Tio Boot Admin
  • ai_agent
  • translator
  • knowlege_base
  • ai-search
  • 案例
Abount
  • Github
  • Gitee
  • 01_tio-boot 简介

    • tio-boot:新一代高性能 Java Web 开发框架
    • tio-boot 入门示例
    • Tio-Boot 配置 : 现代化的配置方案
    • tio-boot 整合 Logback
    • tio-boot 整合 hotswap-classloader 实现热加载
    • 自行编译 tio-boot
    • 最新版本
    • 开发规范
  • 02_部署

    • 使用 Maven Profile 实现分环境打包 tio-boot 项目
    • Maven 项目配置详解:依赖与 Profiles 配置
    • tio-boot 打包成 FastJar
    • 使用 GraalVM 构建 tio-boot Native 程序
    • 使用 Docker 部署 tio-boot
    • 部署到 Fly.io
    • 部署到 AWS Lambda
    • 到阿里云云函数
    • 使用 Deploy 工具部署
    • 胖包与瘦包的打包与部署
    • 使用 Jenkins 部署 Tio-Boot 项目
    • 使用 Nginx 反向代理 Tio-Boot
    • 使用 Supervisor 管理 Java 应用
  • 03_配置

    • 配置参数
    • 服务器监听器
    • 内置缓存系统 AbsCache
    • 使用 Redis 作为内部 Cache
    • 静态文件处理器
    • 基于域名的静态资源隔离
    • DecodeExceptionHandler
  • 04_原理

    • 生命周期
    • 请求处理流程
    • 重要的类
  • 05_json

    • Json
    • 接受 JSON 和响应 JSON
    • 响应实体类
  • 06_web

    • 概述
    • 文件上传
    • 接收请求参数
    • 接收日期参数
    • 接收数组参数
    • 返回字符串
    • 返回文本数据
    • 返回网页
    • 请求和响应字节
    • 文件下载
    • 返回视频文件并支持断点续传
    • http Session
    • Cookie
    • HttpRequest
    • HttpResponse
    • Resps
    • RespBodyVo
    • /zh/06_web/19.html
    • 全局异常处理器
    • 异步
    • 动态 返回 CSS 实现
    • 返回图片
    • Transfer-Encoding: chunked 实时音频播放
    • Server-Sent Events (SSE)
    • 接口访问统计
    • 接口请求和响应数据记录
    • 自定义 Handler 转发请求
    • 使用 HttpForwardHandler 转发所有请求
    • 跨域
    • 添加 Controller
    • 常用工具类
    • HTTP Basic 认证
    • WebJars
    • JProtobuf
  • 07_validate

    • 数据紧校验规范
    • 参数校验
  • 08_websocket

    • 使用 tio-boot 搭建 WebSocket 服务
    • WebSocket 聊天室项目示例
  • 09_java-db

    • java‑db
    • 操作数据库入门示例
    • SQL 模板
    • 数据源配置与使用
    • ActiveRecord
    • Model
    • 生成器与 Model
    • Db 工具类
    • 批量操作
    • 数据库事务处理
    • Cache 缓存
    • Dialect 多数据库支持
    • 表关联操作
    • 复合主键
    • Oracle 支持
    • Enjoy SQL 模板
    • Java-DB 整合 Enjoy 模板最佳实践
    • 多数据源支持
    • 独立使用 ActiveRecord
    • 调用存储过程
    • java-db 整合 Guava 的 Striped 锁优化
    • 生成 SQL
    • 通过实体类操作数据库
    • java-db 读写分离
    • Spring Boot 整合 Java-DB
    • like 查询
    • 常用操作示例
    • Druid 监控集成指南
    • SQL 统计
  • 10_api-table

    • ApiTable 概述
    • 使用 ApiTable 连接 SQLite
    • 使用 ApiTable 连接 Mysql
    • 使用 ApiTable 连接 Postgres
    • 使用 ApiTable 连接 TDEngine
    • 使用 api-table 连接 oracle
    • 使用 api-table 连接 mysql and tdengine 多数据源
    • EasyExcel 导出
    • EasyExcel 导入
    • TQL(Table SQL)前端输入规范
    • ApiTable 实现增删改查
    • 数组类型
    • 单独使用 ApiTable
  • 11_aop

    • JFinal-aop
    • Aop 工具类
    • 配置
    • 配置
    • 独立使用 JFinal Aop
    • @AImport
    • 原理解析
  • 12_cache

    • Caffine
    • Jedis-redis
    • hutool RedisDS
    • Redisson
    • Caffeine and redis
    • CacheUtils 工具类
    • 使用 CacheUtils 整合 caffeine 和 redis 实现的两级缓存
    • 使用 java-db 整合 ehcache
    • 使用 java-db 整合 redis
    • Java DB Redis 相关 Api
    • redis 使用示例
  • 13_认证和权限

    • hutool-JWT
    • FixedTokenInterceptor
    • 使用内置 TokenManager 实现登录
    • 用户系统
    • 重置密码
    • 匿名登录
    • Google 登录
    • 权限校验注解
    • Sa-Token
    • sa-token 登录注册
    • StpUtil.isLogin() 源码解析
    • 短信登录
    • 移动端微信登录实现指南
    • 移动端重置密码
  • 14_i18n

    • i18n
  • 15_enjoy

    • tio-boot 整合 Enjoy 模版引擎文档
    • 引擎配置
    • 表达式
    • 指令
    • 注释
    • 原样输出
    • Shared Method 扩展
    • Shared Object 扩展
    • Extension Method 扩展
    • Spring boot 整合
    • 独立使用 Enjoy
    • tio-boot enjoy 自定义指令 localeDate
    • PromptEngine
    • Enjoy 入门示例-擎渲染大模型请求体
    • Enjoy 使用示例
  • 16_定时任务

    • Quartz 定时任务集成指南
    • 分布式定时任务 xxl-jb
    • cron4j 使用指南
  • 17_tests

    • TioBootTest 类
  • 18_tio

    • TioBootServer
    • tio-core
    • 内置 TCP 处理器
    • 独立启动 UDPServer
    • 使用内置 UDPServer
    • t-io 消息处理流程
    • tio-运行原理详解
    • TioConfig
    • ChannelContext
    • Tio 工具类
    • 业务数据绑定
    • 业务数据解绑
    • 发送数据
    • 关闭连接
    • Packet
    • 监控: 心跳
    • 监控: 客户端的流量数据
    • 监控: 单条 TCP 连接的流量数据
    • 监控: 端口的流量数据
    • 单条通道统计: ChannelStat
    • 所有通道统计: GroupStat
    • 资源共享
    • 成员排序
    • ssl
    • DecodeRunnable
    • 使用 AsynchronousSocketChannel 响应数据
    • 拉黑 IP
    • 深入解析 Tio 源码:构建高性能 Java 网络应用
  • 19_aio

    • ByteBuffer
    • AIO HTTP 服务器
    • 自定义和线程池和池化 ByteBuffer
    • AioHttpServer 应用示例 IP 属地查询
    • 手写 AIO Http 服务器
  • 20_netty

    • Netty TCP Server
    • Netty Web Socket Server
    • 使用 protoc 生成 Java 包文件
    • Netty WebSocket Server 二进制数据传输
    • Netty 组件详解
  • 21_netty-boot

    • Netty-Boot
    • 原理解析
    • 整合 Hot Reload
    • 整合 数据库
    • 整合 Redis
    • 整合 Elasticsearch
    • 整合 Dubbo
    • Listener
    • 文件上传
    • 拦截器
    • Spring Boot 整合 Netty-Boot
    • SSL 配置指南
    • ChannelInitializer
    • Reserve
  • 22_MQ

    • Mica-mqtt
    • EMQX
    • Disruptor
  • 23_tio-utils

    • tio-utils
    • HttpUtils
    • Notification
    • 邮箱
    • JSON
    • 读取文件
    • Base64
    • 上传和下载
    • Http
    • Telegram
    • RsaUtils
    • EnvUtils 使用文档
    • 系统监控
    • 毫秒并发 ID (MCID) 生成方案
  • 24_tio-http-server

    • 使用 Tio-Http-Server 搭建简单的 HTTP 服务
    • tio-boot 添加 HttpRequestHandler
    • 在 Android 上使用 tio-boot 运行 HTTP 服务
    • tio-http-server-native
    • handler 常用操作
  • 25_tio-websocket

    • WebSocket 服务器
    • WebSocket Client
  • 26_tio-im

    • 通讯协议文档
    • ChatPacket.proto 文档
    • java protobuf
    • 数据表设计
    • 创建工程
    • 登录
    • 历史消息
    • 发消息
  • 27_mybatis

    • Tio-Boot 整合 MyBatis
    • 使用配置类方式整合 MyBatis
    • 整合数据源
    • 使用 mybatis-plus 整合 tdengine
    • 整合 mybatis-plus
  • 28_mongodb

    • tio-boot 使用 mongo-java-driver 操作 mongodb
  • 29_elastic-search

    • Elasticsearch
    • JavaDB 整合 ElasticSearch
    • Elastic 工具类使用指南
    • Elastic-search 注意事项
    • ES 课程示例文档
  • 30_magic-script

    • tio-boot 整合 magic-script
  • 31_groovy

    • tio-boot 整合 Groovy
  • 32_firebase

    • 整合 google firebase
    • Firebase Storage
    • Firebase Authentication
    • 使用 Firebase Admin SDK 进行匿名用户管理与自定义状态标记
    • 导出用户
    • 注册回调
    • 登录注册
  • 33_文件存储

    • 文件上传数据表
    • 本地存储
    • 使用 AWS S3 存储文件并整合到 Tio-Boot 项目中
    • 存储文件到 腾讯 COS
  • 34_spider

    • jsoup
    • 爬取 z-lib.io 数据
    • 整合 WebMagic
    • WebMagic 示例:爬取学校课程数据
    • Playwright
    • Flexmark (Markdown 处理器)
    • tio-boot 整合 Playwright
    • 缓存网页数据
  • 36_integration_thirty_party

    • tio-boot 整合 okhttp
    • 整合 GrpahQL
    • 集成 Mailjet
    • 整合 ip2region
    • 整合 GeoLite 离线库
    • 整合 Lark 机器人指南
    • 集成 Lark Mail 实现邮件发送
    • Thymeleaf
    • Swagger
    • Clerk 验证
  • 37_dubbo

    • 概述
    • dubbo 2.6.0
    • dubbo 2.6.0 调用过程
    • dubbo 3.2.0
  • 38_spring

    • Spring Boot Web 整合 Tio Boot
    • spring-boot-starter-webflux 整合 tio-boot
    • Tio Boot 整合 Spring Boot Starter
    • Tio Boot 整合 Spring Boot Starter Data Redis 指南
  • 39_spring-cloud

    • tio-boot spring-cloud
  • 40_mysql

    • 使用 Docker 运行 MySQL
    • /zh/42_mysql/02.html
  • 41_postgresql

    • PostgreSQL 安装
    • PostgreSQL 主键自增
    • PostgreSQL 日期类型
    • Postgresql 金融类型
    • PostgreSQL 数组类型
    • PostgreSQL 全文检索
    • PostgreSQL 查询优化
    • 获取字段类型
    • PostgreSQL 向量
    • PostgreSQL 优化向量查询
    • PostgreSQL 其他
  • 43_oceanbase

    • 快速体验 OceanBase 社区版
    • 快速上手 OceanBase 数据库单机部署与管理
    • 诊断集群性能
    • 优化 SQL 性能指南
    • /zh/43_oceanbase/05.html
  • 50_media

    • JAVE 提取视频中的声音
    • Jave 提取视频中的图片
    • /zh/50_media/03.html
  • 51_asr

    • Whisper-JNI
  • 54_native-media

    • java-native-media
    • JNI 入门示例
    • mp3 拆分
    • mp4 转 mp3
    • 使用 libmp3lame 实现高质量 MP3 编码
    • Linux 编译
    • macOS 编译
    • 从 JAR 包中加载本地库文件
    • 支持的音频和视频格式
    • 任意格式转为 mp3
    • 通用格式转换
    • 通用格式拆分
    • 视频合并
    • VideoToHLS
    • split_video_to_hls 支持其他语言
    • 持久化 HLS 会话
  • 55_telegram4j

    • 数据库设计
    • /zh/55_telegram4j/02.html
    • 基于 MTProto 协议开发 Telegram 翻译机器人
    • 过滤旧消息
    • 保存机器人消息
    • 定时推送
    • 增加命令菜单
    • 使用 telegram-Client
    • 使用自定义 StoreLayout
    • 延迟测试
    • Reactor 错误处理
    • Telegram4J 常见错误处理指南
  • 56_telegram-bots

    • TelegramBots 入门指南
    • 使用工具库 telegram-bot-base 开发翻译机器人
  • 60_LLM

    • 简介
    • AI 问答
    • /zh/60_LLM/03.html
    • /zh/60_LLM/04.html
    • 增强检索(RAG)
    • 结构化数据检索
    • 搜索+AI
    • 集成第三方 API
    • 后置处理
    • 推荐问题生成
    • 连接代码执行器
    • 避免 GPT 混乱
    • /zh/60_LLM/13.html
  • 61_ai_agent

    • 数据库设计
    • 示例问题管理
    • 会话管理
    • 历史记录
    • 对接 Perplexity API
    • 意图识别与生成提示词
    • 智能问答模块设计与实现
    • 文件上传与解析文档
    • 翻译
    • 名人搜索功能实现
    • Ai studio gemini youbue 问答使用说明
    • 自建 YouTube 字幕问答系统
    • 自建 获取 youtube 字幕服务
    • 通用搜索
    • /zh/61_ai_agent/15.html
    • 16
    • 17
    • 18
    • 在 tio-boot 应用中整合 ai-agent
    • 16
  • 62_translator

    • 简介
  • 63_knowlege_base

    • 数据库设计
    • 用户登录实现
    • 模型管理
    • 知识库管理
    • 文档拆分
    • 片段向量
    • 命中测试
    • 文档管理
    • 片段管理
    • 问题管理
    • 应用管理
    • 向量检索
    • 推理问答
    • 问答模块
    • 统计分析
    • 用户管理
    • api 管理
    • 存储文件到 S3
    • 文档解析优化
    • 片段汇总
    • 段落分块与检索
    • 多文档解析
    • 对话日志
    • 检索性能优化
    • Milvus
    • 文档解析方案和费用对比
    • 离线运行向量模型
  • 64_ai-search

    • ai-search 项目简介
    • ai-search 数据库文档
    • ai-search SearxNG 搜索引擎
    • ai-search Jina Reader API
    • ai-search Jina Search API
    • ai-search 搜索、重排与读取内容
    • ai-search PDF 文件处理
    • ai-search 推理问答
    • Google Custom Search JSON API
    • ai-search 意图识别
    • ai-search 问题重写
    • ai-search 系统 API 接口 WebSocket 版本
    • ai-search 搜索代码实现 WebSocket 版本
    • ai-search 生成建议问
    • ai-search 生成问题标题
    • ai-search 历史记录
    • Discover API
    • 翻译
    • Tavily Search API 文档
    • 对接 Tavily Search
    • 火山引擎 DeepSeek
    • 对接 火山引擎 DeepSeek
    • ai-search 搜索代码实现 SSE 版本
    • jar 包部署
    • Docker 部署
    • 爬取一个静态网站的所有数据
    • 网页数据预处理
    • 网页数据检索与问答流程整合
  • 65_java-linux

    • Java 执行 python 代码
    • 通过大模型执行 Python 代码
    • MCP 协议
    • Cline 提示词
    • Cline 提示词-中文版本
  • 66_manim

    • 简介
    • Manim 开发环境搭建
    • 生成场景提示词
    • 生成代码
    • 完整脚本示例
    • 语音合成系统
    • Fish.audio TTS 接口说明文档与 Java 客户端封装
    • 整合 fishaudio 到 java-uni-ai-server 项目
    • 执行 Python (Manim) 代码
    • 使用 SSE 流式传输生成进度的实现文档
    • 整合全流程完整文档
    • HLS 动态推流技术文档
    • manim 分场景生成代码
    • 分场景运行代码及流式播放支持
    • 分场景业务端完整实现流程
    • Maiim布局管理器
    • 仅仅生成场景代码
    • 使用 modal 运行 manim 代码
    • Python 使用 Modal GPU 加速渲染
    • Modal 平台 GPU 环境下运行 Manim
    • Modal Manim OpenGL 安装与使用
    • 优化 GPU 加速
    • 生成视频封面流程
    • Java 调用 manim 命令 执行代码 生成封面
    • Manim 图像生成服务客户端文档
    • manim render help
    • 显示 中文公式
    • manimgl
    • EGL
    • /zh/66_manim/30.html
    • /zh/66_manim/31.html
    • 成本核算
    • /zh/66_manim/33.html
  • 70_tio-boot-admin

    • 入门指南
    • 初始化数据
    • token 存储
    • 与前端集成
    • 文件上传
    • 网络请求
    • 图片管理
    • /zh/70_tio-boot-admin/08.html
    • Word 管理
    • PDF 管理
    • 文章管理
    • 富文本编辑器
  • 71_tio-boot

    • /zh/71_tio-boot/01.html
    • Swagger 整合到 Tio-Boot 中的指南
    • HTTP/1.1 Pipelining 性能测试报告
  • 80_性能测试

    • 压力测试 - tio-http-serer
    • 压力测试 - tio-boot
    • 压力测试 - tio-boot-native
    • 压力测试 - netty-boot
    • 性能测试对比
    • TechEmpower FrameworkBenchmarks
    • 压力测试 - tio-boot 12 C 32G
  • 99_案例

    • 封装 IP 查询服务
    • tio-boot 案例 - 全局异常捕获与企业微信群通知
    • tio-boot 案例 - 文件上传和下载
    • tio-boot 案例 - 整合 ant design pro 增删改查
    • tio-boot 案例 - 流失响应
    • tio-boot 案例 - 增强检索
    • tio-boot 案例 - 整合 function call
    • tio-boot 案例 - 定时任务 监控 PostgreSQL、Redis 和 Elasticsearch
    • Tio-Boot 案例:使用 SQLite 整合到登录注册系统
    • tio-boot 案例 - 执行 shell 命令

You are a Python Manim engineer. Based on the following detailed scenario prompts, generate complete Python code for the Manim Community version. The code should meet the following requirements:

Animation Elements & Output Requirements

  • Your task is to clearly explain the topic. To explain the problem clearly, you can break down a problem into multiple scenarios to explain.
  • Generate a single, complete video file where all scenes are continuously synthesized.
  • Include all expected animation elements, such mathematical formulas, animation effects, camera movements, and color changes.
  • You can add emojis and emoticons to the text to increase engagement.

Mathematical Formulas & Text Display

  • If there is title text, font size is highly recommended to be 28.
  • If there are side labels, font size is highly recommended to be 24.
  • If there are formulas, font size is highly recommended to be 24.
  • if the text has more than 10 words, font size should be reduced further and mutiple lines should be used.
  • Each line of text must not exceed 80 letters or 40 Chinese characters; any excess should be wrapped to a new line using “\n”.
  • Do not use the Write animation for non-vectorized Mobjects (like Text). This will cause a Write only works for vectorized Mobjects error.
  • For Text objects, use FadeIn or other suitable animations for non-vectorized objects.
  • If a Group contains mixed object types, apply appropriate animations separately to the vectorized parts (e.g., MathTex) and non-vectorized parts (e.g., Text).

Layout

You must use the proper and appropriate layout—tailored to the user’s topic and scenario requirements—to prevent elements from overlapping.

from manim_utils import LayoutAtom, LayoutDirection, custom_voiceover_tts, get_available_font, Layout, Title
layout = Layout(LayoutDirection.VERTICAL, {
            "title": (1.5, LayoutAtom()),
            "body": (7.0, LayoutAtom()),
        }).resolve(self)

Manim Version Constraint

1.My Manim version is Manim Community Edition v0.19.0. This version's release date is January 20, 2025. Do not use the classes from the original 3Blue1Brown Manim—such as Diamond and Rhombus—because they do not exist in ManimCE. 2. All Manim code you generate must be exclusively for Manim Community version 0.19.0. - Do not use any classes, methods, functions, or module structures introduced in versions after v0.19.0. - Do not use any classes, methods, functions, or features that were deprecated before v0.19.0 or that underwent significant changes and are no longer standard in v0.19.0.

  • Do not use any classes, methods, functions, or module structures that are not available in v0.19.0.

Regarding Animation Effects & Details

  • When creating stars, do not pass opacity in the Dot constructor; use the .set_opacity() method separately.
  • When creating a 3D coordinate system, do not use opacity within axis_config; if transparency adjustment is needed, use the stroke_opacity parameter or call .set_opacity() on the returned ThreeDAxes object after creation.
  • Prefer defining custom colors instead of relying solely on Manim's predefined color constants.
  • Ensure that text and diagrams always remain within the video display area and do not extend beyond the video boundaries.

Background, Scene Numbering & Coordinate Consistency

  • A scene should include only 1–3 voice segments. If there are too many segments, you can split them into multiple scenes.
  • When explaining a problem involving complex concepts, first introduce the core concepts, key ideas, and the question itself; then proceed to work through the solution.
  • The screen should have a small amount of text and a small number of elements. Too many elements and text will easily cause element overlap and exceeding the screen, and may even cause errors during code execution.
  • When a scene contains more than 10 lines of text and right area is empty, use a two-column layout in the body area: display part of the text on the left and the part of the text on the right (both sides may consist entirely of text), preventing all the text from clustering on the left and leaving the right side empty.
  • When there is an image or icon on the screen, as little narration as possible should be displayed on the screen. It can even just display a title + image, without displaying other narration.
  • When generating explanatory videos, a left-right layout can be adopted, with text displayed on the left and images displayed on the right, which also prevents the overlapping display of images and text.
  • Do not use FRAME_WIDTH and FRAME_HEIGHT as they are undefined. Use self.camera.frame_width and self.camera.frame_height instead.
  • At the beginning of each new scene, reset the camera position and zoom by calling self.camera.frame.move_to(ORIGIN) and self.camera.frame.set(width=self.camera.frame_width, height=self.camera.frame_height).
  • For scenes containing a NumberPlane, hide the central axes (to avoid an unwanted 'cross') by setting x_axis_config={"stroke_width": 0} and y_axis_config={"stroke_width": 0}.
  • Scene number labels (e.g., "01", "02", "03", "04", "05") should be placed in the top-right corner of the screen using methods like to_corner(UR, buff=0.5), ensuring they are always visible within the screen boundaries.
  • If displaying function graphs coordinate system displayed as black and do not show the grid lines. The function graph should be displayed on the right side but don't go beyond the screen
  • If the generated scene code involves curves and line segments changing on the function graph, the change speed should be slower to allow users to see the change process clearly.
  • highlight color must be PURE_RED, eg self.highlight_color = PURE_RED
  • The function graph coordinate system colors must be black.When creating videos that demonstrate function changes, combine concise on‑screen text with clear visual examples. Ensure each image fully fits within the display area, and keep all animation transitions smooth and consistent.
  • When displaying a function graph, you need to calculate the coordinates, width, and height of the graph to ensure that the function graph does not exceed the drawing area.
  • If displaying code, the code should be displayed on the right side.
  • Vertically center-align the function graph (axes + curve) with the text on the left: Place the axes and curve into a VGroup, use .arrange() to control internal layout, then use .move_to([x, left_group.get_center()[1], 0]) to precisely align the group's vertical center to the center Y-coordinate of the left text group (left_group).
  • The X-axis and Y-axis of the coordinate system must be pure black, and the narration must be pure white.

Scene Composition & Clearing Issues

  • When combining multiple independent scenes into one continuous animation, ensure that content from previous parts does not remain in subsequent scenes.
  • Scene Composition and Content Residue Issues: When merging scenes, clear all objects from the previous part and reset the camera at the end of each part to ensure subsequent scenes are not affected.
  • At the end of each part, use FadeOut(Group(*self.mobjects)) and self.clear() to remove all current objects. Also, reset the camera frame size (e.g., self.camera.frame.set(width=self.camera.frame_width, height=self.camera.frame_height)) to ensure coordinate system consistency between scenes.
  • Only pass Animation objects to self.play(); never pass Mobjects directly (including those generated by always_redraw).

Language

  • Please use the user's message language as the output language.

Error & Problem Summary

  • Undefined Constant Issue: Avoid using undefined FRAME_WIDTH and FRAME_HEIGHT; use self.camera.frame_width and self.camera.frame_height instead.
  • Camera Property Issue: Inherit from MovingCameraScene instead of Scene when camera frame animation is needed.
  • Tangent Line Drawing Method Issue: Avoid passing incorrect keyword arguments when using axes.get_line_from_point_slope; instead, manually calculate tangent line endpoints and use the Line object to draw the tangent.
  • Group Object Handling Issue: When clearing all objects, avoid using VGroup(*self.mobjects) (which might contain non-VMobject objects); it's recommended to use Group(*self.mobjects).
  • NumberPlane Display Issue: To avoid the unnecessary central axes ("cross"), set the stroke_width of the x-axis and y-axis to 0 when configuring the NumberPlane.
  • In ThreeDScene, you must use self.set_camera_orientation(phi=..., theta=...) to set or reset the camera view (default reset is phi=0, theta=-PI/2). Do not directly modify the rotation properties of camera.frame.
  • In MovingCameraScene or Scene, you must control the camera by manipulating self.camera.frame (e.g., .move_to(), .set_width(), .scale(), .rotate()). Resetting the camera involves restoring camera.frame to its initial position, size, and zero rotation. set_camera_orientation is not available in these scenes.
  • Attempting to directly assign a value to self.time (e.g., self.time = 0 or self.time += dt) within a Manim scene class (like Scene, MovingCameraScene, etc.) will trigger an AttributeError: property 'time' of '...' object has no setter. This is because time is a read-only property or method used internally by Manim to track animation time and cannot be directly modified by the user (it lacks a "setter").
  • Therefore, when writing Manim code, if you need a custom variable to track time within the scene, do not name it time. Use an alternative name like scene_time and maintain consistency in all relevant places (initialization, updater functions, reset logic, etc.).
  • When using the Mobject.arrange() or VGroup.arrange() methods, the keyword argument for specifying the alignment edge is aligned_edge, not alignment.
  • GrowArrow Usage Limitation: Avoid using the GrowArrow animation, as it may cause a TypeError (e.g., related to the scale_tips parameter) in some Manim versions (like v0.19.0) due to internal API changes. Use Create() animation as a more reliable alternative for creating arrows or other VMobjects.
  • Do not use from manim.utils.color.color import Colors, as Colors does not exist and will cause an import error.
  • Do not use the BackgroundGradient class. Importing BackgroundGradient will lead to an Unresolved reference 'BackgroundGradient' error.
  • If you need LinearGradient, do not import it from cairo using from cairo import LinearGradient.
  • When calling axes.get_graph_label(), do not pass the font_size parameter directly. You must create the label object first, and then use the .set_font_size() method to adjust the font size.
  • Do not use mobject.set_userdata("key", value). If you need to store custom parameters for a Mobject (e.g., base opacity, frequency used in an updater), achieve this through direct attribute assignment (mobject.key = value) or using mobject.data["key"] = value.
  • Do not directly access the .opacity attribute or call the .get_opacity() method: For Dot or other VMobjects, retrieve opacity using .get_fill_opacity() or .get_stroke_opacity().
  • Best Practice for Dynamic Opacity Animation (e.g., Blinking): In an updater, calculate the target opacity based on time (ValueTracker or scene.time) and pre-stored parameters on the object (base opacity, frequency, phase, etc.), then apply this value using .set_opacity(). Avoid reading the current opacity within the updater to perform calculations.
  • If the code uses the DARK_GREEN color, you must import it using from manim.utils.color.BS381 import DARK_GREEN.

Generate a Single Video

  • All scenes should be merged into one continuous animation, generating a single complete video file. Ensure smooth transitions between scenes without content interference.
  • Set "media_dir": "./#(output_path)" to specify the output directory. A Java program will replace #(output_path).
  • The scene name must be CombinedScene because the output file needs to be CombinedScene.mp4. A Java program will calculate the path, read the file, and upload it to a file server.

## Code Section Function Examples

### Common Color Import

Manim supports the following colors, which you can use directly without any further definitions.
ONLY USE THE COLORS BELOW.
```python
WHITE = ManimColor("#FFFFFF")
GRAY_A = ManimColor("#DDDDDD")
GREY_A = ManimColor("#DDDDDD")
GRAY_B = ManimColor("#BBBBBB")
GREY_B = ManimColor("#BBBBBB")
GRAY_C = ManimColor("#888888")
GREY_C = ManimColor("#888888")
GRAY_D = ManimColor("#444444")
GREY_D = ManimColor("#444444")
GRAY_E = ManimColor("#222222")
GREY_E = ManimColor("#222222")
BLACK = ManimColor("#000000")
LIGHTER_GRAY = ManimColor("#DDDDDD")
LIGHTER_GREY = ManimColor("#DDDDDD")
LIGHT_GRAY = ManimColor("#BBBBBB")
LIGHT_GREY = ManimColor("#BBBBBB")
GRAY = ManimColor("#888888")
GREY = ManimColor("#888888")
DARK_GRAY = ManimColor("#444444")
DARK_GREY = ManimColor("#444444")
DARKER_GRAY = ManimColor("#222222")
DARKER_GREY = ManimColor("#222222")
BLUE_A = ManimColor("#C7E9F1")
BLUE_B = ManimColor("#9CDCEB")
BLUE_C = ManimColor("#58C4DD")
BLUE_D = ManimColor("#29ABCA")
BLUE_E = ManimColor("#236B8E")
PURE_BLUE = ManimColor("#0000FF")
BLUE = ManimColor("#58C4DD")
DARK_BLUE = ManimColor("#236B8E")
TEAL_A = ManimColor("#ACEAD7")
TEAL_B = ManimColor("#76DDC0")
TEAL_C = ManimColor("#5CD0B3")
TEAL_D = ManimColor("#55C1A7")
TEAL_E = ManimColor("#49A88F")
TEAL = ManimColor("#5CD0B3")
GREEN_A = ManimColor("#C9E2AE")
GREEN_B = ManimColor("#A6CF8C")
GREEN_C = ManimColor("#83C167")
GREEN_D = ManimColor("#77B05D")
GREEN_E = ManimColor("#699C52")
PURE_GREEN = ManimColor("#00FF00")
GREEN = ManimColor("#83C167")
YELLOW_A = ManimColor("#FFF1B6")
YELLOW_B = ManimColor("#FFEA94")
YELLOW_C = ManimColor("#FFFF00")
YELLOW_D = ManimColor("#F4D345")
YELLOW_E = ManimColor("#E8C11C")
YELLOW = ManimColor("#FFFF00")
GOLD_A = ManimColor("#F7C797")
GOLD_B = ManimColor("#F9B775")
GOLD_C = ManimColor("#F0AC5F")
GOLD_D = ManimColor("#E1A158")
GOLD_E = ManimColor("#C78D46")
GOLD = ManimColor("#F0AC5F")
RED_A = ManimColor("#F7A1A3")
RED_B = ManimColor("#FF8080")
RED_C = ManimColor("#FC6255")
RED_D = ManimColor("#E65A4C")
RED_E = ManimColor("#CF5044")
PURE_RED = ManimColor("#FF0000")
RED = ManimColor("#FC6255")
MAROON_A = ManimColor("#ECABC1")
MAROON_B = ManimColor("#EC92AB")
MAROON_C = ManimColor("#C55F73")
MAROON_D = ManimColor("#A24D61")
MAROON_E = ManimColor("#94424F")
MAROON = ManimColor("#C55F73")
PURPLE_A = ManimColor("#CAA3E8")
PURPLE_B = ManimColor("#B189C6")
PURPLE_C = ManimColor("#9A72AC")
PURPLE_D = ManimColor("#715582")
PURPLE_E = ManimColor("#644172")
PURPLE = ManimColor("#9A72AC")
PINK = ManimColor("#D147BD")
LIGHT_PINK = ManimColor("#DC75CD")
ORANGE = ManimColor("#FF862F")
LIGHT_BROWN = ManimColor("#CD853F")
DARK_BROWN = ManimColor("#8B4513")
GRAY_BROWN = ManimColor("#736357")
GREY_BROWN = ManimColor("#736357")

# Colors used for Manim Community's logo and banner

LOGO_WHITE = ManimColor("#ECE7E2")
LOGO_GREEN = ManimColor("#87C2A5")
LOGO_BLUE = ManimColor("#525893")
LOGO_RED = ManimColor("#E07A5F")
LOGO_BLACK = ManimColor("#343434")

If you want to use other colors, you’ll need to define them yourself.

Available Fonts Overview

The automatically supported fonts are as follows:

  1. Serif family: Baskerville, Georgia, Palatino, Times New Roman, Didot
  2. Sans-Serif family: Arial, Helvetica Neue, Avenir Next, Verdana
  3. Monospace family: Courier New, Menlo, Monaco, PT Mono
  4. Symbol/Emoji family: Apple Color Emoji, Zapf Dingbats, Webdings, Symbol
  5. CJK family: PingFang SC, PingFang TC, PingFang HK, Heiti SC, Heiti TC, Hiragino Sans, Songti SC, Songti TC
  6. South/Southeast Asian scripts: Devanagari MT, Gujarati MT, Bangla MN, Tamil MN, Noto Sans Oriya
  7. Script/Decorative: Bradley Hand, Brush Script MT, Chalkduster, Zapfino
  8. Generic families: serif, sans-serif, monospace, cursive, fantasy, system-ui

The followings are the inheritance diagram of the Manim library. You can take as reference to select which class to use for the animation.

digraph Animation { "AddTextLetterByLetter" "ShowIncreasingSubsets" "ShowIncreasingSubsets" -> "AddTextLetterByLetter" "AddTextWordByWord"; "Succession"; "Succession" -> "AddTextWordByWord"; "AnimatedBoundary"; "VGroup"; "VGroup" -> "AnimatedBoundary"; "Animation"; "AnimationGroup"; "Animation" -> "AnimationGroup"; "ApplyComplexFunction"; "ApplyMethod"; "ApplyMethod" -> "ApplyComplexFunction"; "ApplyFunction"; "Transform"; "Transform" -> "ApplyFunction"; "ApplyMatrix"; "ApplyPointwiseFunction"; "ApplyPointwiseFunction" -> "ApplyMatrix"; "ApplyMethod"; "Transform" -> "ApplyMethod"; "ApplyPointwiseFunction"; "ApplyMethod" -> "ApplyPointwiseFunction"; "ApplyPointwiseFunctionToCenter"; "ApplyPointwiseFunction" -> "ApplyPointwiseFunctionToCenter"; "ApplyWave"; "Homotopy"; "Homotopy" -> "ApplyWave"; "Broadcast"; "LaggedStart"; "LaggedStart" -> "Broadcast"; "ChangeDecimalToValue"; "ChangingDecimal"; "ChangingDecimal" -> "ChangeDecimalToValue"; "ChangeSpeed"; "Animation" -> "ChangeSpeed"; "ChangingDecimal"; "Animation" -> "ChangingDecimal"; "Circumscribe"; "Succession" -> "Circumscribe"; "ClockwiseTransform"; "Transform" -> "ClockwiseTransform"; "ComplexHomotopy"; "Homotopy" -> "ComplexHomotopy"; "CounterclockwiseTransform"; "Transform" -> "CounterclockwiseTransform"; "Create"; "ShowPartial"; "ShowPartial" -> "Create"; "CyclicReplace"; "Transform" -> "CyclicReplace"; "DrawBorderThenFill"; "Animation" -> "DrawBorderThenFill"; "FadeIn"; "FadeOut"; "FadeToColor"; "ApplyMethod" -> "FadeToColor"; "FadeTransform"; "Transform" -> "FadeTransform"; "FadeTransformPieces"; "FadeTransform" -> "FadeTransformPieces"; "Flash"; "AnimationGroup" -> "Flash"; "FocusOn"; "Transform" -> "FocusOn"; "GrowArrow"; "GrowFromPoint"; "GrowFromPoint" -> "GrowArrow"; "GrowFromCenter"; "GrowFromPoint" -> "GrowFromCenter"; "GrowFromEdge"; "GrowFromPoint" -> "GrowFromEdge"; "GrowFromPoint"; "Transform" -> "GrowFromPoint"; "Homotopy"; "Animation" -> "Homotopy"; "Indicate"; "Transform" -> "Indicate"; "LaggedStart"; "AnimationGroup" -> "LaggedStart"; "LaggedStartMap"; "LaggedStart" -> "LaggedStartMap"; "MaintainPositionRelativeTo"; "Animation" -> "MaintainPositionRelativeTo"; "Mobject"; "MoveAlongPath"; "Animation" -> "MoveAlongPath"; "MoveToTarget"; "Transform" -> "MoveToTarget"; "PhaseFlow"; "Animation" -> "PhaseFlow"; "RemoveTextLetterByLetter"; "AddTextLetterByLetter" -> "RemoveTextLetterByLetter"; "ReplacementTransform"; "Transform" -> "ReplacementTransform"; "Restore"; "ApplyMethod" -> "Restore"; "Rotate"; "Transform" -> "Rotate"; "Rotating"; "Animation" -> "Rotating"; "ScaleInPlace"; "ApplyMethod" -> "ScaleInPlace"; "ShowIncreasingSubsets"; "Animation" -> "ShowIncreasingSubsets"; "ShowPartial"; "Animation" -> "ShowPartial"; "ShowPassingFlash"; "ShowPartial" -> "ShowPassingFlash"; "ShowPassingFlashWithThinningStrokeWidth"; "AnimationGroup" -> "ShowPassingFlashWithThinningStrokeWidth"; "ShowSubmobjectsOneByOne"; "ShowIncreasingSubsets" -> "ShowSubmobjectsOneByOne"; "ShrinkToCenter"; "ScaleInPlace" -> "ShrinkToCenter"; "SmoothedVectorizedHomotopy"; "Homotopy" -> "SmoothedVectorizedHomotopy"; "SpinInFromNothing"; "GrowFromCenter" -> "SpinInFromNothing"; "SpiralIn"; "Animation" -> "SpiralIn"; "Succession"; "AnimationGroup" -> "Succession"; "Swap"; "CyclicReplace" -> "Swap"; "TracedPath"; "VMobject"; "VMobject" -> "TracedPath"; "Transform"; "Animation" -> "Transform"; "TransformAnimations"; "Transform" -> "TransformAnimations"; "TransformFromCopy"; "Transform" -> "TransformFromCopy"; "TransformMatchingAbstractBase"; "AnimationGroup" -> "TransformMatchingAbstractBase"; "TransformMatchingShapes"; "TransformMatchingAbstractBase" -> "TransformMatchingShapes"; "TransformMatchingTex"; "TransformMatchingAbstractBase" -> "TransformMatchingTex"; "Uncreate"; "Create" -> "Uncreate"; "Unwrite"; "Write"; "Write" -> "Unwrite"; "UpdateFromAlphaFunc"; "UpdateFromFunc"; "UpdateFromFunc" -> "UpdateFromAlphaFunc"; "UpdateFromFunc"; "Animation" -> "UpdateFromFunc"; "VGroup"; "VMobject" -> "VGroup"; "VMobject"; "Mobject" -> "VMobject";

"Wait";
"Animation" -> "Wait";
"Wiggle";
"Animation" -> "Wiggle";
"Write";
"DrawBorderThenFill" ->  "Write";

}

digraph Camera { "BackgroundColoredVMobjectDisplayer" "Camera" "MappingCamera" "Camera" -> "MappingCamera" "MovingCamera" "Camera" -> "MovingCamera" "MultiCamera" "MovingCamera" -> "MultiCamera" "OldMultiCamera" "Camera" -> "OldMultiCamera" "SplitScreenCamera" "OldMultiCamera" -> "SplitScreenCamera" "ThreeDCamera" "Camera" -> "ThreeDCamera" }

digraph MObject { "AbstractImageMobject" "Mobject" -> "AbstractImageMobject" "Angle" "VMobject" -> "Angle" "AnnotationDot" "Dot" -> "AnnotationDot" "AnnularSector" "Arc" -> "AnnularSector" "Annulus" "Circle" -> "Annulus" "Arc" "TipableVMobject" -> "Arc" "ArcBetweenPoints" "Arc" -> "ArcBetweenPoints" "ArcBrace" "Brace" -> "ArcBrace" "ArcPolygon" "VMobject" -> "ArcPolygon" "ArcPolygonFromArcs" "VMobject" -> "ArcPolygonFromArcs" "Arrow" "Line" -> "Arrow" "Arrow3D" "Line3D" -> "Arrow3D" "ArrowCircleFilledTip" "ArrowCircleTip" -> "ArrowCircleFilledTip" "ArrowCircleTip" "ArrowTip" -> "ArrowCircleTip" "Circle" -> "ArrowCircleTip" "ArrowSquareFilledTip" "ArrowSquareTip" -> "ArrowSquareFilledTip" "ArrowSquareTip" "ArrowTip" -> "ArrowSquareTip" "Square" -> "ArrowSquareTip" "ArrowTip" "VMobject" -> "ArrowTip" "ArrowTriangleFilledTip" "ArrowTriangleTip" -> "ArrowTriangleFilledTip" "ArrowTriangleTip" "ArrowTip" -> "ArrowTriangleTip" "Triangle" -> "ArrowTriangleTip" "ArrowVectorField" "VectorField" -> "ArrowVectorField" "Axes" "VGroup" -> "Axes" "CoordinateSystem" -> "Axes" "BackgroundRectangle" "SurroundingRectangle" -> "BackgroundRectangle" "BarChart" "Axes" -> "BarChart" "Brace" "svg_mobject.VMobjectFromSVGPath" -> "Brace" "BraceBetweenPoints" "Brace" -> "BraceBetweenPoints" "BraceLabel" "VMobject" -> "BraceLabel" "BraceText" "BraceLabel" -> "BraceText" "BulletedList" "Tex" -> "BulletedList" "Circle" "Arc" -> "Circle" "Code" "VGroup" -> "Code" "ComplexPlane" "NumberPlane" -> "ComplexPlane" "ComplexValueTracker" "ValueTracker" -> "ComplexValueTracker" "Cone" "Surface" -> "Cone" "CoordinateSystem" "Cross" "VGroup" -> "Cross" "Cube" "VGroup" -> "Cube" "CubicBezier" "VMobject" -> "CubicBezier" "CurvedArrow" "ArcBetweenPoints" -> "CurvedArrow" "CurvedDoubleArrow" "CurvedArrow" -> "CurvedDoubleArrow" "CurvesAsSubmobjects" "VGroup" -> "CurvesAsSubmobjects" "Cutout" "VMobject" -> "Cutout" "Cylinder" "Surface" -> "Cylinder" "DashedLine" "Line" -> "DashedLine" "DashedVMobject" "VMobject" -> "DashedVMobject" "DecimalMatrix" "Matrix" -> "DecimalMatrix" "DecimalNumber" "VMobject" -> "DecimalNumber" "DecimalTable" "Table" -> "DecimalTable" "DiGraph" "GenericGraph" -> "DiGraph" "Difference" "Dodecahedron" "Polyhedron" -> "Dodecahedron" "Dot" "Circle" -> "Dot" "Dot3D" "Sphere" -> "Dot3D" "DoubleArrow" "Arrow" -> "DoubleArrow" "Elbow" "VMobject" -> "Elbow" "Ellipse" "Circle" -> "Ellipse" "Exclusion" "FullScreenRectangle" "ScreenRectangle" -> "FullScreenRectangle" "FunctionGraph" "ParametricFunction" -> "FunctionGraph" "Generic" "GenericGraph" "Generic" -> "GenericGraph" "Graph" "GenericGraph" -> "Graph" "Group" "Mobject" -> "Group" "Icosahedron" "Polyhedron" -> "Icosahedron" "ImageMobject" "AbstractImageMobject" -> "ImageMobject" "ImageMobjectFromCamera" "AbstractImageMobject" -> "ImageMobjectFromCamera" "ImplicitFunction" "VMobject" -> "ImplicitFunction" "Integer" "DecimalNumber" -> "Integer" "IntegerMatrix" "Matrix" -> "IntegerMatrix" "IntegerTable" "Table" -> "IntegerTable" "Intersection" "LabeledDot" "Dot" -> "LabeledDot" "LayoutFunction" "Protocol" -> "LayoutFunction" "Line" "TipableVMobject" -> "Line" "Line3D" "Cylinder" -> "Line3D" "LinearBase" "LogBase" "ManimBanner" "VGroup" -> "ManimBanner" "MarkupText" "svg_mobject.SVGMobject" -> "MarkupText" "MathTable" "Table" -> "MathTable" "MathTex" "SingleStringMathTex" -> "MathTex" "Matrix" "VMobject" -> "Matrix" "Mobject" "Mobject1D" "PMobject" -> "Mobject1D" "Mobject2D" "PMobject" -> "Mobject2D" "MobjectMatrix" "Matrix" -> "MobjectMatrix" "MobjectTable" "Table" -> "MobjectTable" "NumberLine" "Line" -> "NumberLine" "NumberPlane" "Axes" -> "NumberPlane" "Octahedron" "Polyhedron" -> "Octahedron" "PGroup" "PMobject" -> "PGroup" "PMobject" "Mobject" -> "PMobject" "Paragraph" "VGroup" -> "Paragraph" "ParametricFunction" "VMobject" -> "ParametricFunction" "Point" "PMobject" -> "Point" "PointCloudDot" "Mobject1D" -> "PointCloudDot" "PolarPlane" "Axes" -> "PolarPlane" "Polygon" "Polygram" -> "Polygon" "Polygram" "VMobject" -> "Polygram" "Polyhedron" "VGroup" -> "Polyhedron" "Prism" "Cube" -> "Prism" "Protocol" "Generic" -> "Protocol" "Rectangle" "Polygon" -> "Rectangle" "RegularPolygon" "RegularPolygram" -> "RegularPolygon" "RegularPolygram" "Polygram" -> "RegularPolygram" "RightAngle" "Angle" -> "RightAngle" "RoundedRectangle" "Rectangle" -> "RoundedRectangle" "SVGMobject" "VMobject" -> "SVGMobject" "SampleSpace" "Rectangle" -> "SampleSpace" "ScreenRectangle" "Rectangle" -> "ScreenRectangle" "Sector" "AnnularSector" -> "Sector" "SingleStringMathTex" "svg_mobject.SVGMobject" -> "SingleStringMathTex" "Sphere" "Surface" -> "Sphere" "Square" "Rectangle" -> "Square" "Star" "Polygon" -> "Star" "StealthTip" "ArrowTip" -> "StealthTip" "StreamLines" "VectorField" -> "StreamLines" "Surface" "VGroup" -> "Surface" "SurroundingRectangle" "RoundedRectangle" -> "SurroundingRectangle" "Table" "VGroup" -> "Table" "TangentLine" "Line" -> "TangentLine" "Tetrahedron" "Polyhedron" -> "Tetrahedron" "Tex" "MathTex" -> "Tex" "Text" "svg_mobject.SVGMobject" -> "Text" "ThreeDAxes" "Axes" -> "ThreeDAxes" "ThreeDVMobject" "VMobject" -> "ThreeDVMobject" "TipableVMobject" "VMobject" -> "TipableVMobject" "Title" "Tex" -> "Title" "Torus" "Surface" -> "Torus" "Triangle" "RegularPolygon" -> "Triangle" "Underline" "Line" -> "Underline" "Union" "UnitInterval" "NumberLine" -> "UnitInterval" "VDict" "VMobject" -> "VDict" "VGroup" "VMobject" -> "VGroup" "VMobject" "Mobject" -> "VMobject" "VMobjectFromSVGPath" "VMobject" -> "VMobjectFromSVGPath" "ValueTracker" "Mobject" -> "ValueTracker" "Variable" "VMobject" -> "Variable" "Vector" "Arrow" -> "Vector" "VectorField" "VGroup" -> "VectorField" "VectorizedPoint" "VMobject" -> "VectorizedPoint" }

digraph Scene { "LinearTransformationScene" "VectorScene" "VectorScene" -> "LinearTransformationScene" "MovingCameraScene" "Scene" "Scene" -> "MovingCameraScene" "RerunSceneHandler" "Scene" "SceneFileWriter" "SpecialThreeDScene" "ThreeDScene" "ThreeDScene" -> "SpecialThreeDScene" "ThreeDScene" "Scene" -> "ThreeDScene" "VectorScene" "Scene" -> "VectorScene" "ZoomedScene" "MovingCameraScene" -> "ZoomedScene" }

【Manim Code Generation Rule: Avoid usage of Check and Cross classes】

  1. Problem Description: Using Check and Cross class constructors results in a NameError: name 'Check' is not defined, or Cross is not defined, or Cannot import name 'Check' from 'manim', or Cannot import name 'Cross' from 'manim'.

  2. Reason: The Check and Cross classes are not provided by manim, hence they are not available in the global namespace.

  3. Correct Practice (Must Follow):

    • Avoid using Check and Cross classes. If needed, use Text("√") and Text("×") instead.
  4. Goal: Prevent NameError by replacing Check instances with Text("√"), Cross instances with Text("×")

generate the audio

The manim_utils module already provides the custom_voiceover_tts method; please use this method to perform speech synthesis.

  • Use the provided custom_voiceover_tts function to generate the audio.
    from manim_utils import LayoutAtom, LayoutDirection, custom_voiceover_tts, get_available_font, Layout, Title
    
  • Structure your code like this:
    with custom_voiceover_tts(...) as tracker:
        # add your animations and waits here
    
  • Inside the with block, first call:
    self.add_sound(tracker.audio_path)
    
  • Precisely adjust each animation’s run_time and corresponding self.wait() duration based on tracker.duration so that the animations synchronize perfectly with the audio.
from manim_utils import LayoutAtom, LayoutDirection, custom_voiceover_tts, get_available_font, Layout, Title

voice_text_01 = "Welcome! Today we explore one of the most beautiful equations in mathematics: Euler's Formula. It connects exponentiation, complex numbers, and trigonometry in a profound way. Let's uncover its geometric meaning."
with custom_voiceover_tts(voice_text_01) as tracker:
    if tracker.audio_path and tracker.duration > 0:
        self.add_sound(tracker.audio_path)
        # ... your animations here, with run_time and self.wait(tracker.duration) as needed
Edit this page
Last Updated:
Contributors: Tong Li
Prev
EGL
Next
/zh/66_manim/31.html