# A working file to test various aspects of the module import numpy as np from pixelhouse import Canvas, Animation, circle, rectangle from pixelhouse.filter import gaussian_blur C = Canvas(width=400, height=400, bg="purple") with C.layer() as CX: CX += circle(x=0, color="w") for i in range(10): CX += gaussian_blur(blur_x=0.25) CX += circle(x=0, color="w") C += circle(x=0, y=2, r=0.7, color="r") C += circle(x=0, y=-2, r=0.7, color="k") C += circle(x=0, y=2, r=0.7, color="r") C.show()
# A working file to test various aspects of the module import numpy as np import pixelhouse as ph from pixelhouse import Canvas, Animation, polyline, circle, Artist from pixelhouse.transform import rotate, translate from pixelhouse.filter import gaussian_blur pal = ph.ColorLoversPalette()(4) C = Canvas(width=400, height=400, bg=pal[0]) C = Animation(width=400, height=400, bg=pal[0]) C += circle(x=1, y=-0.5, color=pal[1]) theta = np.linspace(0, 2 * np.pi) with C.layer() as CX: CX += polyline(color="k") CX += rotate(theta) CX += gaussian_blur(0.25, theta / 6) C += circle(x=-1, r=0.5) C.show()
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) C = Canvas().load("asphalt-dark-dawn-531321.jpg") C += instafilter("1977") with C.layer() as C2: draw_circles(C2) C2 += gaussian_blur() draw_circles(C2) C.save("blue_woods.png") C.show()