diff --git a/README.md b/README.md index 3e1144ef..be37229c 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,14 @@ If you enjoy this, make a small donation [here](https://www.paypal.com/cgi-bin/w ---- +![s060](s060/s060.gif) + +060: [code](https://github.com/villares/sketch-a-day/tree/master/s060) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)] + +Complete Object Oriented refactor... + +---- + ![s059](s059/s059.gif) 059: [code](https://github.com/villares/sketch-a-day/tree/master/s059) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)] diff --git a/s060/s060.pyde b/s060/s060.pyde index 928dbb68..ebdd24f9 100644 --- a/s060/s060.pyde +++ b/s060/s060.pyde @@ -6,8 +6,6 @@ from collections import namedtuple import random as rnd import copy as cp -# from drawing_classes import D_node - SPACING, MARGIN = 50, 75 POSITIONS = [] # listas de posições para elementos Point = namedtuple('Point', 'x y') @@ -153,20 +151,16 @@ class D_node(object): def points_now(self, amt=0): p0 = self.never_empty(self.points_to[0])[0] p1 = self.never_empty(self.points_to[1])[0] - if amt == 0: - return self.points_to[0] - elif amt == 1: - return self.points_to[1] + if amt == 0 or amt == 1: + return self.points_to[int(amt)] else: return [Point(lerp(p0.x, p1.x, amt), lerp(p0.y, p1.y, amt))] - def color_def(node, index): - if not node.points_to[index]: return color(255, 0, 0) - def s_color(self, fase): - if fase == 0: - if not self.points_to[int(fase)]: return color(255, 0, 0) + def s_color(self, amt): + if amt == 0 or amt == 1: + if not self.points_to[int(amt)]: return color(255, 0, 0) elif self.is_arrow: - return 0 - else: return 255 - else: return color(0, 0, 255) \ No newline at end of file + return color(0) + else: return color(255) + else: return lerpColor(self.s_color(0), self.s_color(1), amt) \ No newline at end of file