Exemplo n.º 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()
def main():

  from modules.render import Animate
  from modules.tree import Tree
  import gtk

  tree = Tree(
    MID,
    0.95,
    INIT_BRANCH,
    -pi*0.5,
    ONE,
    ONE,
    BRANCH_SPLIT_ANGLE,
    BRANCH_PROB_SCALE,
    BRANCH_DIMINISH,
    BRANCH_SPLIT_DIMINISH,
    BRANCH_ANGLE_MAX,
    BRANCH_ANGLE_EXP
  )

  def wrap(steps_itt,render):

    global i

    tree.step()
    map(render.branch2,tree.Q)

    if tree.Q:
      render.sur.write_to_png('{:05d}.png'.format(i))
      i += 1
      return True
    else:
      #tree.init()
      #render.clear_canvas()
      return False


  render = Animate(
    SIZE,
    FRONT,
    BACK,
    TRUNK,
    TRUNK_STROKE,
    GRAINS,
    STEPS_ITT, wrap
  )
  render.ctx.set_source_rgba(*FRONT)
  render.ctx.set_line_width(ONE)

  gtk.main()
Exemplo n.º 3
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()
Exemplo n.º 4
0
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()