def scale_example(): s1 = shapes.star_outline(100, 100, 4) transforms.offset(s1, (300, 0)) transforms.rotate(s1, -math.pi / 4) s2 = shapes.star_outline(100, 100, 6) transforms.offset(s2, (300, 0)) transforms.rotate(s2, -math.pi / 2) s3 = shapes.star_outline(100, 100, 9) transforms.offset(s3, (300, 0)) transforms.rotate(s3, -math.pi * 3 / 4) tl = TransformLock([s1, s2], ["scale"]) start = Group([tl, s3]) mid = copy.deepcopy(start) end = copy.deepcopy(start) formatters.Pen(3)(start) formatters.Pen(2)(mid) formatters.Pen(1)(end) transforms.scale(mid, 2) transforms.scale(end, 3) o = shapes.circle(100) return Group([start, mid, end, o])
def rotation_example(): r1 = shapes.rectangle(100, 100) r2 = shapes.rectangle(200, 200) transforms.offset(r2, (400, 0)) r3 = shapes.rectangle(300, 300) transforms.offset(r3, (800, 0)) tl = TransformLock([r1, r2], ["rotate"]) start = Group([tl, r3]) transforms.offset(start, (500, 0)) mid = copy.deepcopy(start) end = copy.deepcopy(start) formatters.Pen(3)(start) formatters.Pen(2)(mid) formatters.Pen(1)(end) transforms.rotate(mid, math.pi / 6, (0, 0)) transforms.rotate(end, math.pi / 3, (0, 0)) o = shapes.circle(100) return Group([start, mid, end, o])