def simple_lines(): C = Canvas(**canvas_args) tc = 0.08 # An example of the functional interface Artist(Canvas) for i in np.arange(-4, 5, 0.5): C += line(x=-4, y=i, x1=4, y1=i, thickness=tc, color=[20] * 3) C += line(x=i, y=4, x1=i, y1=-4, thickness=tc, color=[20] * 3) for i in np.arange(-4, 5, 1): C += line(x=-4, y=i, x1=4, y1=i, thickness=tc, color=[100, int(100 + i * 10), 100]) C += line(x=i, y=4, x1=i, y1=-4, thickness=tc, color=[100, 100, int(100 + i * 10)]) C += line(-4, 0, 4, 0, thickness=0.10) C += line(0, 4, 0, -4, thickness=0.10) return C
def timer(): A = Animation(**animation_args) tc = 0.315 r = 3.0 lag = 0.1 for k in range(20): theta = motion.offsetEase(lag, stop=2 * np.pi, duration=len(A))() A += line( x1=r * np.cos(theta), y1=r * np.sin(theta), thickness=tc, color="indigo", mode="add", ) r *= 0.98 lag *= 1.17 return A
def line_test(self): C = Canvas() C += line() assert_true(C._img.sum() > 0)
def glow_test(self): line = ph.line() self.target += ph.filters.glow(line) # Test w/effect off too self.target += ph.filters.glow(line, n=0)
import numpy as np import pixelhouse as ph # A = ph.Canvas(width=300, height=300) # A = ph.Animation(width=300, height=300, fps=25) A = ph.Animation(width=300, height=300) # Draw grid lines dx = 4 for i in np.arange(-dx, dx, 0.5): A += ph.line(i, -dx, i, dx, thickness=0) A += ph.line(-dx, i, dx, i, thickness=0) z = ph.motion.easeInOutQuad(2, -2) x = ph.motion.easeInOutQuad(2, -2) A += ph.transform.pull(x, 0.25, alpha=z, mode="constant") A.show()
def line_test(self): self.canvas += ph.line()
x=0, y=0.5, font="TitilliumWeb-Black.ttf", vpos="center", font_size=2.50, ) dist = erosion_distance(C, kernel_size=3, decay=0.8, depth_iterations=20).tolist() C = ph.Animation(w, h, bg=pal[-1]) n, tc = 40, 0.020 lg = ph.gradient.linear([pal[0], pal[1]]) for y in np.linspace(1.25 * C.ymin, 1.25 * C.ymax, n): C += ph.line(C.xmin, y, C.xmax, y, thickness=tc, gradient=lg) C += ph.filters.gaussian_blur(0.10, 0.10) for y in np.linspace(1.25 * C.ymin, 1.25 * C.ymax, n): C += ph.line(C.xmin, y, C.xmax, y, thickness=tc, gradient=lg) z = ph.motion.easeInQuad(0, 0.030, flip=True) C += rise(dist, amplitude=z) X = C.render(len(C) // 2) X += ph.transform.scale(1.0 / scale, 1.0 / scale) X += ph.filters.gaussian_blur(0.50, 0) X.save("figures/resist.png") X.show()