三次贝塞尔曲线¶
限定名称: manim.mobject.geometry.arc.CubicBezier
- class CubicBezier(start_anchor, start_handle, end_handle, end_anchor, **kwargs)[source]¶
基类:
VMobject
一条三次贝塞尔曲线。
示例
示例: BezierSplineExample ¶
from manim import * class BezierSplineExample(Scene): def construct(self): p1 = np.array([-3, 1, 0]) p1b = p1 + [1, 0, 0] d1 = Dot(point=p1).set_color(BLUE) l1 = Line(p1, p1b) p2 = np.array([3, -1, 0]) p2b = p2 - [1, 0, 0] d2 = Dot(point=p2).set_color(RED) l2 = Line(p2, p2b) bezier = CubicBezier(p1b, p1b + 3 * RIGHT, p2b - 3 * RIGHT, p2b) self.add(l1, d1, l2, d2, bezier)
class BezierSplineExample(Scene): def construct(self): p1 = np.array([-3, 1, 0]) p1b = p1 + [1, 0, 0] d1 = Dot(point=p1).set_color(BLUE) l1 = Line(p1, p1b) p2 = np.array([3, -1, 0]) p2b = p2 - [1, 0, 0] d2 = Dot(point=p2).set_color(RED) l2 = Line(p2, p2b) bezier = CubicBezier(p1b, p1b + 3 * RIGHT, p2b - 3 * RIGHT, p2b) self.add(l1, d1, l2, d2, bezier)
方法
属性
animate (动画)
用于动画化
self
的任何方法的应用。animation_overrides (动画覆盖)
颜色
depth (深度)
mobject 的深度。
fill_color (填充颜色)
如果存在多种颜色(用于渐变),则返回第一种颜色
height (高度)
mobject 的高度。
n_points_per_curve (每条曲线的点数)
sheen_factor (光泽因子)
stroke_color (描边颜色)
width (宽度)
mobject 的宽度。
- 参数:
start_anchor (Point3DLike)
start_handle (Point3DLike)
end_handle (Point3DLike)
end_anchor (Point3DLike)
kwargs (Any)
- _original__init__(start_anchor, start_handle, end_handle, end_anchor, **kwargs)¶
初始化自身。有关准确签名,请参阅 help(type(self))。
- 参数:
start_anchor (Point3DLike)
start_handle (Point3DLike)
end_handle (Point3DLike)
end_anchor (Point3DLike)
kwargs (Any)
- 返回类型:
无