def test_color(self): init(face_color="#123456", background_color="#aaaaaa") circle(0.5) with transform(x=1, alpha=1, hue=10): circle(0.5) with transform(x=1, y=1, scale=0.6, alpha=-0.3, hue=0): circle(0.5) with transform(x=-1, y=1, scale=0.6, alpha=0.7, hue=10, saturation=-1, lightness=1): circle(0.5) with transform(x=-1, y=-1, scale=0.6, alpha=0.7, hue=-10, saturation=-1, lightness=-1): circle(0.5) write_to_png("/tmp/color.png")
def PIC(): with cf.transform(lightness=1, hue=45, saturation=0.99, alpha=-0.5): cf.box() with cf.transform(x=1.1, lightness=1, hue=55, saturation=0.99, alpha=-0.6): cf.box() with cf.transform(y=1.1, lightness=1, hue=40, saturation=1, alpha=-0.6): cf.box() with cf.transform(x=1.1, y=1.1, lightness=1, hue=50, saturation=0.9, alpha=-0.7): cf.box()
def test_loop(self): init(background_color="#000000", face_color="#880000") with transform(x=1.2, saturation=0.1, lightness=-0.2, hue=10) as t: for i in range(12): box() t() write_to_png("/tmp/loop.png")
def test_rotate(self): init() with transform(angle=0.1): box(0.5) write_to_png("/tmp/rotate.png") a = get_npimage() self.assertIsInstance(a, np.ndarray)
def PICS(): PIC() with cf.transform(y=1.1, angle=180, lightness=0.2, hue=-0.1, saturation=-0.39): PICS()
def dot(): with transform(y=0.1): dot()
def line(): # {300 * [r .1 x 2] dot {} } for i in range(300): with transform(angle=i * 0.1, x=2 * i): dot()
def branch(): with transform(angle=30): branch()
def trunk(): with transform(scale=0.5, hue=0.001): branch()
def PICS(): PIC() with cf.transform(x=1.1, hue=0.41): PICS()
def gr(): with transform(x=-1): gr()
def dot(): with transform(angle=90, hue=0.01): branch()
def PICS(): PIC() with cf.transform(x=1.1, angle=-90, hue=0.3, saturation=-0.02): PICS()
def PICS(): PIC() with cf.transform(y=1.1, hue=-0.02): PICS()
def PICS(): PIC() with cf.transform(y=1.1, angle=-90, hue=-0.19): PICS()
def PICS(): PIC() with cf.transform(y=1.1, angle=90, hue=-0.3, saturation=0.03): PICS()
def PICS(): PIC() with cf.transform(y=-1.1, hue=220): PICS()
def dot(): with transform(angle=90): trail() trail()
def dot(): with transform(angle=90): line() # {r 90 h 0 } }
def PICS(): PIC() with cf.transform(x=1.1, angle=90, hue=0.4): PICS()
def trail(): # { 200 * [y 2 a -0.02] grain {a -.1} } for i in range(200): with transform(y=2 * i, alpha=-0.5 ** i): grain()
def element(): circle(1) with transform(x=1, scale=0.2): element()
def mycircle(): circle() with transform(x=1, scale=0.5): mycircle()
def PICS(): PIC() with cf.transform(x=1.1, angle=180, hue=0.6, alpha=0.1): PICS()