示例#1
0
import sketcher
import random

canvas = sketcher.Canvas(500, 500)
colors = [(59,78,148),(185,63,34),(210,180,10)]

num_x = random.randint(2,4)
num_y = random.randint(2,4)


x_points = [random.randint(0,canvas.width) for i in range(num_x)]
y_points = [random.randint(0,canvas.height) for i in range(num_y)]

x_points.append(-10)
x_points.append(canvas.width+10)
y_points.append(-10)
y_points.append(canvas.height+10)

for x in x_points:
    for y in y_points:
        # first find the nearest x point, and use to decide width
        try:
            canvas.line((0,y),(canvas.width,y), ink=sketcher.Ink(color=(40,40,40),weight=4))
            next_x = [p for p in x_points if x < p]
            next_x.sort()
            next_x = next_x[0]
            next_y = [p for p in y_points if y < p]
            next_y.sort()
            next_y = next_y[0]
            width = next_x - x
            height = next_y - y
示例#2
0
import sketcher
import random

canvas = sketcher.Canvas(800, 800)
ink = sketcher.Ink(color=(100, 100, 100),
                   warp_seeds=[random.randint(0, 999) for i in [1, 2]],
                   warp_scale=0.01,
                   warp_size=0)

canvas.fill(sketcher.Ink('simplex_gradient', color=(60, 60, 60)))

y = 300

while y < canvas.height - 200:

    canvas.circle((canvas.width / 2, y), 300, 299, ink)
    ink.warp_size += 4
    y += 7

canvas.show()
canvas.save('cool' + str(random.randint(0, 99999999)) + '.png')
示例#3
0
import sketcher
import random

canvas = sketcher.Canvas(700, 700)
colors = [(12, 11, 6), (240, 203, 71), (58, 135, 163), (235, 177, 176),
          (244, 238, 224), (200, 38, 49)]

num_x = random.randint(2, 15)
num_y = random.randint(2, 15)

x_points = [random.randint(0, canvas.width / 20) * 20 for i in range(num_x)]
y_points = [random.randint(0, canvas.height / 20) * 20 for i in range(num_y)]

noise_seeds = [random.randint(0, 999) for i in range(3)]

for x in x_points:
    last_y = 0
    while last_y <= canvas.height:
        next_y = last_y + (random.randint(1, 5) * 20)
        color = random.choice(colors)
        line_tone = sketcher.Ink(color=color, weight=20)
        canvas.line((x, last_y), (x, next_y), ink=line_tone)
        last_y = next_y

for y in y_points:
    last_x = 0
    while last_x <= canvas.height:
        next_x = last_x + (random.randint(1, 5) * 20)
        color = random.choice(colors)
        line_tone = sketcher.Ink(color=color, weight=20)
        canvas.line((last_x, y), (next_x, y), ink=line_tone)
示例#4
0
import sketcher
import random
from opensimplex import OpenSimplex
canvas = sketcher.Canvas(1000, 1000)

ink = sketcher.Ink('simplex_gradient', (200, 200, 200),
                   c_var=70,
                   noise_seeds=[random.randint(0, 999) for i in range(3)],
                   warp_scale=0.004,
                   warp_size=300)

for i in range(3):
    ink.warp_noise = [OpenSimplex(random.randint(0, 999)) for i in range(2)]
    for y in range(0 - ink.warp_size, canvas.height + ink.warp_size, 10):
        canvas.line((0 - ink.warp_size, y), (canvas.width + ink.warp_size, y),
                    ink)

canvas.save('overlapping_grids_{}.png'.format(random.randint(1, 9999)))
canvas.show()
import sketcher
import opensimplex
import random

canvas = sketcher.Canvas(600,600)
noise_scale = 0.004

for c in [(137,143,167),(224,173,89),(209,192,181)]:
    noise = opensimplex.OpenSimplex(random.randint(0,9999))
    ink = sketcher.Ink(color=c)
    for x in range(canvas.width):
        for y in range(canvas.width):
            ink.transparency = sketcher.mapped_noise(noise, (x*noise_scale, y*noise_scale), 0.4, 1)
            ink.point(canvas, (x,y))

canvas.save('grad{}.png'.format(random.randint(0,9999)))
canvas.show()
示例#6
0
import sketcher
import random

canvas = sketcher.Canvas(1200, 1200)

for y in range(0, canvas.height, 25):
    for x in range(0, canvas.width, 25):
        if random.randint(0, 1) == 0:
            canvas.line((x, y), (x + 25, y + 25))
        else:
            canvas.line((x, y + 25), (x + 25, y))

canvas.show()
示例#7
0
import sketcher
import random

for i in range(8):
    canvas = sketcher.Canvas(1004, 1475)

    ink = sketcher.Ink('simplex_gradient', (200, 200, 200),
                       c_var=70,
                       noise_seeds=[random.randint(0, 999) for i in range(3)],
                       warp_seeds=[random.randint(0, 999) for i in range(2)],
                       warp_scale=0.001,
                       warp_size=400)

    for y in range(0 - ink.warp_size, canvas.height + ink.warp_size, 10):
        canvas.line((0 - ink.warp_size, y), (canvas.width + ink.warp_size, y),
                    ink)

    for x in range(0 - ink.warp_size, canvas.width + ink.warp_size, 10):
        canvas.line((x, 0 - ink.warp_size), (x, canvas.height + ink.warp_size),
                    ink)

    canvas.save('lines' + str(random.randint(0, 99999)) + '.png')
    canvas.show()