main
黄海 5 months ago
parent 0971173b0b
commit e48a8e7f4e

@ -0,0 +1,54 @@
# 导入Manim核心库
from manim import *
# 导入Manim配置模块
import manim
class Updaters(Scene):
def construct(self):
# 创建圆角矩型线宽8线色白填充色蓝宽4.5高2位置在上3左4
rectangle = RoundedRectangle(stroke_width=8, stroke_color=WHITE, fill_color=BLUE_B, width=4.5, height=2).shift(
UP * 3 + LEFT * 4)
# 创建数学公式设置渐变色设置高度1.5
mathtext = MathTex("\\frac{3}{4} = 0.75"
).set_color_by_gradient(GREEN, PINK).set_height(1.5)
# 数学公式位置放在圆角矩型中间
mathtext.move_to(rectangle.get_center())
# 给公式添加一个更新器,公式的位置保持在圆角矩型中间
mathtext.add_updater(lambda x: x.move_to(rectangle.get_center()))
# 开始动画播放
# 动画,矩形出现方式
self.play(FadeIn(rectangle))
# 动画 公式出现
self.play(Write(mathtext))
# 动画矩形移动向右1.5向下5矩形移动时公式跟随移动
self.play(rectangle.animate.shift(RIGHT * 1.5 + DOWN * 5), run_time=6)
# 等待上面动画完成
self.wait()
# 删除公式的更新器
mathtext.clear_updaters()
# 动画矩形向左2向上1公式不跟随矩形移动
self.play(rectangle.animate.shift(LEFT * 2 + UP * 1), run_time=6)
# 当直接运行本脚本时执行以下代码
if __name__ == '__main__':
"""
配置渲染参数并执行场景渲染
等效命令行命令
manim -pql -o custom_output 当前文件.py BoxAnimation
"""
# 配置字典说明:
config = {
"quality": "low_quality", # 渲染质量等级low_quality对应480p
"preview": True, # 渲染完成后自动打开播放器
"input_file": __file__, # 指定输入文件为当前文件
"media_dir": "./custom_output" # 自定义输出目录默认在media/
}
# 使用临时配置渲染场景配置只在with块内有效
with manim.tempconfig(config):
# 实例化场景类
scene = Updaters()
# 执行渲染流程(包含文件生成和预览)
scene.render()

@ -0,0 +1,23 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- This file was generated by dvisvgm 3.1.1 -->
<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='37.171687pt' height='19.99404pt' viewBox='153.867455 -19.994055 37.171687 19.99404'>
<defs>
<path id='g0-58' d='M1.912827-.52802C1.912827-.816936 1.673724-1.05604 1.384807-1.05604S.856787-.816936 .856787-.52802S1.09589 0 1.384807 0S1.912827-.239103 1.912827-.52802Z'/>
<path id='g1-48' d='M4.582814-3.188045C4.582814-3.985056 4.533001-4.782067 4.184309-5.519303C3.726027-6.475716 2.909091-6.635118 2.49066-6.635118C1.892902-6.635118 1.165629-6.37609 .757161-5.449564C.438356-4.762142 .388543-3.985056 .388543-3.188045C.388543-2.440847 .428394-1.544209 .836862-.787049C1.265255 .019925 1.992528 .219178 2.480697 .219178C3.01868 .219178 3.775841 .009963 4.214197-.936488C4.533001-1.62391 4.582814-2.400996 4.582814-3.188045ZM2.480697 0C2.092154 0 1.504359-.249066 1.325031-1.205479C1.215442-1.803238 1.215442-2.719801 1.215442-3.307597C1.215442-3.945205 1.215442-4.60274 1.295143-5.140722C1.484433-6.326276 2.231631-6.41594 2.480697-6.41594C2.809465-6.41594 3.466999-6.236613 3.656289-5.250311C3.755915-4.692403 3.755915-3.935243 3.755915-3.307597C3.755915-2.560399 3.755915-1.882939 3.646326-1.24533C3.496887-.298879 2.929016 0 2.480697 0Z'/>
<path id='g1-51' d='M2.889166-3.506849C3.706102-3.775841 4.283935-4.473225 4.283935-5.260274C4.283935-6.07721 3.407223-6.635118 2.450809-6.635118C1.444583-6.635118 .687422-6.03736 .687422-5.280199C.687422-4.951432 .9066-4.762142 1.195517-4.762142C1.504359-4.762142 1.703611-4.98132 1.703611-5.270237C1.703611-5.768369 1.235367-5.768369 1.085928-5.768369C1.39477-6.256538 2.052304-6.386052 2.410959-6.386052C2.819427-6.386052 3.367372-6.166874 3.367372-5.270237C3.367372-5.150685 3.347447-4.572852 3.088418-4.134496C2.789539-3.656289 2.450809-3.626401 2.201743-3.616438C2.122042-3.606476 1.882939-3.58655 1.8132-3.58655C1.733499-3.576588 1.663761-3.566625 1.663761-3.466999C1.663761-3.35741 1.733499-3.35741 1.902864-3.35741H2.34122C3.158157-3.35741 3.526775-2.67995 3.526775-1.703611C3.526775-.348692 2.839352-.059776 2.400996-.059776C1.972603-.059776 1.225405-.229141 .876712-.816936C1.225405-.767123 1.534247-.986301 1.534247-1.364882C1.534247-1.723537 1.265255-1.92279 .976339-1.92279C.737235-1.92279 .418431-1.783313 .418431-1.344956C.418431-.438356 1.344956 .219178 2.430884 .219178C3.646326 .219178 4.552927-.687422 4.552927-1.703611C4.552927-2.520548 3.92528-3.297634 2.889166-3.506849Z'/>
<path id='g1-52' d='M2.929016-1.643836V-.777086C2.929016-.418431 2.909091-.308842 2.171856-.308842H1.96264V0C2.371108-.029888 2.889166-.029888 3.307597-.029888S4.254047-.029888 4.662516 0V-.308842H4.4533C3.716065-.308842 3.696139-.418431 3.696139-.777086V-1.643836H4.692403V-1.952677H3.696139V-6.485679C3.696139-6.684932 3.696139-6.744707 3.536737-6.744707C3.447073-6.744707 3.417186-6.744707 3.337484-6.625156L.278954-1.952677V-1.643836H2.929016ZM2.988792-1.952677H.557908L2.988792-5.668742V-1.952677Z'/>
<path id='g1-53' d='M4.473225-2.002491C4.473225-3.188045 3.656289-4.184309 2.580324-4.184309C2.102117-4.184309 1.673724-4.024907 1.315068-3.676214V-5.618929C1.514321-5.559153 1.843088-5.489415 2.161893-5.489415C3.387298-5.489415 4.084682-6.396015 4.084682-6.525529C4.084682-6.585305 4.054795-6.635118 3.985056-6.635118C3.975093-6.635118 3.955168-6.635118 3.905355-6.60523C3.706102-6.515567 3.217933-6.316314 2.550436-6.316314C2.15193-6.316314 1.693649-6.386052 1.225405-6.595268C1.145704-6.625156 1.125778-6.625156 1.105853-6.625156C1.006227-6.625156 1.006227-6.545455 1.006227-6.386052V-3.437111C1.006227-3.257783 1.006227-3.178082 1.145704-3.178082C1.215442-3.178082 1.235367-3.20797 1.275218-3.267746C1.384807-3.427148 1.753425-3.965131 2.560399-3.965131C3.078456-3.965131 3.327522-3.506849 3.407223-3.327522C3.566625-2.958904 3.58655-2.570361 3.58655-2.072229C3.58655-1.723537 3.58655-1.125778 3.347447-.707347C3.108344-.318804 2.739726-.059776 2.281445-.059776C1.554172-.059776 .986301-.587796 .816936-1.175592C.846824-1.165629 .876712-1.155666 .986301-1.155666C1.315068-1.155666 1.484433-1.404732 1.484433-1.643836S1.315068-2.132005 .986301-2.132005C.846824-2.132005 .498132-2.062267 .498132-1.603985C.498132-.747198 1.185554 .219178 2.30137 .219178C3.457036 .219178 4.473225-.737235 4.473225-2.002491Z'/>
<path id='g1-55' d='M4.742217-6.067248C4.83188-6.1868 4.83188-6.206725 4.83188-6.41594H2.410959C1.195517-6.41594 1.175592-6.545455 1.135741-6.734745H.886675L.557908-4.682441H.806974C.836862-4.841843 .926526-5.469489 1.05604-5.589041C1.125778-5.648817 1.902864-5.648817 2.032379-5.648817H4.094645C3.985056-5.489415 3.198007-4.403487 2.978829-4.07472C2.082192-2.729763 1.753425-1.344956 1.753425-.328767C1.753425-.229141 1.753425 .219178 2.211706 .219178S2.669988-.229141 2.669988-.328767V-.836862C2.669988-1.384807 2.699875-1.932752 2.779577-2.470735C2.819427-2.699875 2.958904-3.556663 3.39726-4.174346L4.742217-6.067248Z'/>
<path id='g1-61' d='M6.844334-3.257783C6.993773-3.257783 7.183064-3.257783 7.183064-3.457036S6.993773-3.656289 6.854296-3.656289H.886675C.747198-3.656289 .557908-3.656289 .557908-3.457036S.747198-3.257783 .896638-3.257783H6.844334ZM6.854296-1.325031C6.993773-1.325031 7.183064-1.325031 7.183064-1.524284S6.993773-1.723537 6.844334-1.723537H.896638C.747198-1.723537 .557908-1.723537 .557908-1.524284S.747198-1.325031 .886675-1.325031H6.854296Z'/>
</defs>
<g id='page1'>
<use x='153.867455' y='-13.573687' xlink:href='#g1-51'/>
<rect x='153.867455' y='-9.523795' height='.398484' width='4.981335'/>
<use x='153.867455' y='-.000015' xlink:href='#g1-52'/>
<use x='162.811637' y='-6.833885' xlink:href='#g1-61'/>
<use x='173.327717' y='-6.833885' xlink:href='#g1-48'/>
<use x='178.309056' y='-6.833885' xlink:href='#g0-58'/>
<use x='181.076464' y='-6.833885' xlink:href='#g1-55'/>
<use x='186.057803' y='-6.833885' xlink:href='#g1-53'/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.8 KiB

@ -0,0 +1,9 @@
\documentclass[preview]{standalone}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\begin{align*}
\frac{3}{4} = 0.75
\end{align*}
\end{document}

@ -0,0 +1,6 @@
# This file is used internally by FFMPEG.
file 'file:D:/dsWork/QingLong/AI/Manim/custom_output/videos/L3_Updaters/480p15/partial_movie_files/Updaters/1185818338_2494747865_223132457.mp4'
file 'file:D:/dsWork/QingLong/AI/Manim/custom_output/videos/L3_Updaters/480p15/partial_movie_files/Updaters/624642324_1204481449_3735812780.mp4'
file 'file:D:/dsWork/QingLong/AI/Manim/custom_output/videos/L3_Updaters/480p15/partial_movie_files/Updaters/624642324_2195339541_1130898081.mp4'
file 'file:D:/dsWork/QingLong/AI/Manim/custom_output/videos/L3_Updaters/480p15/partial_movie_files/Updaters/624642324_667144672_2981073962.mp4'
file 'file:D:/dsWork/QingLong/AI/Manim/custom_output/videos/L3_Updaters/480p15/partial_movie_files/Updaters/624642324_2327811734_3529618872.mp4'
Loading…
Cancel
Save