本文整理汇总了Python中scene.Scene.reset_background方法的典型用法代码示例。如果您正苦于以下问题:Python Scene.reset_background方法的具体用法?Python Scene.reset_background怎么用?Python Scene.reset_background使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scene.Scene
的用法示例。
在下文中一共展示了Scene.reset_background方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: count_sections
# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import reset_background [as 别名]
def count_sections(*radians):
sc = Scene()
circle = Circle(density = CIRCLE_DENSITY).scale(RADIUS)
sc.add(circle)
points = [
(RADIUS * np.cos(angle), RADIUS * np.sin(angle), 0)
for angle in radians
]
dots = [Dot(point) for point in points]
interior = Region(lambda x, y : x**2 + y**2 < RADIUS**2)
for x in xrange(1, len(points)):
if x == 1:
sc.animate(ShowCreation(dots[0]), ShowCreation(dots[1]))
sc.add(dots[0], dots[1])
else:
sc.animate(ShowCreation(dots[x]))
sc.add(dots[x])
new_lines = Mobject(*[
Line(points[x], points[y]) for y in xrange(x)
])
sc.animate(Transform(deepcopy(dots[x]), new_lines, run_time = 2.0))
sc.add(new_lines)
sc.dither()
regions = plane_partition_from_points(*points[:x+1])
for reg in regions:
reg.intersect(interior)
regions = filter(lambda reg : reg.bool_grid.any(), regions)
last_num = None
for reg, count in zip(regions, it.count(1)):
number = TexMobject(str(count)).shift((RADIUS, 3, 0))
sc.highlight_region(reg)
rt = 1.0 / (x**0.8)
sc.add(number)
sc.remove(last_num)
last_num = number
sc.dither(rt)
sc.reset_background()
sc.remove(last_num)
sc.animate(Transform(last_num, deepcopy(last_num).center()))
sc.dither()
sc.remove(last_num)
return sc