示例#1
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


#########################################################################

if __name__ == "__main__":

    simple_lines().save("figures/simple_lines.png")
    simple_circles().save("figures/simple_circles.png")
    simple_rectangles().save("figures/simple_rectangle.png")

    canvas2gif(rotating_circles(), "figures/moving_circles.gif", **gif_args)
    canvas2gif(pacman(), "figures/pacman.gif", **gif_args)
    canvas2gif(checkerboard(), "figures/checkerboard.gif", **gif_args)
    canvas2gif(timer(), "figures/timer.gif", **gif_args)

    teyleen_982().save("figures/teyleen_982.png")
    teyleen_116().save("figures/teyleen_116.png")
示例#2
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


#########################################################################

if __name__ == "__main__":

    simple_lines().save("simple_lines.png")
    simple_circles().save("simple_circles.png")
    simple_rectangles().save("simple_rectangle.png")

    canvas2gif(rotating_circles(), "moving_circles.gif", **gif_args)
    canvas2gif(pacman(), "pacman.gif", **gif_args)
    canvas2gif(checkerboard(), "checkerboard.gif", **gif_args)
    canvas2gif(timer(), "timer.gif", **gif_args)

    teyleen_982().save("teyleen_982.png")
    teyleen_116().save("teyleen_116.png")
示例#3
0
pal = ph.palette(8)
f_font = "../pixelhouse/fonts/Montserrat-Medium.otf"

C = ph.Canvas(500, 100, bg=pal[2])
C = ph.Animation(500, 100, bg=pal[2])  #, fps=10)
lg = ph.linear_gradient(pal[0], pal[1])

C += ph.text("pixelhouse", font_size=0.78, font=f_font, color='w')
C += ph.text("pixelhouse", font_size=0.75, font=f_font, gradient=lg)

#a = 0.01
a = ph.motion.easeReturn("easeInOutQuad", 0, 0.06, len(C))

z = np.linspace(2 * np.pi, 0)
C += el.wave(amplitude=3 * a, wavelength=1.5, offset=z)

z = np.linspace(0, 2 * np.pi)
C += el.wave(amplitude=a, wavelength=0.3, offset=z)

z = np.linspace(0, 2 * np.pi)
C += el.wave(amplitude=a / 2, wavelength=0.3 / 7, offset=z + .2)

ph.canvas2gif(C,
              "wave_effect.gif",
              duration=0.1,
              palettesize=32,
              gifsicle=True)

C.show()
示例#4
0
import numpy as np
import pixelhouse as ph


def logo_animation(logo_text):
    pal = ph.palette(3)

    A = ph.Animation(fps=24, duration=1.5, width=800, height=800, bg=pal[2])

    lg = ph.gradient.linear([pal[0], pal[1]], theta=-np.pi / 4)

    A += ph.circle(color=pal[3])
    A += ph.filters.gaussian_blur()
    A += ph.circle(color=pal[3])

    y = ph.motion.easeInOutQuad(0, 1, flip=True)

    for i in np.arange(-6, 6, 1.0):
        A += ph.text(logo_text, y=i * y, gradient=lg, font_size=1.0)

    return A


if __name__ == '__main__':
    logo_text = "pixelhouse"
    save_name = "figures/logo_pixelhouse_animated.gif"
    ph.canvas2gif(logo_animation(logo_text), save_name, gifsicle=True)