import shades

canvas = shades.Canvas(1000, 907)


def units(n):
    return n * (canvas.width / 205)


central_color = (200, 200, 200)

one = shades.NoiseGradient(
    color=central_color,
    noise_fields=[shades.NoiseField(scale=0.001) for i in range(3)])

two = shades.NoiseGradient(
    color=central_color,
    noise_fields=[shades.NoiseField(scale=0.001) for i in range(3)])

three = shades.NoiseGradient(
    color=central_color,
    noise_fields=[shades.NoiseField(scale=0.001) for i in range(3)])

fill = shades.NoiseGradient(
    color=central_color,
    noise_fields=[shades.NoiseField(scale=0.001) for i in range(3)])

fill.fill(canvas)

one.shape(canvas, [
    (units(87), units(1)),
Exemple #2
0
import shades
from random import choice, randint

canvas = shades.Canvas(800, 500, color=(249, 241, 228))
ink = shades.BlockColor()
units = 50


def pick_colour():
    colours = [
        (233, 80, 62),
        (76, 111, 190),
        (252, 218, 0),
        (0, 142, 41),
        (249, 241, 228),
        (204, 195, 175),
    ]
    var = 0
    colour = choice(colours)
    return shades.color_clamp(
        (colour[0] + randint(-var, var), colour[1] + randint(-var, var),
         colour[2] + randint(-var, var)))


def rythm(y):
    height = units * randint(1, 3)
    width = units * randint(1, 4)
    spacing = width * randint(0, 5)
    placement = spacing
    ink.color = pick_colour()
import shades
from random import randint
from scipy.spatial import Delaunay

canvas = shades.Canvas(700, 700)
background = shades.NoiseGradient(
    color=(0, 0, 50),
    noise_fields=[shades.NoiseField(scale=0.002) for i in range(3)])
white = shades.BlockColor((255, 255, 255))

background.fill(canvas)

points = [(randint(0, canvas.width), randint(0, canvas.height))
          for i in range(200)]

for point in points:
    white.circle(canvas, point, randint(1, 1))

# drawing triangles between points
for tri in Delaunay(points).simplices:
    if randint(1, 30) == 1:
        white.triangle_outline(canvas, points[tri[0]], points[tri[1]],
                               points[tri[2]], 1)

canvas.show()
Exemple #4
0
import shades
from random import randint
from scipy.spatial import Delaunay

canvas = shades.Canvas(1920, 1200)
ink = shades.NoiseGradient(
    noise_fields=[shades.NoiseField(scale=0.002) for i in range(3)])

points = [(randint(0, canvas.width), randint(0, canvas.height))
          for i in range(90)]
# plus some edge points to make sure the whole canvas is coloured
points.append((0, 0))
points.append((0, canvas.height))
points.append((canvas.width, 0))
points.append((canvas.width, canvas.height))
points.append((0, canvas.height / 2))
points.append((canvas.width, canvas.height / 2))
points.append((canvas.width / 2, 0))
points.append((canvas.width / 2, canvas.height))

# drawing triangles between points
for tri in Delaunay(points).simplices:
    ink.color = [randint(130, 190), randint(160, 200), randint(200, 250)]
    ink.triangle(
        canvas,
        points[tri[0]],
        points[tri[1]],
        points[tri[2]],
    )

canvas.show()
Exemple #5
0
import shades
import numpy as np

CANVAS = shades.Canvas(1000, 1000)


class Cloud(shades.Shade):
    def __init__(self, color, noise=shades.NoiseField(), air=0.3):
        super().__init__(color)
        self.cloud_noise = noise
        self.air = air

    def determine_shade(self, xy_coords):
        color = CANVAS.getpixel(xy_coords)
        noise = self.cloud_noise.noise(xy_coords)
        noise = max(noise, 0)
        return shades.color_clamp([
            np.average([color[i], self.color[i]],
                       weights=[0.5, noise * self.air]) for i in range(3)
        ])


colors = [(250, 0, 0), (0, 250, 0), (0, 0, 250)]
np.random.shuffle(colors)
for color in colors:
    tone = Cloud(color, shades.NoiseField(scale=0.001))
    tone.fill(CANVAS)

CANVAS.show()
Exemple #6
0
import shades
import random
from handy_stuff import palletes

canvas = shades.Canvas(height=2000, width=2000)
transparency = random.uniform(0.4, 0.9)
pallete = random.choice(palletes)
inks = [shades.BlockColor(i, transparency=0.6) for i in pallete]


def draw_rect_with_lines(shade, canvas, topcorner, height, width):
    offset_1 = random.randint(0, 500)
    offset_2 = random.randint(0, 500)
    if random.random() < 0.5:
        for x in range(topcorner[0], topcorner[0] + width, 5):
            shade.line(
                canvas,
                (x + offset_1, topcorner[1]),
                (x + offset_2, topcorner[1] + height),
                1,
            )
    else:
        for y in range(topcorner[1], topcorner[1] + height, 5):
            shade.line(
                canvas,
                (topcorner[0], y + offset_1),
                (topcorner[0] + width, y + offset_2),
                1,
            )

Exemple #7
0
import shades
import random


class noise(shades.Shade):
    def determine_shade(self, xy):
        if self.warp_noise[0].noise(xy) < random.uniform(*self.rand_range):
            self.transparency = 1
        else:
            self.transparency = 0
        return self.color


canvas = shades.Canvas(1200, 1200)
colors = [(0, 43, 89), (249, 223, 29), (84, 145, 150), (173, 176, 163),
          (72, 172, 157), (50, 111, 164), (171, 190, 208), (159, 132, 63),
          (83, 127, 177)]
colors = colors[:3]
inks = []

for c in colors:
    ink = noise(c,
                warp_noise=[shades.NoiseField(scale=0.001) for i in range(2)])
    ink.rand_range = [random.uniform(0, 0.4), 1]
    inks.append(ink)

random.shuffle(inks)

margin = canvas.width / 3

for ink in inks:
Exemple #8
0
import shades
import random
from handy_stuff import palletes

pallete = random.choice(palletes)
canvas = shades.Canvas(3000, 4000, random.choice(pallete))
x_field = shades.NoiseField(scale=random.uniform(0.003, 0.008), )
y_field = shades.NoiseField(scale=random.uniform(0.003, 0.008), )
ink = shades.BlockColor()


class Walker():
    """
    Class to move based on flow field, 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
        ink.color = color

    def draw(self):
        ink.point(canvas, (int(self.xy[0]), int(self.xy[1])))

    def move(self):
        x_vect = x_field.noise((
            int(self.xy[0]),
            int(self.xy[1]),
        ))
        y_vect = y_field.noise((
            int(self.xy[0]),
Exemple #9
0
import shades
from random import randint

canvas = shades.Canvas(1000, 1000, (220, 230, 229))
block = shades.BlockColor((229, 211, 96))
size_noise = shades.NoiseField(scale=0.02)
x_space_noise = shades.NoiseField(scale=0.02)
y_space_noise = shades.NoiseField(scale=0.002)
color_noise = shades.NoiseField(scale=0.02)
colors = [
    (189, 213, 215),
    (67, 99, 110),
    (253, 243, 218),
    (103, 151, 165),
    (255, 193, 178),
]

x = 0
y = 0
t = randint(1, 9999)
scale = randint(3, 5)
scale_change_x = randint(2, 4)
scale_change_y = randint(2, 4)

while y < canvas.height:
    x = 0
    while x < canvas.width:
        block.circle(canvas, (x, y), size_noise.noise((t, 1)) * scale)
        x += x_space_noise.noise((t, 1)) * scale * scale_change_x
        t += 1
        c_val = color_noise.noise((t, 1))
Exemple #10
0
import shades
import random

canvas = shades.Canvas(2400 * 2, 1500 * 2, (20, 20, 20))


class RandomFill(shades.Shade):
    def determine_shade(self, xy):
        if random.random() < self.chance:
            return (200, 200, 200)


tone = RandomFill(
    warp_size=500,
    warp_noise=[shades.NoiseField(scale=0),
                shades.NoiseField(scale=0.00125)],
)

for y in range(0, canvas.height + 500, 10 * 2):
    tone.chance = (y**2 / 10000) / 500 / 2
    for i in range(0, 3):
        tone.line(canvas, (-500, y + i), (canvas.width, y + i), 1)

canvas.show()
Exemple #11
0
import shades
from random import randint


def nearby_point(point, distance):
    x = point[0] + randint(-distance, distance)
    y = point[1] + randint(-distance, distance)
    while shades.distance_between_points(point, (x, y)) > distance:
        x = point[0] + randint(-distance, distance)
        y = point[1] + randint(-distance, distance)
    return (x, y)


canvas = shades.Canvas(4000, 4000)
background_shade = shades.BlockColor((240, 240, 240))
foreground = shades.BlockColor(
    color=(41, 104, 136),
    warp_size=50,
    warp_noise=[shades.NoiseField(scale=0.02),
                shades.NoiseField(scale=0.001)],
)
steps = 25
walk_distance = 10
wackiness = 50

for i in range(1, steps):
    y = i / steps * canvas.height
    start = (0, y)
    end = (canvas.width, y)
    last_point = start
    while last_point[0] < end[0]:
Exemple #12
0
import shades

canvas = shades.Canvas(1400, 1400)

shade = shades.NoiseGradient(
    color = (200, 200, 200),
    noise_fields = [shades.NoiseField(scale=0.002) for i in range(3)],
    warp_size = 300,
    warp_noise = (shades.NoiseField(scale=0.002),shades.NoiseField(scale=0.002))
)

for x in range(-300, canvas.width+300, 10):
    shade.line(canvas, (x,-300), (x,canvas.height+300), 1)

for y in range(-300, canvas.height+300, 10):
    shade.line(canvas, (-300,y), (canvas.height+300,y), 1)

white = shades.BlockColor((240,240,240))
border_size = 300

white.rectangle(canvas, (0, 0), border_size, canvas.height)
white.rectangle(canvas, (0, 0), canvas.width, border_size)
white.rectangle(canvas, (0, canvas.height - border_size), canvas.width, border_size)
white.rectangle(canvas, (canvas.width - border_size, 0), border_size, canvas.height)

canvas.show()
Exemple #13
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()
Exemple #14
0
import shades
import random

canvas = shades.Canvas(1300, 1300)
ink = shades.BlockColor(
    warp_size=500,
    warp_noise=[shades.NoiseField(scale=0.01) for i in range(2)],
)
colors = [
    (193, 246, 218),
    (249, 220, 220),
    (242, 250, 251),
    (207, 229, 244),
    (249, 222, 238),
]


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


for i in range(9000):
    ink.color = random.choice(colors)
    point = random_point()
    shift = (
        point[0] + random.randint(-1000, 1000),
        point[1] + random.randint(-1000, 1000),
    )
    ink.line(canvas, point, shift, 3)
Exemple #15
0
import shades
import math
import random

canvas = shades.Canvas(800, 800)


def draw_parametric(color):
    div1 = random.randint(8, 16)
    div2 = random.randint(8, 16)
    div3 = random.randint(8, 16)
    div4 = random.randint(8, 16)
    mul1 = random.randint(100, 250)
    mul2 = random.randint(100, 250)
    mul3 = random.randint(100, 250)
    mul4 = random.randint(100, 250)

    def x(t):
        return math.sin(t / div1) * mul1 + math.sin(t / div2) * mul2

    def y(t):
        return math.cos(t / div3) * mul3 + math.cos(t / div4) * mul4

    start = random.randint(0, 9999999)
    end = random.randint(1, 2000)
    ink = shades.BlockColor(color)
    go = True

    for i in range(0, end, 1):
        if go:
            t = start + i
Exemple #16
0
import shades
import random

canvas = shades.Canvas(600, 600)
ink = shades.BlockColor()

colors = [
    (172, 205, 213),
    (70, 70, 70),
    (44, 39, 0),
    (188, 61, 17),
    (250, 233, 122),
]

segments_x = 6
segments_y = 6

x_step = int(canvas.width / segments_x)
y_step = int(canvas.height / segments_y)

# what if we iterate through, placing a bunch of rectangles around?
ink.color = random.choice(colors)
ink.rectangle(
    canvas,
    (x_step, y_step),
    canvas.width - x_step * 2,
    canvas.height - y_step * 2,
)

for i in range(12):
    y = random.choice(range(y_step, canvas.height - y_step * 2, y_step))
Exemple #17
0
import shades

canvas = shades.Canvas()

shade = shades.NoiseGradient(
    color=(200, 200, 200),
    noise_fields=[shades.NoiseField(scale=0.002) for i in range(3)],
)

block = shades.BlockColor(
    color=(240, 240, 240),
    warp_size=150,
    warp_noise=(shades.NoiseField(scale=0), shades.NoiseField(scale=0.008)),
)

shade.fill(canvas)

for y in range(-150, canvas.height + 150, 4):
    block.line(canvas, (-150, y), (canvas.width + 150, y), 1)

canvas.show()
Exemple #18
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
Exemple #19
0
import shades
import random

canvas = shades.Canvas(1500, 1000)
shade_one = shades.BlockColor((97, 196, 227))
shade_two = shades.BlockColor((247, 228, 91))
shade_three = shades.BlockColor((251, 5, 28))
shade_four = shades.BlockColor((23, 79, 114))


def stack(start_coords, width, height, offset):
    perc = height / 100
    shade_dict = {
        0: shade_one,
        random.randint(perc * 33, perc * 40): shade_two,
        random.randint(perc * 46, perc * 50): shade_three,
        random.randint(perc * 75, perc * 85): shade_four,
        perc * 200: shade_one,
    }
    for y in range(int(start_coords[1]), int(start_coords[1] + height), 5):
        filtered_dict = {k: shade_dict[k] for k in shade_dict if k > y}
        color = filtered_dict[list(filtered_dict.keys())[0]]
        color.line(canvas, (start_coords[0], y),
                   (start_coords[0] + width, y + offset), 2)


margin = 50
width = 20
gap = 5
tilt = random.randint(0, 20)
import shades
import random

canvas = shades.Canvas(2000, 2000, (240, 240, 240))
underlay = shades.BlockColor((230, 230, 230))
highlight = shades.BlockColor()
highlight_colors = [(244, 131, 166), (128, 199, 242), (213, 205, 209)]
highlight_weights = [1, 10, 10]
underlay = shades.BlockColor((220, 220, 220))
line = shades.BlockColor((220, 220, 220), transparency=1)

grid_size = 100
grid_points = []

for x in range(0, canvas.width, int(grid_size)):
    for y in range(0, canvas.height, int(grid_size)):
        if random.random() > 0.5:
            underlay.circle(canvas, (x, y), 3)
        else:
            underlay.line(canvas, (x - 5, y - 5), (x + 5, y + 5), 2)
            underlay.line(canvas, (x - 5, y + 5), (x + 5, y - 5), 2)


def random_point():
    x_grid_lr = int(canvas.width / grid_size / 4)
    x_grid_ur = x_grid_lr * 2
    y_grid_lr = int(canvas.height / grid_size / 4)
    y_grid_ur = y_grid_lr * 2
    x = grid_size * random.randint(x_grid_lr, x_grid_ur)
    y = grid_size * random.randint(y_grid_lr, y_grid_ur)
    return [x, y]