def animate(canvas, fn, delay=<NUM_LIT:1.>/<NUM_LIT>, *args, **kwargs):
<EOL>if not IS_PY3:<EOL><INDENT>import locale<EOL>locale.setlocale(locale.LC_ALL, "<STR_LIT>")<EOL><DEDENT>def animation(stdscr):<EOL><INDENT>for frame in fn(*args, **kwargs):<EOL><INDENT>for x,y in frame:<EOL><INDENT>canvas.set(x,y)<EOL><DEDENT>f = canvas.frame()<EOL>stdscr.addstr(<NUM_LIT:0>, <NUM_LIT:0>, '<STR_LIT>'.format(f))<EOL>stdscr.refresh()<EOL>if delay:<EOL><INDENT>sleep(delay)<EOL><DEDENT>canvas.clear()<EOL><DEDENT><DEDENT>curses.wrapper(animation)<EOL>
Animation automation function

    :param canvas: :class:`Canvas` object
    :param fn: Callable. Frame coord generator
    :param delay: Float. Delay between frames.
    :param *args, **kwargs: optional fn parameters