当前位置: 首页>>代码示例>>Python>>正文


Python Scene.dither方法代码示例

本文整理汇总了Python中scene.Scene.dither方法的典型用法代码示例。如果您正苦于以下问题:Python Scene.dither方法的具体用法?Python Scene.dither怎么用?Python Scene.dither使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scene.Scene的用法示例。


在下文中一共展示了Scene.dither方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: different_points

# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import dither [as 别名]
def different_points(radians1, radians2):
    sc = Scene()
    circle = Circle(density = CIRCLE_DENSITY).scale(RADIUS)
    sc.add(circle)
    points1, points2 = (
        [
            (RADIUS * np.cos(angle), RADIUS * np.sin(angle), 0)
            for angle in radians
        ]
        for radians in (radians1, radians2)
    )
    dots1, dots2 = (
        Mobject(*[Dot(point) for point in points])
        for points in (points1, points2)
    )
    lines1, lines2 = (
        [
            Line(point1, point2)
            for point1, point2 in it.combinations(points, 2)
        ]
        for points in (points1, points2)
    )
    sc.add(dots1, *lines1)
    sc.animate(
        Transform(dots1, dots2, run_time = 3),
        *[
            Transform(line1, line2, run_time = 3)
            for line1, line2 in zip(lines1, lines2)
        ]
    )
    sc.dither()
    return sc
开发者ID:astoeckley,项目名称:manim,代码行数:34,代码来源:moser_intro.py

示例2: summarize_pattern

# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import dither [as 别名]
def summarize_pattern(*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]
    last_num = None
    for x in xrange(len(points)):
        new_lines = Mobject(*[
            Line(points[x], points[y]) for y in xrange(x)
        ])
        num = TexMobject(str(moser_function(x + 1))).center()
        sc.animate(
            Transform(last_num, num) if last_num else ShowCreation(num),
            FadeIn(new_lines),
            FadeIn(dots[x]),
            run_time = 0.5,
        )
        sc.remove(last_num)
        last_num = num
        sc.add(num, dots[x], new_lines)
        sc.dither()
    return sc
开发者ID:astoeckley,项目名称:manim,代码行数:28,代码来源:moser_intro.py

示例3: interesting_problems

# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import dither [as 别名]
def interesting_problems():
    sc = Scene()
    locales = [(6, 2, 0), (6, -2, 0), (-5, -2, 0)]
    fermat = Mobject(*TexMobjects(["x^n","+","y^n","=","z^n"]))
    fermat.scale(0.5).shift((-2.5, 0.7, 0))
    face = SimpleFace()
    tb = ThoughtBubble().shift((-1.5, 1, 0))
    sb = SpeechBubble().shift((-2.4, 1.3, 0))
    fermat_copies, face_copies, tb_copies, sb_copies = (
        Mobject(*[
            deepcopy(mob).scale(0.5).shift(locale)
            for locale in locales
        ])
        for mob in [fermat, face, tb, sb]
    )

    sc.add(face, tb)
    sc.animate(ShowCreation(fermat, run_time = 1))
    sc.add(fermat)
    sc.dither()
    sc.animate(
        Transform(
            deepcopy(fermat).repeat(len(locales)),
            fermat_copies
        ),
        FadeIn(face_copies, run_time = 1.0)
    )
    sc.animate(FadeIn(tb_copies))
    sc.dither()
    sc.animate(
        Transform(tb, sb),
        Transform(tb_copies, sb_copies)
    )
    return sc
开发者ID:astoeckley,项目名称:manim,代码行数:36,代码来源:moser_intro.py

示例4: dither

# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import dither [as 别名]
 def dither(self, time = 1, blink = True):
     while time > 0:
         if blink and time%2 == 1:
             self.play(Blink(self.randy))
         else:
             Scene.dither(self, time)
         time -= 1
     return self
开发者ID:scottopell,项目名称:manim,代码行数:10,代码来源:characters.py

示例5: dither

# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import dither [as 别名]
 def dither(self, time = 1, blink = True):
     while time > 0:
         if blink and self.total_dither_time%2 == 1:
             self.play(Blink(self.pi_creature))
         else:
             Scene.dither(self, time)
         time -= 1
         self.total_dither_time += 1
     return self
开发者ID:aquafemi,项目名称:manim,代码行数:11,代码来源:characters.py

示例6: dither

# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import dither [as 别名]
 def dither(self, time = 1, blink = True):
     while time > 0:
         time_to_blink = self.total_dither_time%self.seconds_to_blink == 0
         if blink and self.any_pi_creatures_on_screen() and time_to_blink:
             self.blink()
         else:
             Scene.dither(self)
         time -= 1
         self.total_dither_time += 1
     return self
开发者ID:crclayton,项目名称:manim,代码行数:12,代码来源:characters.py

示例7: logo_to_circle

# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import dither [as 别名]
def logo_to_circle():
    from generate_logo import DARK_BROWN, LOGO_RADIUS
    sc = Scene()
    small_circle = Circle(
        density = CIRCLE_DENSITY,
        color = 'skyblue'
    ).scale(LOGO_RADIUS).highlight(
        DARK_BROWN, lambda (x, y, z) : x < 0 and y > 0
    )
    big_circle = Circle(density = CIRCLE_DENSITY).scale(RADIUS)
    sc.add(small_circle)
    sc.dither()`
    sc.animate(Transform(small_circle, big_circle))
    return sc
开发者ID:astoeckley,项目名称:manim,代码行数:16,代码来源:moser_intro.py

示例8: next_few_videos

# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import dither [as 别名]
def next_few_videos(*radians):
    sc = Scene()
    circle = Circle(density = CIRCLE_DENSITY).scale(RADIUS)
    points = [
        (RADIUS * np.cos(angle), RADIUS * np.sin(angle), 0)
        for angle in radians
    ]
    dots = Mobject(*[
        Dot(point) for point in points
    ])
    lines = Mobject(*[
        Line(point1, point2)
        for point1, point2 in it.combinations(points, 2)
    ])
    thumbnail = Mobject(circle, dots, lines)
    frame = VideoIcon().highlight(
        "black",
        lambda point : np.linalg.norm(point) < 0.5
    )
    big_frame = deepcopy(frame).scale(SPACE_WIDTH)
    frame.shift((-5, 0, 0))

    sc.add(thumbnail)
    sc.dither()
    sc.animate(
        Transform(big_frame, frame),
        Transform(
            thumbnail, 
            deepcopy(thumbnail).scale(0.15).shift((-5, 0, 0))
        )
    )
    sc.add(frame, thumbnail)
    sc.dither()
    last = frame
    for x in [-2, 1, 4]:
        vi = VideoIcon().shift((x, 0, 0))
        sc.animate(
            Transform(deepcopy(last), vi),
            Animation(thumbnail)#Keeps it from getting burried
        )
        sc.add(vi)
        last = vi
    return sc
开发者ID:astoeckley,项目名称:manim,代码行数:45,代码来源:moser_intro.py

示例9: response_invitation

# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import dither [as 别名]
def response_invitation():
    sc = Scene()
    video_icon = VideoIcon()
    mini_videos = Mobject(*[
        deepcopy(video_icon).scale(0.5).shift((3, y, 0))
        for y in [-2, 0, 2]
    ])
    comments = Mobject(*[
        Line((-1.2, y, 0), (1.2, y, 0), color = 'white')
        for y in [-1.5, -1.75, -2]
    ])

    sc.add(video_icon)
    sc.dither()
    sc.animate(Transform(deepcopy(video_icon).repeat(3), mini_videos))
    sc.add(mini_videos)
    sc.dither()
    sc.animate(ShowCreation(comments, run_time = 1.0))
    return sc
开发者ID:astoeckley,项目名称:manim,代码行数:21,代码来源:moser_intro.py

示例10: connect_points

# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import dither [as 别名]
def connect_points(*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]
    sc.add(*dots)
    anims = []
    all_lines = []
    for x in xrange(len(points)):
        lines = [Line(points[x], points[y]) for y in range(len(points))]
        lines = Mobject(*lines)
        anims.append(Transform(deepcopy(dots[x]), lines, run_time = 3.0))
        all_lines.append(lines)
    sc.animate(*anims)
    sc.add(*all_lines)
    sc.dither()
    return sc
开发者ID:astoeckley,项目名称:manim,代码行数:23,代码来源:moser_intro.py

示例11: count_sections

# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import dither [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
开发者ID:astoeckley,项目名称:manim,代码行数:45,代码来源:moser_intro.py

示例12: random_blink

# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import dither [as 别名]
 def random_blink(self, num_times = 1):
     for x in range(num_times):
         pi_creature = random.choice(self.get_everyone())
         self.play(Blink(pi_creature))
         Scene.dither(self)
开发者ID:aquafemi,项目名称:manim,代码行数:7,代码来源:characters.py


注:本文中的scene.Scene.dither方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。