本文整理汇总了Python中mobject.vectorized_mobject.VMobject.rotate_in_place方法的典型用法代码示例。如果您正苦于以下问题:Python VMobject.rotate_in_place方法的具体用法?Python VMobject.rotate_in_place怎么用?Python VMobject.rotate_in_place使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mobject.vectorized_mobject.VMobject
的用法示例。
在下文中一共展示了VMobject.rotate_in_place方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: physics_conception
# 需要导入模块: from mobject.vectorized_mobject import VMobject [as 别名]
# 或者: from mobject.vectorized_mobject.VMobject import rotate_in_place [as 别名]
def physics_conception(self, creatures, original_vector):
self.fade_all_but(creatures, 0)
physy, compy, mathy = creatures
vector = Vector(2*RIGHT)
vector.next_to(physy, UP+RIGHT)
brace = Brace(vector, DOWN)
length = TextMobject("Length")
length.next_to(brace, DOWN)
group = VMobject(vector, brace, length)
group.rotate_in_place(np.pi/6)
vector.get_center = lambda : vector.get_start()
direction = TextMobject("Direction")
direction.next_to(vector, RIGHT)
direction.shift(UP)
two_dimensional = TextMobject("Two-dimensional")
three_dimensional = TextMobject("Three-dimensional")
two_dimensional.to_corner(UP+RIGHT)
three_dimensional.to_corner(UP+RIGHT)
random_vectors = VMobject(*[
Vector(
random.uniform(-2, 2)*RIGHT + \
random.uniform(-2, 2)*UP
).shift(
random.uniform(0, 4)*RIGHT + \
random.uniform(-1, 2)*UP
).highlight(random_color())
for x in range(5)
])
self.play(
Transform(original_vector, vector),
ApplyMethod(physy.change_mode, "speaking")
)
self.remove(original_vector)
self.add(vector )
self.dither()
self.play(
GrowFromCenter(brace),
Write(length),
run_time = 1
)
self.dither()
self.remove(brace, length)
self.play(
Rotate(vector, np.pi/3, in_place = True),
Write(direction),
run_time = 1
)
for angle in -2*np.pi/3, np.pi/3:
self.play(Rotate(
vector, angle,
in_place = True,
run_time = 1
))
self.play(ApplyMethod(physy.change_mode, "plain"))
self.remove(direction)
for point in 2*UP, 4*RIGHT, ORIGIN:
self.play(ApplyMethod(vector.move_to, point))
self.dither()
self.play(
Write(two_dimensional),
ApplyMethod(physy.change_mode, "pondering"),
ShowCreation(random_vectors, submobject_mode = "lagged_start"),
run_time = 1
)
self.dither(2)
self.remove(random_vectors, vector)
self.play(Transform(two_dimensional, three_dimensional))
self.dither(5)
self.remove(two_dimensional)
self.restore_creatures(creatures)