diff --git a/2019/sketch_190823c/sketch_190823c.gif b/2019/sketch_190823c/sketch_190823c.gif new file mode 100644 index 00000000..34bbc471 Binary files /dev/null and b/2019/sketch_190823c/sketch_190823c.gif differ diff --git a/2019/sketch_190823c/sketch_190823c.pyde b/2019/sketch_190823c/sketch_190823c.pyde new file mode 100644 index 00000000..07784584 --- /dev/null +++ b/2019/sketch_190823c/sketch_190823c.pyde @@ -0,0 +1,83 @@ +# import copy as cp + +add_library('pdf') +polys = [] +current_poly = [] +divisoes = 5 +salvar_pdf = False +ponto_clique = [] + +def setup(): + size(700, 700) + strokeJoin(ROUND) + +def draw(): + if salvar_pdf: + beginRecord(PDF, "####.pdf") + + mh, mv = width / 2, height / 2 + translate(mh, mv) + background(240, 240, 200) + + angulo = radians(360. / divisoes) + fill(0, 0, 200) + noStroke() + for num in range(divisoes): + rotate(angulo) + for poly in polys: + # (x1, y1), (x2, y2) = poly + print poly + draw_poly(poly) + scale(-1, 1) + draw_poly(poly) + scale(-1, 1) + + if salvar_pdf: + endRecord() + global salvar_pdf + salvar_pdf = False + + if current_poly: + noFill() + stroke(0) + for num in range(divisoes): + rotate(angulo) + draw_poly(current_poly + [(mouseX, mouseY)]) + scale(-1, 1) + draw_poly(current_poly + [(mouseX, mouseY)]) + scale(-1, 1) + +def draw_poly(poly): + pushMatrix() + translate(-width / 2, -height / 2) + beginShape() + for p in poly: + vertex(p[0], p[1]) + endShape(CLOSE) + popMatrix() + +def mousePressed(): # def mouseDragged(): + if mouseButton == LEFT: + current_poly.append((mouseX, mouseY)) + if mouseButton == RIGHT: + polys.append(current_poly + [(mouseX, mouseY)]) + current_poly[:] = [] + +def keyPressed(): + global salvar_pdf, divisoes + if key == "a": + polys[:] = [[]] # esvazia lista de polys + ponto_clique[:] = [] + if key == "g": + saveFrame("#####.png") + print("salvando PNG") + if key == "p": + salvar_pdf = True + print("salvando PDF") + if key == BACKSPACE and polys: + polys.pop() + if key == "-" and divisoes > 2: + divisoes -= 1 + if key == "+" or key == "=": + divisoes += 1 + diff --git a/README.md b/README.md index 8edbea39..d755bc46 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,33 @@ You may also support my artistic work, open teaching resources and research with ## 2019 +--- + +![sketch_1900823a](2019/sketch_190823c/sketch_190823c.gif) + +[sketch_190823c](https://github.com/villares/sketch-a-day/tree/master/2019/sketch_190823c) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)] + +Interactive symmetryc polygons + +--- + +![sketch_1900822c](2019/sketch_190822c/sketch_190822c.gif) + +[sketch_190822c](https://github.com/villares/sketch-a-day/tree/master/2019/sketch_190822c) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)] + +Interactive symmetric lines + +--- + +![sketch_1900821c](2019/sketch_190821c/sketch_190821c.png) + +[sketch_190821c](https://github.com/villares/sketch-a-day/tree/master/2019/sketch_190821c) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)] + +--- + +![sketch_1900820a](2019/sketch_190820a/sketch_190820a.gif) + +[sketch_190820a](https://github.com/villares/sketch-a-day/tree/master/2019/sketch_190820a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)] ---