def rotating_circles(): A = Animation(**animation_args) x = motion.easeInOutQuad(-1, 1, flip=True) A(circle(x, 1, r=2.5, color=[0, 250, 150], mode="add")) A(circle(-x, -1, r=2.5, color=[255, 5, 100], mode="add")) return A
def checkerboard(): A = Animation(**animation_args) z = motion.easeInOutQuad(0, 1, True) r = 0.40 c = [150, 250, 0] coord = [-2, 0, 2] args = {"r": r, "color": c, "mode": "add"} for dx, dy in itertools.product(coord, repeat=2): A += circle(z + dx, z + dy, **args) A += circle(z + dx, -z + dy, **args) A += circle(-z + dx, -z + dy, **args) A += circle(-z + dx, z + dy, **args) A += circle(dx, z + dy, **args) A += circle(z + dx, dy, **args) A += circle(dx, -z + dy, **args) A += circle(-z + dx, dy, **args) return A
# A working file to test various aspects of the module import numpy as np from pixelhouse import Canvas, Animation from pixelhouse import circle, motion, rectangle, line, ellipse from pixelhouse.transform import translate, rotate from pixelhouse.transform import distort, pull, motion_lines # A = Canvas(width=300, height=300) A = Animation(width=400, height=400, fps=2) A += circle(r=0.5, color="darkorange") A += circle(r=0.4, color="w", mode="direct") z = motion.easeInOutQuad(0, 2 * np.pi, len(A))() A += motion_lines(0.2, theta=z) A += motion_lines(0.2) A += rotate(z) A.show()
# A working file to test various aspects of the module import numpy as np from pixelhouse import Canvas, Animation from pixelhouse import circle, motion, rectangle, line, ellipse from pixelhouse.transform.simple import translate, rotate from pixelhouse.transform.elastic import distort, pull # A = Canvas(width=300, height=300) # A = Animation(width=300, height=300, fps=25) A = Animation(width=300, height=300) # Draw grid lines dx = 4 for i in np.arange(-dx, dx, 0.5): A += line(i, -dx, i, dx, thickness=0) A += line(-dx, i, dx, i, thickness=0) z = motion.easeInOutQuad(1, -1, len(A))() x = motion.easeInOutQuad(1, -1, len(A))() A += pull(x, 0.25, alpha=z, mode="constant") A.show()