Skip to content

Instantly share code, notes, and snippets.

View villares's full-sized avatar
💥

Alexandre B A Villares villares

💥
View GitHub Profile
@villares
villares / rotational_spirals.pyde
Created November 22, 2020 15:50
Trying to Reconstruct Tim Szetela's rotational spirals
# based on work by Tim Szetela
# https://twitter.com/tszetela/status/1330287937808904194?s=20
# result: https://twitter.com/villares/status/1330536893121957904?s=20
def setup():
size(600, 600)
fill(240, 240, 200)
stroke(150, 50, 50)
strokeWeight(2)
@villares
villares / filas_imagens.pyde
Created December 2, 2020 13:58
Linhas com imagens
from __future__ import unicode_literals , division
imagens = [] # lista vazia
w, h = 350, 500
def setup():
global colunas, linhas
size(2150, 1000)
colunas, linhas = width // w, height // h
print('Posições na grade: ' + str(colunas * linhas))
"""
More naive graph drawing
Using Processing Python mode
To run this you'll need:
https://abav.lugaralgum.com/como-instalar-o-processing-modo-python/index-EN.html
"""
nodes = []
edges = []
NODE_SIZE = 50 # Diâmetro dos nodes
"""
A bare-bones SVG SketchBook - Licensed under GPL v3.0
Alexandre B A Villares - http://abav.lugaralgum.com
in collaboration with Foad S. Farimani https://twitter.com/fsfarimani
v2020_12_19 exporting SVG now!
v2020_12_20 line mode & circle mode
"""
add_library('svg')
@villares
villares / pvector.py
Last active September 15, 2022 09:42
A Python PVector replacement - made for pyp5js
# REFERENCE: https://github.com/processing/p5.js/blob/3f0b2f0fe575dc81c724474154f5b23a517b7233/src/math/p5.Vector.js
# I had a test suit from JDF (Processing.Py's mantainer) here:
# https://gist.github.com/villares/e639a34eef756beba2f79a55203cd51e
import math
from numbers import Number
# TWO_PI = math.pi * 2 # add this if you are not using pyp5js
class PVector:
from os import listdir
from os.path import isfile, join
def get_image_names(base, folder, word=None):
"""
Return a list of image names from a directory
named folder at base/folder by default only
if name contains the folder name.
"""
@villares
villares / filtroPCD_Brasil.pde
Created February 22, 2021 02:56
Exemplo de captura baseado no filtro de video do PCD Brasil
// Baseado no código do PCD 2021 Brasil!
// https://github.com/Processing-Brasil/PCD-Brasil-2021-FiltroVideo/blob/main/linhasPCD/linhasPCD.pde
// Obrigado Monica, Guilherme e Carlos.
import processing.video.*;
Capture video;
int vEspaco = 10;
float precisao = 2;
@villares
villares / command_test.bot
Created March 18, 2021 22:19
shoebot <3 Python
# Try shoebot! github.com/shoebot/shoebot/
size(600,600)
background(1)
ellipsemode(CORNER)
nostroke()
fill(0.95, 0.75, 0)
rect(10, 10, 35, 35)
# see how roundness affects the shape
@villares
villares / sound_input_minimp.pyde
Created March 27, 2021 15:00
Um exemplo mínimo de escutar o volume do microfone no Processing modo Python
add_library('sound') # aviso de que vai usar o microfone
x, y = 400, 300
def setup():
global loudness
size(800, 600)
# fullScreen() # testar se 1 vai para segundo monitor
background(0)
# Burocracia para receber o som e analisar o volume
@villares
villares / grafico.pyde
Last active May 6, 2021 14:55
Exemplo de plano cartesiano e função "desenhada"
from __future__ import division # não use na versão online!
escala = 25
def setup():
size(800, 800)
background(200, 200, 240)
translate(width / 2, height / 2)
textSize(14)
textAlign(CENTER, CENTER)