Beispiel #1
0
def teyleen_982():
    C = Canvas(**canvas_args)
    pi = np.pi

    pal = [matplotlib_colors("lavender")] + ph.palette(96)
    tc = 0.025

    dx = pi / 8
    t0 = dx
    t1 = 2 * pi - dx
    r = 1.8

    for n in range(6):
        ellipse(
            a=r,
            b=r,
            rotation=pi / 2,
            angle_start=t0,
            angle_end=t1,
            color=pal[n],
            thickness=tc,
        )(C)

        dx *= 1.4
        t0 = dx
        t1 = 2 * pi - dx
        r -= 0.2

    return C
Beispiel #2
0
def pacman():
    args = animation_args.copy()
    args["duration"] = 0.5
    A = Animation(**args)

    pac_color = (253, 255, 0)

    # Chomping easing function
    dp = np.pi / 4

    n = len(A.timepoints)
    t0 = A.timepoints[:n // 2]
    t1 = A.timepoints[n // 2:]

    x0 = motion.easeOutQuad(0, dp)(t0)
    x1 = motion.easeInQuad(dp, 0)(t1)
    z = np.hstack([x0, x1])

    A += ellipse(a=2,
                 b=2,
                 angle_start=z,
                 angle_end=2 * np.pi - z,
                 color=pac_color)

    return A
Beispiel #3
0
def draw_circles(C, dx=0.25, tc=0.1):
    pal = ColorLoversPalette()(19)

    # Change the transparency on one of the colors
    pal[1][3] = 0

    base_r = 0.80

    r = base_r + dx
    lg = linear_gradient(pal[0], pal[1], theta=np.pi / 2)
    C += ellipse(0, 0, r, r, thickness=tc, gradient=lg)

    r = base_r - 2 * dx
    lg = linear_gradient(pal[0], pal[1], theta=-np.pi / 2)
    C += ellipse(0, 0, r, r, thickness=tc / 2, gradient=lg)

    r = base_r - dx
    lg = linear_gradient(pal[2], pal[1], theta=np.pi / 2)
    C += ellipse(0, 0, r, r, thickness=tc / 2, gradient=lg)

    r = base_r + 1.5 * dx
    lg = linear_gradient(pal[2], pal[1], theta=-np.pi / 2)
    C += ellipse(0, 0, r, r, thickness=tc / 2, gradient=lg)
Beispiel #4
0
def pacman():
    args = animation_args.copy()
    args["duration"] = 0.5
    A = Animation(**args)

    pac_color = (253, 255, 0)

    # Chomping easing function
    dp = np.pi / 4
    x0 = motion.easeOutQuad(0, dp, len(A) // 2)()
    x1 = motion.easeInQuad(dp, 0, len(A) // 2)()
    z = np.hstack([x0, x1])

    A += ellipse(a=1,
                 b=1,
                 angle_start=z,
                 angle_end=2 * np.pi - z,
                 color=pac_color)

    return A
Beispiel #5
0
 def ellipse_test(self):
     C = Canvas()
     C += ellipse()
     assert_true(C._img.sum() > 0)
Beispiel #6
0
 def ellipse_test(self):
     self.canvas += ph.ellipse()