How to use desert - 10 common examples

To help you get started, we’ve selected a few desert examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github inconvergent / desert / examples / erosion-send.py View on Github external
def main():

  with Erosion(verbose=VERBOSE)\
      .init(fg=rgb(1.0, 0.0, 0.0, 0.1),
            bg=white()) as erosion:

    send = erosion.send

    send([box(0.15, (0.3, 0.3), 2.0),
          box(0.2, (0.2, 0.5), 0.1),
          box((0.05, 0.5), (0.25, 0.9), 1.0),
          box((0.3, 0.2), (0.1, 0.9), 2.0)])

    erosion.set_fg(rgb(0, 0.5, 0.5, 0.1))

    send([box(0.15, (0.5, 0.3), 2.0),
          box(0.2, (0.5, 0.5), 0.1),
          box((0.05, 0.5), (0.6, 0.9), 1.0),
          box((0.1, 0.2), (0.3, 0.9), 1.0)])
github inconvergent / desert / examples / main.py View on Github external
def main(arg):

  imsize = 1000
  with Desert(imsize, verbose=VERBOSE)\
      .init(fg=rgb(1.0, 0.0, 0.0, 0.1),
            bg=white()) as desert:

    draw = desert.draw

    draw([box(0.15, (0.3, 0.3), 2.0),
          box(0.2, (0.2, 0.5), 0.1),
          box((0.05, 0.5), (0.25, 0.9), 1.0),
          box((0.3, 0.2), (0.1, 0.9), 2.0)])

    desert.show()

    desert.set_fg(rgb(0, 0.5, 0.5, 0.1))

    draw([box(0.15, (0.5, 0.3), 2.0),
          box(0.2, (0.5, 0.5), 0.1),
          box((0.05, 0.5), (0.6, 0.9), 1.0),
github inconvergent / desert / examples / erosion-send.py View on Github external
def main():

  with Erosion(verbose=VERBOSE)\
      .init(fg=rgb(1.0, 0.0, 0.0, 0.1),
            bg=white()) as erosion:

    send = erosion.send

    send([box(0.15, (0.3, 0.3), 2.0),
          box(0.2, (0.2, 0.5), 0.1),
          box((0.05, 0.5), (0.25, 0.9), 1.0),
          box((0.3, 0.2), (0.1, 0.9), 2.0)])

    erosion.set_fg(rgb(0, 0.5, 0.5, 0.1))

    send([box(0.15, (0.5, 0.3), 2.0),
          box(0.2, (0.5, 0.5), 0.1),
          box((0.05, 0.5), (0.6, 0.9), 1.0),
          box((0.1, 0.2), (0.3, 0.9), 1.0)])

    erosion.set_fg(rgb(0, 0.0, 0.8, 0.1))

    send([box(0.05, ((0.7, 0.3), (0.7, 0.8)), 1.0)])

    send([stroke(((0.1, 0.1),
                  (0.1, 0.1),
                  (0.1, 0.9),
                  (0.1, 0.1)),
github inconvergent / desert / examples / erosion-send.py View on Github external
def main():

  with Erosion(verbose=VERBOSE)\
      .init(fg=rgb(1.0, 0.0, 0.0, 0.1),
            bg=white()) as erosion:

    send = erosion.send

    send([box(0.15, (0.3, 0.3), 2.0),
          box(0.2, (0.2, 0.5), 0.1),
          box((0.05, 0.5), (0.25, 0.9), 1.0),
          box((0.3, 0.2), (0.1, 0.9), 2.0)])

    erosion.set_fg(rgb(0, 0.5, 0.5, 0.1))

    send([box(0.15, (0.5, 0.3), 2.0),
          box(0.2, (0.5, 0.5), 0.1),
          box((0.05, 0.5), (0.6, 0.9), 1.0),
          box((0.1, 0.2), (0.3, 0.9), 1.0)])

    erosion.set_fg(rgb(0, 0.0, 0.8, 0.1))

    send([box(0.05, ((0.7, 0.3), (0.7, 0.8)), 1.0)])

    send([stroke(((0.1, 0.1),
github inconvergent / desert / examples / erosion-send.py View on Github external
with Erosion(verbose=VERBOSE)\
      .init(fg=rgb(1.0, 0.0, 0.0, 0.1),
            bg=white()) as erosion:

    send = erosion.send

    send([box(0.15, (0.3, 0.3), 2.0),
          box(0.2, (0.2, 0.5), 0.1),
          box((0.05, 0.5), (0.25, 0.9), 1.0),
          box((0.3, 0.2), (0.1, 0.9), 2.0)])

    erosion.set_fg(rgb(0, 0.5, 0.5, 0.1))

    send([box(0.15, (0.5, 0.3), 2.0),
          box(0.2, (0.5, 0.5), 0.1),
          box((0.05, 0.5), (0.6, 0.9), 1.0),
          box((0.1, 0.2), (0.3, 0.9), 1.0)])

    erosion.set_fg(rgb(0, 0.0, 0.8, 0.1))

    send([box(0.05, ((0.7, 0.3), (0.7, 0.8)), 1.0)])

    send([stroke(((0.1, 0.1),
                  (0.1, 0.1),
                  (0.1, 0.9),
                  (0.1, 0.1)),
                 ((0.9, 0.9),
                  (0.1, 0.9),
                  (0.9, 0.9),
                  (0.2, 0.15)), 2)])
github inconvergent / desert / examples / main.py View on Github external
.init(fg=rgb(1.0, 0.0, 0.0, 0.1),
            bg=white()) as desert:

    draw = desert.draw

    draw([box(0.15, (0.3, 0.3), 2.0),
          box(0.2, (0.2, 0.5), 0.1),
          box((0.05, 0.5), (0.25, 0.9), 1.0),
          box((0.3, 0.2), (0.1, 0.9), 2.0)])

    desert.show()

    desert.set_fg(rgb(0, 0.5, 0.5, 0.1))

    draw([box(0.15, (0.5, 0.3), 2.0),
          box(0.2, (0.5, 0.5), 0.1),
          box((0.05, 0.5), (0.6, 0.9), 1.0),
          box((0.1, 0.2), (0.3, 0.9), 1.0)])

    desert.show()

    desert.set_fg(rgb(0, 0.0, 0.8, 0.1))

    draw([box(0.05, ((0.7, 0.3), (0.7, 0.8)), 1.0)])

    desert.show()

    draw([stroke(((0.1, 0.1),
                  (0.1, 0.1),
                  (0.1, 0.9),
                  (0.1, 0.1)),
                 ((0.9, 0.9),
github inconvergent / desert / examples / erosion-send.py View on Github external
def main():

  with Erosion(verbose=VERBOSE)\
      .init(fg=rgb(1.0, 0.0, 0.0, 0.1),
            bg=white()) as erosion:

    send = erosion.send

    send([box(0.15, (0.3, 0.3), 2.0),
          box(0.2, (0.2, 0.5), 0.1),
          box((0.05, 0.5), (0.25, 0.9), 1.0),
          box((0.3, 0.2), (0.1, 0.9), 2.0)])

    erosion.set_fg(rgb(0, 0.5, 0.5, 0.1))

    send([box(0.15, (0.5, 0.3), 2.0),
          box(0.2, (0.5, 0.5), 0.1),
          box((0.05, 0.5), (0.6, 0.9), 1.0),
          box((0.1, 0.2), (0.3, 0.9), 1.0)])

    erosion.set_fg(rgb(0, 0.0, 0.8, 0.1))

    send([box(0.05, ((0.7, 0.3), (0.7, 0.8)), 1.0)])

    send([stroke(((0.1, 0.1),
                  (0.1, 0.1),
github inconvergent / desert / examples / spline.py View on Github external
def main(arg):

  with Desert(1000, show=True, verbose=VERBOSE)\
      .init(fg=black(0.001),
            bg=white()) as c:

    density = 0.15
    num = 20
    rad = 0.35

    noise = 0.00005
    spl = []

    for _ in range(20):
      a = sorted(random(num)*TWOPI)
      spl.append(0.5 + column_stack((cos(a), sin(a)))*rad)

    res = []
    for i in range(1, 4000000):
      for xy in spl:
github inconvergent / desert / examples / circle.py View on Github external
def main(arg):

  with Desert(1000, show=True, verbose=VERBOSE)\
      .init(fg=black(0.001),
            bg=white()) as c:

    density = 0.02
    a = random(2)*TWOPI
    acc = zeros(2)
    noise = 0.000000005
    rad = 0.45

    resa = []
    resb = []

    for i in range(4000000):
      a += acc
      acc += (1-2*random(2))*noise

      resa.append((cos(a[0]), sin(a[0])))
github inconvergent / desert / erosion / erosion.py View on Github external
def _erosion_cmd(self, _type, j):
    if _type == '_test':
      self._show_test(j)
    elif _type == '_init':
      self.desert.init(
          fg=Rgba.from_json(j['_data']['fg']),
          bg=Rgba.from_json(j['_data']['bg']),
          )
    elif _type == '_save':
      self.save()
    else:
      print('## warn: erosion. unknown cmd: {:s}'.format(_type))