需要优化的网站有哪些,设计装修app,jsp类型网站托管费用,西安加盟代理网站建设Dot#xff1a;指代点对象或者表示点的符号。Arrow#xff1a;指代箭头对象#xff0c;包括直线上的箭头或者向量箭头等。NumberPlane#xff1a;指代数轴平面对象#xff0c;在Manim中用来创建包含坐标轴的数学坐标系平面。Text#xff1a;指代文本对象#xff0c;用来…Dot指代点对象或者表示点的符号。Arrow指代箭头对象包括直线上的箭头或者向量箭头等。NumberPlane指代数轴平面对象在Manim中用来创建包含坐标轴的数学坐标系平面。Text指代文本对象用来显示文字信息。 1.Dot对象的使用。
class Dot(pointarray([0., 0., 0.]), radius0.08,
stroke_width0, fill_opacity1.0,colorManimColor(#FFFFFF), **kwargs)
pointPoint3D- 点的位置。radiusfloat- 点的半径。stroke_widthfloat- 点边缘的厚度。fill_opacityfloat- 点的填充颜色的不透明度。colorParsableManimColor- 点的颜色。kwargs - 要传递给圆形对象的其他参数。
所以我们现在用两种方式进行编写代码
from manim import *class DotExample01(Scene):def construct(self):#背景颜色的调试self.camera.background_color #ece6e2dot1 Dot(pointLEFT, radius0.08)dot2 Dot(pointORIGIN)dot3 Dot(pointRIGHT)dot4Dot(point([0, 2, 0]), radius0.1, stroke_width0, fill_opacity1.0, colorManimColor(red))dot5Dot(point([0, -2, 0]), radius0.1, stroke_width0, fill_opacity1.0, colorManimColor(red))self.add(dot1,dot2,dot3,dot4,dot5) 运行结果如下 2.Arrow对象的使用
class Arrow(*args, stroke_width6, buff0.25,max_tip_length_to_length_ratio0.25,max_stroke_width_to_length_ratio5, **kwargs)
参数
args – 要传递给Line的参数。stroke_widthfloat– 箭头的粗细。受max_stroke_width_to_length_ratio影响。bufffloat– 箭头从起点和终点的距离。max_tip_length_to_length_ratiofloat– tip_length与箭头长度成比例。增加此比率会提高tip_length的最大值。max_stroke_width_to_length_ratiofloat– stroke_width与箭头长度成比例。增加此比率会使stroke_width的最大值提高。kwargs – 要传递给Line的其他参数。 接下来我们实际使用一下代码
from manim import *# 定义ArrowExample类用于展示箭头的不同效果
class ArrowExample(Scene):# 构建场景def construct(self):# 创建箭头对象arrow_1 Arrow(startRIGHT, endLEFT, colorGOLD)arrow_2 Arrow(startRIGHT, endLEFT, colorGOLD, tip_shapeArrowSquareTip(), buff0.2).shift(DOWN)# 将箭头对象放入Group中g1 Group(arrow_1, arrow_2)# 创建正方形对象和箭头对象square Square()arrow_3 Arrow(startLEFT, endRIGHT)arrow_4 Arrow(startLEFT, endRIGHT, buff0)# 将正方形对象和箭头对象放入Group中g2 Group(square, arrow_3, arrow_4)# 创建箭头对象arrow_5 Arrow(ORIGIN, config.top).shift(LEFT * 4)arrow_6 Arrow(UP config.top, config.top).shift(LEFT * 3)# 将箭头对象放入Group中g3 Group(arrow_5, arrow_6)# 将所有Group对象放入另一个Group中并排列group_all Group(g1, g2, g3).arrange(buff2)# 将整个Group对象添加到场景中展示self.add(group_all)
结果如下 3.NumberPlane对象的使用
class NumberPlane(x_range(-7.111111111111111, 7.111111111111111, 1),
y_range(-4.0, 4.0, 1), x_lengthNone, y_lengthNone,
background_line_styleNone, faded_line_styleNone,
faded_line_ratio1, make_smooth_after_applying_functionsTrue, **kwargs)
参数:
x_range (Sequence[float] | None)水平方向平面上的[x_min、x_max、x_step]值。y_range (Sequence[float] | None)垂直方向平面上的[y_min、y_max、y_step]值。x_length (float | None)平面的宽度。y_length (float | None)平面的高度。background_line_style (dict[str, Any] | None)影响平面背景线构造的参数。faded_line_style (dict[str, Any] | None)类似于background_line_style影响场景背景线的构造。faded_line_ratio (int)确定背景线中的方块数2 4个方块3 9个方块。make_smooth_after_applying_functions (bool)目前无效。kwargs (dict[str, Any])要传递给Axes的其他参数。
接下来实际操作 from manim import *
class NumberPlaneExample(Scene):def construct(self):#背景颜色的调试self.camera.background_color WHITE#调试网格线的颜色宽带和透明度number_plane NumberPlane(background_line_style{stroke_color: RED,stroke_width:2,stroke_opacity: 1})self.add(number_plane)
结果如下 再试一下
from manim import *
class NumberPlaneExample(Scene):def construct(self):#背景颜色的调试self.camera.background_color WHITE#调试网格线的颜色宽带和透明度number_planeNumberPlane(x_range(-7.111111111111111, 7.111111111111111, 1), y_range(-4.0, 4.0, 1), x_lengthNone, y_lengthNone, background_line_styleNone, faded_line_styleNone, faded_line_ratio1, make_smooth_after_applying_functionsTrue)self.add(number_plane)运行结果如下