if __name__ == "__main__":
    import gizeh
    import moviepy.editor as mpy

    from vectortween.BezierCurveAnimation import BezierCurveAnimation
    from vectortween.SequentialAnimation import SequentialAnimation

    import noise

    def random_color():
        import random
        return (random.uniform(0, 1) for _ in range(3))


    W, H = 250, 250  # width, height, in pixels
    duration = 5  # duration of the clip, in seconds
    fps = 25

    controlpoints_collections = [
        [(120, 160), (35, 200), (220, 240), (220, 40)],
        [(220, 40), (120, 40), (10, 200)]
    ]
    b1 = BezierCurveAnimation(controlpoints=controlpoints_collections[0],tween=["easeOutBounce"])
    b2 = BezierCurveAnimation(controlpoints=controlpoints_collections[1],tween=["easeOutBounce"])
    b = SequentialAnimation([b1,b2])

    colors = ((0,1,1),(1,1,0))

    def make_frame(t):
        surface = gizeh.Surface(W, H)

        xy = b.make_frame(t, 0, 0, duration - 1, duration)
        curve_points = b.curve_points(0, t, 0.01, 0, 0, duration - 1, duration)
        # print (curve_points)

        xnoise = []
        ynoise = []
        result = []
        for i,c in enumerate(curve_points):
            xnoise.append(2*noise.snoise3(c[0],c[1],0))
            ynoise.append(2*noise.snoise3(c[0],c[1],1))
            result.append([(c[0] + xnoise[i]), (c[1] + ynoise[i])])
            if xy is not None and None not in xy:
                gizeh.circle(5, xy=[xy[0]+xnoise[i],xy[1]+ynoise[i]], fill=(0, 1, 0)).draw(surface)
        curve_points = result
        gizeh.polyline(curve_points, stroke=(0, 0, 1), stroke_width=2).draw(surface)
        for i, controlpoints in enumerate(controlpoints_collections):
            gizeh.polyline(controlpoints, stroke=colors[i], stroke_width=2).draw(surface)
            for cp in controlpoints:
                gizeh.circle(5, xy=cp, fill=(1, 1, 1)).draw(surface)

        return surface.get_npimage()


    clip = mpy.VideoClip(make_frame, duration=duration)
    clip.write_videofile("example_bezier_noise.mp4", fps=fps, codec="libx264")

add a noisy bezier example (todo: should noise be part of the animation, or stay out of it?)