示例#1
0
def main():
  from modules.render import Animate
  from modules.walkers import BadWalkers as Walkers
  from time import sleep

  walkers = []

  # for i in range(10):
  for i in range(1):
    w = Walkers(
        SIZE,
        EDGE,
        SCALE,
        NUM
        ).run2()
    walkers.append(w)

  def wrap(render):
    render.clear_canvas()
    for k, w in enumerate(walkers):
      dots = next(w)
      render.path(dots)
    sleep(0.1)
    return True

  render = Animate(SIZE, BACK, FRONT, wrap)
  render.set_line_width(3*ONE)
  render.start()
示例#2
0
def main():
    from modules.boids import B
    from modules.render import Animate

    b = B(INIT_NUM, SIZE, STP)

    def wrap(render):
        render.clear_canvas()
        b.step(separation=SEPARATION, cohesion=COHESION, alignment=ALIGNMENT)
        for xy in b.xy:
            render.circle(xy[0], xy[1], 2. * ONE, fill=True)

        return True

    render = Animate(SIZE, BACK, FRONT, wrap)

    render.set_line_width(ONE)
    render.start()
示例#3
0
文件: 5.py 项目: inconvergent/talks
def main():
    from modules.render import Animate
    from modules.walkers import Walkers

    walkers = []

    for i in range(1):
        w = Walkers(SIZE, EDGE, SCALE, NUM).run2()
        walkers.append(w)

    def wrap(render):
        for k, w in enumerate(walkers):
            dots = next(w)
            render.path(dots)
        return True

    render = Animate(SIZE, BACK, FRONT, wrap)
    render.set_line_width(ONE)
    render.start()