VMobject¶
VMobject
是
Mobject
的子类,使用贝塞尔曲线来表示物体
VMobject¶
-
class
manimlib.mobject.types.vectorized_mobject.
VMobject
(**kwargs)¶ -
add_cubic_bezier_curve
(anchor1, handle1, handle2, anchor2)¶ 根据锚点和控制点添加一条贝塞尔曲线
-
add_cubic_bezier_curve_to
(handle1, handle2, anchor)¶ 添加一条贝塞尔曲线到
-
add_line_to
(point)¶ 添加一条直线到
point
-
add_points_as_corners
(points)¶ 添加一系列作为拐角的点
-
add_smooth_curve_to
(*points)¶ 添加一条平滑曲线到
如果输入了两个点,第一个点作为控制点,第二个点作为锚点
-
add_subpath
(points)¶ 添加一条子路径
-
append_points
(new_points)¶ 添加新点集
-
append_vectorized_mobject
(vectorized_mobject)¶ 把一个vmobject中的所有点添加到当前点中
-
apply_function
(function)¶ 施加function作用
-
change_anchor_mode
(mode)¶ 根据锚点设置为平滑(smooth)或不平滑(jagged)
-
fade
(darkness=0.5, family=True)¶ 变暗,程度为
darkness
(相对值)
-
generate_rgbas_array
(color, opacity)¶ 均可以是单个值或元组/列表,当有多个时,则沿
sheen_direction
方向简便
-
get_anchors_and_handles
()¶ returns anchors1, handles1, handles2, anchors2, where (anchors1[i], handles1[i], handles2[i], anchors2[i]) will be four points defining a cubic bezier curve for any i in range(0, len(anchors1))
-
get_cubic_bezier_tuples
()¶ 获取每组贝塞尔曲线的点集
-
get_nth_curve_function
(n)¶ 获取第n条贝塞尔曲线的函数
-
get_nth_curve_points
(n)¶ 获取第n条贝塞尔曲线
-
get_num_curves
()¶ 获取供几条贝塞尔曲线
-
get_style
()¶ 获取全部样式
-
get_subcurve
(a, b)¶ 返回[a,b]之间的部分(曲线)
-
get_subpaths
()¶ 获取所有子路径
-
init_colors
()¶ 初始化样式,VMobject的样式有以下
fill
填充样式颜色:
fill_color
或color
不透明度:
fill_opacity
stroke
线条样式颜色:
stroke_color
或color
宽度:
stroke_width
不透明度:
stroke_opacity
background_stroke
背景线条样式颜色:
background_stroke_color
或color
宽度:
background_stroke_width
不透明度:
background_stroke_opacity
sheen
光泽样式光泽尺度:
sheen_factor
光泽方向:
sheen_direction
-
insert_n_curves
(n)¶ 插入n条曲线
-
interpolate_color
(mobject1, mobject2, alpha)¶ 在mobject1和mobject2的样式之间插值
-
is_closed
()¶ 判断是否闭合
-
match_style
(vmobject, family=True)¶ 和
vmobject
匹配样式
-
point_from_proportion
(alpha)¶ 在整条路径上占比为alpha处的点
-
pointwise_become_partial
(vmobject, a, b)¶ 把vmobject的[a,b]部分作为自己的全部(ab为0~1之间的数)
-
scale_handle_to_anchor_distances
(factor)¶ If the distance between a given handle point H and its associated anchor point A is d, then it changes H to be a distances factor*d away from A, but so that the line from A to H doesn’t change. This is mostly useful in the context of applying a (differentiable) function, to preserve tangency properties. One would pull all the handles closer to their anchors, apply the function then push them out again.
-
set_anchors_and_handles
(anchors1, handles1, handles2, anchors2)¶ 设置锚点和控制点
-
set_background_stroke
(**kwargs)¶ 设置
background_stroke
样式
-
set_color
(color, family=True)¶ 设置
fill
和stroke
的颜色
-
set_fill
(color=None, opacity=None, family=True)¶ 设置
fill
样式
-
set_opacity
(opacity, family=True)¶ 设置
fill
、stroke
和background_stroke
的不透明度
-
set_points_as_corners
(points)¶ 设置一系列点作为折线拐点
-
set_points_smoothly
(points)¶ 添加一系列点,并平滑处理
-
set_shade_in_3d
(value=True, z_index_as_group=False)¶ 设置在3D下的效果
-
set_sheen
(factor, direction=None, family=True)¶ 设置
sheen
样式
-
set_sheen_direction
(direction, family=True)¶ 设置光泽方向
sheen_direction
-
set_stroke
(color=None, width=None, opacity=None, background=False, family=True)¶ 设置
stroke
样式
-
set_style
(fill_color=None, fill_opacity=None, stroke_color=None, stroke_width=None, stroke_opacity=None, background_stroke_color=None, background_stroke_width=None, background_stroke_opacity=None, sheen_factor=None, sheen_direction=None, background_image_file=None, family=True)¶ 允许设置全部样式
-
VGroup¶
-
class
manimlib.mobject.types.vectorized_mobject.
VGroup
(*vmobjects, **kwargs)¶ 和
VMobject
相同,主要用作包含一些子物体(必须都是VMobject)