示例#1
0
import shades
import random
from handy_stuff import palletes

MIN_SCALE = random.uniform(0, 0.5)
MAX_SCALE = MIN_SCALE + random.uniform(0, 0.5)
MAX_SIZE = random.randint(1, 5)
WALK_LENGTH = random.randint(400, 2000)
WALKERS = random.randint(300, 1500)

pallete = random.choice(palletes)
canvas = shades.Canvas(2000, 2000)
x_field, y_field = shades.noise_fields(scale=random.uniform(0.004, 0.008),
                                       channels=2)
ink = shades.NoiseGradient(color_variance=20)


class Walker():
    """
    Class to move based on noise of count, and mark point on grid
    Takes xy coord as sole initialisation argument
    """
    def __init__(self, xy, color=(60, 140, 180)):
        self.affect = 10
        self.xy = xy
        self.x_noise = random.randint(0, 999)
        self.y_noise = random.randint(0, 999)
        self.scale = random.uniform(0, 0.6)
        self.size = random.randint(1, MAX_SIZE)
        ink.color = color
示例#2
0
import shades
import random
from handy_stuff import palletes

canvas = shades.Canvas()
if random.random() < 0.5:
    tones = [
        shades.NoiseGradient((180, 180, 180),
                             color_fields=shades.noise_fields(scale=0.002,
                                                              channels=3))
        for i in range(random.randint(2, 15))
    ]
else:
    pallete = random.choice(palletes)
    tones = [shades.BlockColor(i) for i in pallete]

shift = random.randint(10, 40)
spacing = random.randint(2, 5)
grid_size_x = random.randint(20, 30)
grid_size_y = random.randint(30, 60)

for y in range(-grid_size_y, canvas.height + grid_size_y, grid_size_y):
    for i, x in enumerate(
            range(-grid_size_x, canvas.width + grid_size_x, grid_size_x)):
        tone = random.choice(tones)
        for plus_y in range(0, grid_size_y, spacing):
            if i % 2 == 0:
                tone.line(canvas, (x, y + plus_y),
                          (x + grid_size_x, y + plus_y + shift), 1)
            else:
                tone.line(canvas, (x, y + plus_y + shift),
示例#3
0
import shades
import random

canvas = shades.Canvas(2000, 2000)

uno_shade = shades.NoiseGradient((180, 180, 180),
                                 color_fields=shades.noise_fields(scale=0.001))
dos_shade = shades.NoiseGradient((180, 180, 180),
                                 color_fields=shades.noise_fields(scale=0.001))
uno_noise, dos_noise = shades.noise_fields(scale=0.005, channels=2)
uno_size, dos_size = shades.noise_fields(scale=0.005, channels=2)
uno = {'shade': uno_shade, 'noise': uno_noise, 'size': uno_size}
dos = {'shade': dos_shade, 'noise': dos_noise, 'size': dos_size}

for _ in range(10):
    tone = random.choice([uno, dos])
    start = random.randint(0, canvas.width)
    plus = random.randint(100, 300)
    space = random.randint(5, 20)
    for y in range(300, canvas.height - 300, space):
        for x in range(start, start + plus):
            size = tone['size'].noise((x, y)) * 3
            size += 1
            size = int(size)
            warp = tone['noise'].noise((x, y * 0.06))
            warp -= 0.5
            warp *= 200
            tone['shade'].weighted_point(canvas, (x, y + warp), size)

canvas.show()
示例#4
0
import shades
import random

canvas = shades.Canvas(2000, 2000)

shade = shades.NoiseGradient((180, 180, 180),
                             color_fields=shades.noise_fields(scale=0.001))
noise = shades.NoiseField(scale=0.005)

shift = random.uniform(0.4, 0.6)
start = random.randint(0, canvas.width * 0.3)
plus = random.randint(canvas.width * 0.33, canvas.width * 0.75)
space = random.randint(2, 7)
keep = False
for y in range(-canvas.height, canvas.height + 400, space):
    for i, x in enumerate(range(-400, canvas.width + 400)):
        if not keep:
            keep = random.random() > 0.99
        else:
            keep = random.random() > 0.01
        if keep:
            warp = noise.noise((x, y * 0.06))
            warp -= 0.5
            warp *= 200
            shade.point(canvas, (x, y + warp + (shift * i)))

canvas.show()
示例#5
0
import shades
import random
from handy_stuff import palletes

canvas = shades.Canvas(2000, 2000)
pallete = random.choice(palletes)
random.shuffle(pallete)

canvas = shades.Canvas(2000, 2000, pallete[0])

tone = shades.BlockColor(warp_noise=shades.noise_fields(
    scale=[0, random.uniform(0, 0.002)], channels=2),
                         warp_size=random.randint(300, 900))
shift = random.randint(3, 9)

for y in range(-tone.warp_size, canvas.height + tone.warp_size, 30):
    for x in range(-50, canvas.width):
        for i in range(30):
            tone.color = pallete[i % len(pallete)]
            tone.weighted_point(canvas, (x + i * shift, y + i * shift), 2)

canvas.show()
示例#6
0
import shades
import random

canvas = shades.Canvas(2000, 2000)
ink = shades.NoiseGradient(
    color=(200, 200, 200),
    color_fields=shades.noise_fields(scale=0.0002, channels=3),
    color_variance=70,
    warp_size=800,
    warp_noise=shades.noise_fields(scale=0.002, channels=2),
)


def random_point():
    x = random.randint(-800, canvas.width + 800)
    y = random.randint(-800, canvas.height + 800)
    return (x, y)


'''
points = [random_point() for i in range(5500)]
for i in range(len(points)-1):
    ink.line(canvas, points[i], points[i+1], 1)
'''
for i in range(5000000):
    ink.point(canvas, random_point())

canvas.show()