本文整理汇总了Python中mobject.Mobject.interpolate方法的典型用法代码示例。如果您正苦于以下问题:Python Mobject.interpolate方法的具体用法?Python Mobject.interpolate怎么用?Python Mobject.interpolate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mobject.Mobject
的用法示例。
在下文中一共展示了Mobject.interpolate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: construct
# 需要导入模块: from mobject import Mobject [as 别名]
# 或者: from mobject.Mobject import interpolate [as 别名]
def construct(self):
digest_config(self, {})
## Usually shouldn't need this...
self.frame_duration = self.DEFAULT_CONFIG["frame_duration"]
##
digest_config(self, {})
circle = Circle(
density = self.circle_density,
color = self.circle_blue
)
circle.repeat(self.circle_repeats)
circle.scale(self.radius)
sphere = Sphere(
density = self.sphere_density,
color = self.sphere_blue
)
sphere.scale(self.radius)
sphere.rotate(-np.pi / 7, [1, 0, 0])
sphere.rotate(-np.pi / 7)
iris = Mobject()
iris.interpolate(
circle, sphere,
self.interpolation_factor
)
for mob, color in [(iris, self.sphere_brown), (circle, self.circle_brown)]:
mob.highlight(color, lambda (x, y, z) : x < 0 and y > 0)
mob.highlight(
"black",
lambda point: np.linalg.norm(point) < \
self.inner_radius_ratio*self.radius
)
name = TextMobject("3Blue1Brown").center()
name.highlight("grey")
name.shift(2*DOWN)
self.play(Transform(
circle, iris,
run_time = self.run_time
))
self.frames = drag_pixels(self.frames)
self.save_image(IMAGE_DIR)
self.show_frame()
self.add(name)
self.dither()
print "Dragging pixels..."