Skip to content

Commit

Permalink
sketch 88
Browse files Browse the repository at this point in the history
  • Loading branch information
villares committed Mar 30, 2018
1 parent 72ba44e commit 81e42b5
Show file tree
Hide file tree
Showing 12 changed files with 445 additions and 26 deletions.
68 changes: 42 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,22 @@ If you enjoy this, make a small donation [here](https://www.paypal.com/cgi-bin/w

----

![s088](s088/s088.gif)

088: [code](https://github.com/villares/sketch-a-day/tree/master/s087) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]

FIlled rects, ellipses and losangles (without sktroke) and Xs

----

![s087](s087/s087.gif)

087: [code](https://github.com/villares/sketch-a-day/tree/master/s087) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]

No fill again, less colours. Variable/random number of elements per grid.

----

![s086](s086/s086.gif)

086: [code](https://github.com/villares/sketch-a-day/tree/master/s086) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
Expand Down Expand Up @@ -250,31 +266,31 @@ Revisited 54 and now I'm re-selecting random points_to nodes...

![s056](s056/s056.gif)

056: [code](https://github.com/villares/sketch-a-day/tree/master/s056) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
056: [code](https://github.com/villares/sketch-a-day/tree/master/s056) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]

Arrow grid moving in HSB colour space

----

![s055](s055/s055.png)

055: [code](https://github.com/villares/sketch-a-day/tree/master/s055) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
055: [code](https://github.com/villares/sketch-a-day/tree/master/s055) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]

Grid revisited

----

![s054](s054/s054.gif)

054: [code](https://github.com/villares/sketch-a-day/tree/master/s054) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
054: [code](https://github.com/villares/sketch-a-day/tree/master/s054) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]

New arrows! With a "Tail" parameter...

----

![s053](s053/s053.png)

053: [code](https://github.com/villares/sketch-a-day/tree/master/s053) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
053: [code](https://github.com/villares/sketch-a-day/tree/master/s053) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]

Big invisible refactor (no more point-grid to select from, now a list of possible X and Y positons to choose).
On the visible side, fewer elements, and non-pointing elements redrawn in red on top.
Expand All @@ -283,88 +299,88 @@ On the visible side, fewer elements, and non-pointing elements redrawn in red on

![s052](s052/s052.png)

052: [code](https://github.com/villares/sketch-a-day/tree/master/s052) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
052: [code](https://github.com/villares/sketch-a-day/tree/master/s052) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]

White lines first, black arrows on top.

----

![s051](s051/s051.gif)

051: [code](https://github.com/villares/sketch-a-day/tree/master/s051) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
051: [code](https://github.com/villares/sketch-a-day/tree/master/s051) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]

Points now on a grid.

----

![s050](s050/s050.gif)

050: [code](https://github.com/villares/sketch-a-day/tree/master/s050) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
050: [code](https://github.com/villares/sketch-a-day/tree/master/s050) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]

Arrows now...

----

![s049](s049/s049.gif)

049: [code](https://github.com/villares/sketch-a-day/tree/master/s049) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
049: [code](https://github.com/villares/sketch-a-day/tree/master/s049) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
Yet more graphs

----

![s048](s048/s048.gif)

048: [code](https://github.com/villares/sketch-a-day/tree/master/s048) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
048: [code](https://github.com/villares/sketch-a-day/tree/master/s048) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
Yet more graphs

----

![s047](s047/s047.gif)

047: [code](https://github.com/villares/sketch-a-day/tree/master/s047) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
047: [code](https://github.com/villares/sketch-a-day/tree/master/s047) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
Yet more graphs

----

![s046](s046/s046.png)

046: [code](https://github.com/villares/sketch-a-day/tree/master/s046) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
046: [code](https://github.com/villares/sketch-a-day/tree/master/s046) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
Yet more graphs

----

![s045](s045/s045.gif)

045: [code](https://github.com/villares/sketch-a-day/tree/master/s045) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
045: [code](https://github.com/villares/sketch-a-day/tree/master/s045) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
Yet more graphs

----

![s044](s044/s044.gif)

044: [code](https://github.com/villares/sketch-a-day/tree/master/s044) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
044: [code](https://github.com/villares/sketch-a-day/tree/master/s044) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
More graphs

----

![s043](s043/s043.png)

043: [code](https://github.com/villares/sketch-a-day/tree/master/s043) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
043: [code](https://github.com/villares/sketch-a-day/tree/master/s043) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
More graphs

----

![s042](s042/s042.gif)

042: [code](https://github.com/villares/sketch-a-day/tree/master/s042) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
042: [code](https://github.com/villares/sketch-a-day/tree/master/s042) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
Yet another interactive recursive thingy, the image on the right is shown with a key pressed

----

![s041](s041/s041.png)


041: [code](https://github.com/villares/sketch-a-day/tree/master/s041) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
041: [code](https://github.com/villares/sketch-a-day/tree/master/s041) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
Yet another interactive recursive thingy, the image on the right is shown with a key pressed

----
Expand Down Expand Up @@ -415,7 +431,7 @@ Preparing for "Carnahacking"
![034](sketch_180203c/sketch_180203c.gif)

034: [sketch_180203c](https://github.com/villares/sketch-a-day/tree/master/sketch_180203c) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
Like 33 but again with "w squared" circles
Like 33 but again with "w squared" circles

----

Expand Down Expand Up @@ -472,14 +488,14 @@ Saving a list of points to animate colour... Mouse speed changes recorded colour

![26](sketch_180126c/sketch_180126c.png)

026: [sketch_180126c](https://github.com/villares/sketch-a-day/tree/master/sketch_180126c) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
026: [sketch_180126c](https://github.com/villares/sketch-a-day/tree/master/sketch_180126c) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
Mouse speed changing colour & strokeWeight()

----

![25](sketch_180125c/sketch_180125c.png)

025c: [sketch_180125b](https://github.com/villares/sketch-a-day/tree/master/sketch_180125c) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
025c: [sketch_180125b](https://github.com/villares/sketch-a-day/tree/master/sketch_180125c) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
Mouse speed changing strokeWeight()

----
Expand All @@ -502,19 +518,19 @@ Mouse speed changing strokeWeight()

![21b](sketch_180121b/sketch_180121b.gif)

021b: [sketch_180121b](https://github.com/villares/sketch-a-day/tree/master/sketch_180121b) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
021b: [sketch_180121b](https://github.com/villares/sketch-a-day/tree/master/sketch_180121b) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
Playing with Peter "[Hacking Math Class](http://twitter.com/hackingmath)" Farrel's Sliders!

----

![20b](sketch_180120b/sketch_180120b.gif)

020b: [sketch_180120b](https://github.com/villares/sketch-a-day/tree/master/sketch_180120b) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
020b: [sketch_180120b](https://github.com/villares/sketch-a-day/tree/master/sketch_180120b) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
I was stuck on my DBN conversion sketch 20a, so this HSB shape play is 20b...

![20a](sketch_180120a/sketch_180120a.png)

020a: [sketch_180120a](https://github.com/villares/sketch-a-day/tree/master/sketch_180120a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
020a: [sketch_180120a](https://github.com/villares/sketch-a-day/tree/master/sketch_180120a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
Refactored the code generation, removed most of the repeated vertices... C D E G O R not nice yet…

----
Expand All @@ -527,7 +543,7 @@ Refactored the code generation, removed most of the repeated vertices... C D E G

![18a](sketch_180118a/sketch_180118a.png)

018: [sketch_180118a](https://github.com/villares/sketch-a-day/tree/master/sketch_180118a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)] DBN Color font? Nah…
018: [sketch_180118a](https://github.com/villares/sketch-a-day/tree/master/sketch_180118a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)] DBN Color font? Nah…

----

Expand All @@ -551,13 +567,13 @@ Refactored the code generation, removed most of the repeated vertices... C D E G

![14a](sketch_180114a/sketch_180114a.png)

014: [sketch_180114a](https://github.com/villares/sketch-a-day/tree/master/sketch_180114a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)] Another 3D Graph
014: [sketch_180114a](https://github.com/villares/sketch-a-day/tree/master/sketch_180114a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)] Another 3D Graph

----

![13a](sketch_180113a/sketch_180113a.png)

013: [s180113](https://github.com/villares/sketch-a-day/tree/master/sketch_180113a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)] 3D Graph
013: [s180113](https://github.com/villares/sketch-a-day/tree/master/sketch_180113a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)] 3D Graph

----

Expand Down Expand Up @@ -603,7 +619,7 @@ Refactored the code generation, removed most of the repeated vertices... C D E G

----

005: [s180105](https://github.com/villares/sketch-a-day/tree/master/s180105) [[p5js](https://www.p5js.org)] Line Tetrahedrons in p5*js - [interactive](https://villares.github.io/sketch-a-day/s180105/s180105)
005: [s180105](https://github.com/villares/sketch-a-day/tree/master/s180105) [[p5js](https://www.p5js.org)] Line Tetrahedrons in p5*js - [interactive](https://villares.github.io/sketch-a-day/s180105/s180105)

----

Expand Down
33 changes: 33 additions & 0 deletions s087/gif_exporter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""
Alexandre B A Villares http://abav.lugaralgum.com - GPL v3
A helper for the Processing gifAnimation library (https://github.com/jordanorelli)
ported to Processing 3 by 01010101 (https://github.com/01010101)
Download the library from https://github.com/01010101/GifAnimation/archive/master.zip
This helper was inspired by an example by Art Simon https://github.com/APCSPrinciples/AnimatedGIF/
Put add_library('gifAnimation') at the start of your sketch
and add gif_export(GifMaker) at the end of draw()
"""
def gif_export(GifMaker, # gets a reference to the library
filename="exported", # .gif will be added
repeat=0, # 0 makes it an "endless" animation
quality=32, # quality range 0 - 255
delay=170, # this is quick
frames=0): # 0 will stop on keyPressed or frameCount >= 100000
global gifExporter
try:
gifExporter
except NameError:
gifExporter = GifMaker(this, filename + ".gif")
gifExporter.setRepeat(repeat)
gifExporter.setQuality(quality)
gifExporter.setDelay(delay)

gifExporter.addFrame()

if (frames == 0 and keyPressed or frameCount >= 100000) \
or (frames != 0 and frameCount >= frames):
gifExporter.finish()
print("gif saved")
exit()
Binary file added s087/s087.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
75 changes: 75 additions & 0 deletions s087/s087.pyde
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Alexandre B A Villares - https://abav.lugaralgum.com/sketch-a-day
SKETCH_NAME = "s087" # 180328

add_library('gifAnimation')
from gif_exporter import gif_export
from slider import Slider
from shapes import *

A = Slider(1, 40, 10, 'q', 'a')
B = Slider(1, 40, 10, 'w', 's')
C = Slider(1, 40, 10, 'e', 'd')
D = Slider(1, 40, 10, 'r', 'f')

SHAPES = [ellipse,
rect,
exes,
losang]

COLORS = [color(0), color(0), color(0),
color(255), color(255),
color(200, 0, 100),
]

def setup():
size(600, 600, P2D)
colorMode(HSB)
rectMode(CENTER)

A.position(40, height - 70)
B.position(40, height - 30)
C.position(width - 140, height - 70)
D.position(width - 140, height - 30)

def draw():
background(200)
noFill()

a = int(A.val) # number of elements
b = int(B.val) # size of elements
c = int(C.val) # space between elements
d = int(D.val) # number of grids

randomSeed(int(d * 100)) # a different random seed

for i in range(d):
tam = a * c
x = int(random(width - tam) / c) * c
y = int(random(height - tam) / c) * c
stroke(rnd_choice(COLORS))
noFill() # fill(rnd_choice(COLORS), 100)
strokeWeight(int(random(1, 3)))
random_a = rnd_choice(range(1, a + 1))
grid(x, y, random_a, b, c, rnd_choice(SHAPES))

# uncomment next lines to export GIF
if not frameCount % 30:
gif_export(GifMaker,
frames=2000,
delay=500,
filename=SKETCH_NAME)

# Draws sliders and checks for mouse dragging or keystrokes
Slider.update_all()

def grid(x, y, num, size_, space, func):
for i in range(x, x + num * space, space):
for j in range(y, y + num * space, space):
func(i, j, size_, size_)

def rnd_choice(collection):
i = int(random(len(collection)))
return collection[i]

# def keyPressed():
# saveFrame(SKETCH_NAME + '_###.gif')
11 changes: 11 additions & 0 deletions s087/shapes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def exes(x, y, c, _):
with pushMatrix():
translate(x, y)
line(-c / 2, -c / 2, c / 2, c / 2)
line(c / 2, -c / 2, -c / 2, c / 2)

def losang(x, y, c, _):
with pushMatrix():
translate(x, y)
rotate(radians(45))
rect(0, 0, c, c)
Loading

0 comments on commit 81e42b5

Please sign in to comment.