sketch-a-day/s358/s358.pyde

56 wiersze
1.3 KiB
Plaintext
Czysty Zwykły widok Historia

2018-12-23 01:33:43 +00:00
# Alexandre B A Villares - https://abav.lugaralgum.com/sketch-a-day
2018-12-23 02:13:57 +00:00
SKETCH_NAME = "s358" # 20181222
2018-12-23 01:33:43 +00:00
OUTPUT = ".gif"
2018-12-23 02:13:57 +00:00
GRID_SIZE = 5
BORDER = 50
2018-12-23 01:33:43 +00:00
from random import seed
from random import choice
from node import Node
def setup():
size(500, 500)
strokeWeight(1)
rectMode(CENTER)
frameRate(10)
random_seed(101)
Node.init_grid(GRID_SIZE, BORDER)
def draw():
translate(width/2, height/2)
background(200)
ang = 0 #frameCount/31.
for node in Node.nodes:
node.plot(ang)
if ang < TWO_PI:
pass
#saveFrame("###.png")
else:
noLoop()
def keyPressed():
if key == "n":
Node.init_grid(GRID_SIZE, BORDER)
if key == "s": saveFrame("###.png")
2019-02-23 19:34:51 +00:00
def random_seed(rnd_seed=None):
if rnd_seed == None:
rnd_seed = int(random(10000))
seed(rnd_seed)
randomSeed(rnd_seed)
println("seed: " + str(rnd_seed))
2018-12-23 01:33:43 +00:00
# print text to add to the project's README.md
def settings():
println(
"""
![{0}]({0}/{0}{2})
{1}: [code](https://github.com/villares/sketch-a-day/tree/master/{0}) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
""".format(SKETCH_NAME, SKETCH_NAME[1:], OUTPUT)
)