Alexandre B A Villares 2019-01-28 11:06:41 -02:00
rodzic 3e5d6de8ec
commit 7f8e0ca4bd
3 zmienionych plików z 13 dodań i 7 usunięć

Wyświetl plik

@ -44,14 +44,15 @@ class Cell():
self.pos = PVector(Cell.border + self.size_ / 2 + i * self.size_ - width / 2,
Cell.border + self.size_ / 2 +
j * self.size_ - height / 2,
k * self.size_)
k * self.size_ - height / 2)
def update(self, mx, my):
# mouse over & selection treatment
hs = self.size_ / 2
px, py = self.pos.x + width / 2, self.pos.y + height / 2
self.mouse_on = (px - hs < mx < px + hs and
py - hs < my < py + hs)
sx = screenX(self.pos.x, self.pos.y, self.pos.z)
sy = screenY(self.pos.x, self.pos.y, self.pos.z)
self.mouse_on = (sx - hs < mx < sx + hs and
sy - hs < my < sy + hs)
if self.mouse_on and mousePressed:
self.mouse_down = True

Wyświetl plik

@ -1,5 +1,5 @@
# Alexandre B A Villares - https://abav.lugaralgum.com/sketch-a-day
SKETCH_NAME, OUTPUT = "sketch_190127a", ".gif" # find sketch name yourself!
SKETCH_NAME, OUTPUT = "sketch_190128b", ".gif" # find sketch name yourself!
from cell import Cell
from random import choice
@ -21,7 +21,7 @@ def setup():
grid_size = width / CELL_SIZE
rectMode(CENTER)
strokeCap(SQUARE)
cam = PeasyCam(this, 700)
cam = PeasyCam(this, 1000)
def init_grid(f=None):
@ -31,7 +31,7 @@ def init_grid(f=None):
# number of collums and rows -2 for default cell sized border
w = int(width // CELL_SIZE) # - 2
h = int(height // CELL_SIZE) # - 2
z = 3
z = h
# print(w, h)
for i in range(w):
for j in range(h):

Wyświetl plik

@ -19,6 +19,11 @@ Subscribe to sort-of-weekly newsletter: [[sketch-mail](https://tinyletter.com/v
## 2019
---
![sketch_190128b](2019/sketch_190128b/sketch_190128b.gif)
[sketch_190128b](https://github.com/villares/sketch-a-day/tree/master/2019/sketch_190128b) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
---