Skip to content

Instantly share code, notes, and snippets.

Avatar

Alexandre B A Villares villares

View GitHub Profile
@villares
villares / sound_input_minimp.pyde
Created Mar 27, 2021
Um exemplo mínimo de escutar o volume do microfone no Processing modo Python
View sound_input_minimp.pyde
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
View command_test.bot
# 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 / filtroPCD_Brasil.pde
Created Feb 22, 2021
Exemplo de captura baseado no filtro de video do PCD Brasil
View filtroPCD_Brasil.pde
// 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;
View helpers.py
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 / pvector.py
Last active Jan 16, 2021
A pure Python PVector replacement
View pvector.py
# 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) I'll try to find and add here
import math
from numbers import Number
class PVector:
def __init__(self, x=0, y=0, z=0):
self.x = x
View sketch_2020_12_20a_svg_sketchbook.pyde
"""
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')
View naive_graph.pyde
"""
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
View filas_imagens.pyde
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))
@villares
villares / rotational_spirals.pyde
Created Nov 22, 2020
Trying to Reconstruct Tim Szetela's rotational spirals
View rotational_spirals.pyde
# 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 / sharpen_and_blur.pyde
Last active Nov 14, 2020
Repeatedly Sharpen and Blur an image - Add a /data/ folder to your sketch with a `img.jpg` file
View sharpen_and_blur.pyde
# based on https://processing.org/tutorials/pixels/
w = 80
# It's possible to perform a convolution
# the image with different matrices
sharpen_kernel = [[-1, -1, -1],
[-1, 9, -1],
[-1, -1, -1]]