23, 24 & 25
Po Szerokość: | Wysokość: | Rozmiar: 67 KiB |
Po Szerokość: | Wysokość: | Rozmiar: 71 KiB |
Po Szerokość: | Wysokość: | Rozmiar: 63 KiB |
Po Szerokość: | Wysokość: | Rozmiar: 59 KiB |
|
@ -0,0 +1,43 @@
|
||||||
|
"""Grid study"""
|
||||||
|
shapes = []
|
||||||
|
|
||||||
|
def setup():
|
||||||
|
size(500, 500)
|
||||||
|
rectMode(CENTER)
|
||||||
|
for i in range(10):
|
||||||
|
x, y = random(-100, 100), random(-100, 100)
|
||||||
|
d = int(random(5, 10))
|
||||||
|
sp = random(15, 35)
|
||||||
|
si = random(15, 35)
|
||||||
|
shapes.extend(grid(pos=(x, y),
|
||||||
|
dims=(d, d),
|
||||||
|
space=sp,
|
||||||
|
elem=(create_element, si))
|
||||||
|
)
|
||||||
|
def draw():
|
||||||
|
background(100)
|
||||||
|
translate(width / 2., height / 2.)
|
||||||
|
for s in shapes:
|
||||||
|
shape(s)
|
||||||
|
|
||||||
|
def grid(pos, dims, space, elem):
|
||||||
|
gx, gy = pos
|
||||||
|
col, row = dims
|
||||||
|
func, args = elem[0], elem[1:]
|
||||||
|
result = []
|
||||||
|
half_w = col * space / 2.
|
||||||
|
half_h = row * space / 2.
|
||||||
|
for ix in range(col):
|
||||||
|
x = gx + ix * space + space / 2. - half_w
|
||||||
|
for iy in range(row):
|
||||||
|
y = gy + iy * space + space / 2. - half_h
|
||||||
|
result.append(func(x, y, *args))
|
||||||
|
return result
|
||||||
|
|
||||||
|
def create_element(x, y, *args):
|
||||||
|
noStroke()
|
||||||
|
fill(255, 100)
|
||||||
|
return createShape(ELLIPSE, x, y, args[0], args[0])
|
||||||
|
|
||||||
|
def keyPressed():
|
||||||
|
saveFrame("####.png")
|
Po Szerokość: | Wysokość: | Rozmiar: 36 KiB |
Po Szerokość: | Wysokość: | Rozmiar: 30 KiB |
Po Szerokość: | Wysokość: | Rozmiar: 39 KiB |
Po Szerokość: | Wysokość: | Rozmiar: 23 KiB |
Po Szerokość: | Wysokość: | Rozmiar: 28 KiB |
Po Szerokość: | Wysokość: | Rozmiar: 31 KiB |
Po Szerokość: | Wysokość: | Rozmiar: 29 KiB |
|
@ -0,0 +1,50 @@
|
||||||
|
"""Grid study"""
|
||||||
|
|
||||||
|
def setup():
|
||||||
|
size(500, 500)
|
||||||
|
create_grids()
|
||||||
|
|
||||||
|
def create_grids():
|
||||||
|
global shapes
|
||||||
|
shapes = []
|
||||||
|
for i in range(10):
|
||||||
|
d = int(random(5, 10))
|
||||||
|
sp = int(random(3, 8)) * 5
|
||||||
|
x = int(random(-10, 10)) * sp
|
||||||
|
y = int(random(-10, 10)) * sp
|
||||||
|
si = random(15, 35)
|
||||||
|
shapes.extend(grid(pos=(x, y),
|
||||||
|
dims=(d, d),
|
||||||
|
space=sp,
|
||||||
|
elem=(create_element, si))
|
||||||
|
)
|
||||||
|
def draw():
|
||||||
|
background(100)
|
||||||
|
translate(width / 2., height / 2.)
|
||||||
|
for s in shapes:
|
||||||
|
shape(s)
|
||||||
|
|
||||||
|
def grid(pos, dims, space, elem):
|
||||||
|
gx, gy = pos
|
||||||
|
col, row = dims
|
||||||
|
func, args = elem[0], elem[1:]
|
||||||
|
result = []
|
||||||
|
half_w = col * space / 2.
|
||||||
|
half_h = row * space / 2.
|
||||||
|
for ix in range(col):
|
||||||
|
x = gx + ix * space + space / 2. - half_w
|
||||||
|
for iy in range(row):
|
||||||
|
y = gy + iy * space + space / 2. - half_h
|
||||||
|
result.append(func(x, y, *args))
|
||||||
|
return result
|
||||||
|
|
||||||
|
def create_element(x, y, *args):
|
||||||
|
noStroke()
|
||||||
|
fill(255, 100)
|
||||||
|
return createShape(ELLIPSE, x, y, args[0], args[0])
|
||||||
|
|
||||||
|
def keyPressed():
|
||||||
|
if key == "s":
|
||||||
|
saveFrame("####.png")
|
||||||
|
if key == " ":
|
||||||
|
create_grids()
|
Po Szerokość: | Wysokość: | Rozmiar: 54 KiB |
Po Szerokość: | Wysokość: | Rozmiar: 31 KiB |
Po Szerokość: | Wysokość: | Rozmiar: 41 KiB |
Po Szerokość: | Wysokość: | Rozmiar: 48 KiB |
Po Szerokość: | Wysokość: | Rozmiar: 55 KiB |
|
@ -0,0 +1,53 @@
|
||||||
|
"""Grid study"""
|
||||||
|
|
||||||
|
def setup():
|
||||||
|
size(500, 500)
|
||||||
|
colorMode(HSB)
|
||||||
|
create_grids()
|
||||||
|
|
||||||
|
def create_grids():
|
||||||
|
global shapes
|
||||||
|
shapes = []
|
||||||
|
for i in range(10):
|
||||||
|
d = int(random(5, 10))
|
||||||
|
sp = int(random(3, 8)) * 5
|
||||||
|
x = int(random(-8, 9)) * sp
|
||||||
|
y = int(random(-8, 9)) * sp
|
||||||
|
si = random(15, 35)
|
||||||
|
shapes.extend(grid(pos=(x, y),
|
||||||
|
dims=(d, d),
|
||||||
|
space=sp,
|
||||||
|
elem=(create_element, si))
|
||||||
|
)
|
||||||
|
def draw():
|
||||||
|
background(100)
|
||||||
|
translate(width / 2., height / 2.)
|
||||||
|
|
||||||
|
for s in shapes:
|
||||||
|
shape(s)
|
||||||
|
|
||||||
|
def grid(pos, dims, space, elem):
|
||||||
|
gx, gy = pos
|
||||||
|
col, row = dims
|
||||||
|
func, args = elem[0], elem[1:]
|
||||||
|
result = []
|
||||||
|
half_w = col * space / 2.
|
||||||
|
half_h = row * space / 2.
|
||||||
|
fill(row * 16, 200, 200, 100)
|
||||||
|
for ix in range(col):
|
||||||
|
x = gx + ix * space + space / 2. - half_w
|
||||||
|
for iy in range(row):
|
||||||
|
y = gy + iy * space + space / 2. - half_h
|
||||||
|
result.append(func(x, y, *args))
|
||||||
|
return result
|
||||||
|
|
||||||
|
def create_element(x, y, *args):
|
||||||
|
noStroke()
|
||||||
|
# fill(255, 100)
|
||||||
|
return createShape(ELLIPSE, x, y, args[0], args[0])
|
||||||
|
|
||||||
|
def keyPressed():
|
||||||
|
if key == "s":
|
||||||
|
saveFrame("####.png")
|
||||||
|
if key == " ":
|
||||||
|
create_grids()
|