當前位置: 首頁>>代碼示例>>Python>>正文


Python fn.Fn方法代碼示例

本文整理匯總了Python中fn.Fn方法的典型用法代碼示例。如果您正苦於以下問題:Python fn.Fn方法的具體用法?Python fn.Fn怎麽用?Python fn.Fn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在fn的用法示例。


在下文中一共展示了fn.Fn方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: main

# 需要導入模塊: import fn [as 別名]
# 或者: from fn import Fn [as 別名]
def main():
  from sand import Sand
  from fn import Fn

  from iutils.ioOBJ import export_2d as export

  sand = Sand(SIZE)
  sand.set_bg(BACK)
  sand.set_rgba(FRONT)
  fn = Fn(prefix='./res/')

  vertices, lines = write(sand)
  name = fn.name()
  sand.write_to_png(name+'.png', GAMMA)

  export('glyphs', name + '.2obj', verts=vertices, lines=lines) 
開發者ID:inconvergent,項目名稱:sand-glyphs,代碼行數:18,代碼來源:main-export.py

示例2: main

# 需要導入模塊: import fn [as 別名]
# 或者: from fn import Fn [as 別名]
def main():
  import sys, traceback
  from fn import Fn
  from sand import Sand

  sand = Sand(SIZE)
  sand.set_bg(BG)
  sand.set_rgba(FRONT)

  fn = Fn(prefix='./res/', postfix='.png')
  si = spline_iterator()

  while True:
    try:
      itt, w, xy = next(si)
      sand.paint_dots(xy)
      if not itt%(SIZE):
        print(itt)
      #   sand.write_to_png(fn.name(), GAMMA)
    except Exception as e:
      print(e)
      sand.write_to_png(fn.name(), GAMMA)
      traceback.print_exc(file=sys.stdout)
      return 
開發者ID:inconvergent,項目名稱:sand-spline,代碼行數:26,代碼來源:main-vline.py

示例3: main

# 需要導入模塊: import fn [as 別名]
# 或者: from fn import Fn [as 別名]
def main():
  import sys, traceback
  from fn import Fn
  from sand import Sand

  sand = Sand(SIZE)
  sand.set_bg_from_rgb_array(img)
  sand.set_rgba(FRONT)

  fn = Fn(prefix='./res/', postfix='.png')
  si = spline_iterator()

  while True:
    try:
      itt, xy = next(si)
      # sand.distort_dots_swap(xy)
      sand.distort_dots_wind(xy)

      if not itt%5000:
        print(itt)
        sand.write_to_png(fn.name())
    except Exception:
      sand.write_to_png(fn.name())
      traceback.print_exc(file=sys.stdout)
      return 
開發者ID:inconvergent,項目名稱:sand-spline,代碼行數:27,代碼來源:main-bg.py

示例4: main

# 需要導入模塊: import fn [as 別名]
# 或者: from fn import Fn [as 別名]
def main():
  import sys, traceback
  from fn import Fn
  from sand import Sand

  sand = Sand(SIZE)
  sand.set_bg(BG)
  sand.set_rgba(FRONT)

  fn = Fn(prefix='./res/', postfix='.png')
  si = spline_iterator()

  while True:
    try:
      itt, xy = next(si)
      sand.paint_dots(xy)
      if not itt%(500*GRID_Y):
        print(itt)
        sand.write_to_png(fn.name(), GAMMA)
    except Exception as e:
      print(e)
      sand.write_to_png(fn.name(), GAMMA)
      traceback.print_exc(file=sys.stdout) 
開發者ID:inconvergent,項目名稱:sand-spline,代碼行數:25,代碼來源:main-hlines.py

示例5: main

# 需要導入模塊: import fn [as 別名]
# 或者: from fn import Fn [as 別名]
def main():
  from sand import Sand
  from fn import Fn

  from iutils.ioOBJ import export_2d as export


  sand = Sand(SIZE)
  sand.set_rgba(FRONT)
  fn = Fn(prefix='./res/')

  vertices, lines = make_creatures(sand)

  name = fn.name()
  sand.write_to_png(name + '.png', GAMMA)
  export('scribbles', name + '.2obj', verts=vertices, lines=lines) 
開發者ID:inconvergent,項目名稱:sand-creatures,代碼行數:18,代碼來源:main-export.py

示例6: __init__

# 需要導入模塊: import fn [as 別名]
# 或者: from fn import Fn [as 別名]
def __init__(
    self,
  ):
    from fn import Fn
    from os import sep

    self.fn = Fn()
    self.repo = self.fn.repo
    self._store = self.fn.top_level + sep + '.genlog'
    self.__ensure_store()

    self.size = 1024 
開發者ID:inconvergent,項目名稱:genlog,代碼行數:14,代碼來源:genlog.py

示例7: main

# 需要導入模塊: import fn [as 別名]
# 或者: from fn import Fn [as 別名]
def main():
  from sand import Sand
  from fn import Fn

  sand = Sand(SIZE)
  sand.set_bg(BACK)
  sand.set_rgba(FRONT)
  fn = Fn(prefix='./res/', postfix='.png')

  write(sand)
  # sand.set_bg(bw)
  name = fn.name()
  sand.set_transparent_pixel()
  sand.write_to_png(name, GAMMA) 
開發者ID:inconvergent,項目名稱:sand-glyphs,代碼行數:16,代碼來源:main.py

示例8: main

# 需要導入模塊: import fn [as 別名]
# 或者: from fn import Fn [as 別名]
def main():
  import sys, traceback
  from fn import Fn
  from sand import Sand
  from modules.helpers import get_colors

  sand = Sand(SIZE)
  sand.set_bg(BG)
  sand.set_rgba(FRONT)

  colors = get_colors('../colors/dark_cyan_white_black2.gif')
  nc = len(colors)

  fn = Fn(prefix='./res/', postfix='.png')
  si = spline_iterator()

  while True:
    try:
      itt, w, xy = next(si)
      rgba = colors[w%nc] + [0.0005]
      sand.set_rgba(rgba)
      sand.paint_dots(xy)
      if not itt%(40000):
        print(itt)
        sand.write_to_png(fn.name(), GAMMA)
    except Exception as e:
      print(e)
      sand.write_to_png(fn.name(), GAMMA)
      traceback.print_exc(file=sys.stdout) 
開發者ID:inconvergent,項目名稱:sand-spline,代碼行數:31,代碼來源:main-circle.py

示例9: main

# 需要導入模塊: import fn [as 別名]
# 或者: from fn import Fn [as 別名]
def main():
  import sys, traceback
  from fn import Fn
  from sand import Sand
  from modules.helpers import get_colors

  sand = Sand(SIZE)
  sand.set_bg(BG)
  sand.set_rgba(FRONT)

  colors = get_colors('../colors/dark_cyan_white_black2.gif')
  nc = len(colors)

  fn = Fn(prefix='./res/', postfix='.png')
  si = spline_iterator()

  while True:
    try:
      itt, w, xy = next(si)
      rgba = colors[w%nc] + [0.005]
      sand.set_rgba(rgba)
      sand.paint_dots(xy)
      if not itt%(700*GRID_Y*GRID_X):
        print(itt)
        sand.write_to_png(fn.name(), GAMMA)
    except Exception as e:
      print(e)
      sand.write_to_png(fn.name(), GAMMA)
      traceback.print_exc(file=sys.stdout) 
開發者ID:inconvergent,項目名稱:sand-spline,代碼行數:31,代碼來源:main-circles.py

示例10: main

# 需要導入模塊: import fn [as 別名]
# 或者: from fn import Fn [as 別名]
def main():
  from dunes import Dunes
  from sand import Sand
  from fn import Fn
  from time import time

  from modules.helpers import get_initial_rnd
  initial = get_initial_rnd(SIZE, n=4)
  bw = zeros(initial.shape,'float')

  dunes = Dunes(initial, DELTA, PROB)

  sand = Sand(SIZE)
  sand.set_rgba(FRONT)
  fn = Fn(prefix='./res/', postfix='.png')

  try:
    while True:
      t0 = time()
      itt = dunes.steps(LEAP)
      print(itt, time()-t0)
      dunes.get_normalized_sand_limit(bw, 10)
      # bw *= 0.8
      # sand.set_bg_from_bw_array(bw)
      # dunes.get_shadow(shadow)
      # rgb = dstack((bw,bw,shadow))
      # sand.set_bg_from_rgb_array(rgb)
      sand.set_bg_from_bw_array(bw)
      name = fn.name()
      sand.write_to_png(name)
  except KeyboardInterrupt:
    pass 
開發者ID:inconvergent,項目名稱:sand-dunes,代碼行數:34,代碼來源:main.py

示例11: main

# 需要導入模塊: import fn [as 別名]
# 或者: from fn import Fn [as 別名]
def main():
  from fn import Fn
  fn = Fn(prefix='./res/').name() + '.png'
  copy_file('./res/sample.png', fn) 
開發者ID:inconvergent,項目名稱:genlog,代碼行數:6,代碼來源:example.py

示例12: main

# 需要導入模塊: import fn [as 別名]
# 或者: from fn import Fn [as 別名]
def main():
  from sand import Sand
  from fn import Fn

  sand = Sand(SIZE)
  sand.set_bg(BACK)
  sand.set_rgba(FRONT)
  fn = Fn(prefix='./res/', postfix='.png')

  run(sand, fn) 
開發者ID:inconvergent,項目名稱:sand-walkers,代碼行數:12,代碼來源:main.py

示例13: main

# 需要導入模塊: import fn [as 別名]
# 或者: from fn import Fn [as 別名]
def main():
  from modules.boids import B
  from sand import Sand

  from fn import Fn

  fn = Fn(prefix='./res/', postfix='.png')

  sand = Sand(SIZE)
  sand.set_bg(BACK)
  sand.set_rgba(FRONT)

  b = B(INIT_NUM, SIZE, STP)

  for itt in range(1000000):

    b.step(
        separation=SEPARATION,
        cohesion=COHESION,
        alignment=ALIGNMENT
        )

    xy = b.xy
    for i, nearby in enumerate(b.get_nearby()):
      if not nearby:
        continue
      start = zeros((len(nearby), 2))
      start[:,0] = xy[i,0]
      start[:,1] = xy[i,1]
      stop = xy[nearby,:]
      g = GRAINS*ones(len(nearby), 'int')
      sand.paint_strokes(start, stop, g)

    if not itt%DRAW_ITT:
      name = fn.name()
      print(itt, name)
      sand.write_to_png(name) 
開發者ID:inconvergent,項目名稱:boids,代碼行數:39,代碼來源:main_sand.py

示例14: main

# 需要導入模塊: import fn [as 別名]
# 或者: from fn import Fn [as 別名]
def main():
  from sand import Sand
  from fn import Fn


  sand = Sand(SIZE)
  sand.set_rgba(FRONT)
  fn = Fn(prefix='./res/', postfix='.png')

  make_creatures(sand)
  # sand.set_bg_from_bw_array(bw)
  name = fn.name()
  sand.write_to_png(name, GAMMA) 
開發者ID:inconvergent,項目名稱:sand-creatures,代碼行數:15,代碼來源:main.py

示例15: main

# 需要導入模塊: import fn [as 別名]
# 或者: from fn import Fn [as 別名]
def main():
  from sand import Sand
  from fn import Fn


  sand = Sand(SIZE)
  sand.set_rgba(FRONT)
  fn = Fn(prefix='./res/', postfix='.png')

  make_creatures(sand)
  name = fn.name()
  sand.write_to_png(name, GAMMA) 
開發者ID:inconvergent,項目名稱:sand-creatures,代碼行數:14,代碼來源:main-multi.py


注:本文中的fn.Fn方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。