Skip to content

Instantly share code, notes, and snippets.

View villares's full-sized avatar
💥

Alexandre B A Villares villares

💥
View GitHub Profile
# Alexandre B A Villares - https://abav.lugaralgum.com/sketch-a-day
# More explorations of lines in grids
from pyp5js import *
W = None
H = None
num = None
line_combos = None
@villares
villares / pyp5jsnathorTabajara.pyde
Last active June 19, 2019 16:36
Prova de conceito
# Needs a tab nammed "in.py" with the source to be converted!
# TODO: deal with `with pushMatrix():` and other Python Mode contexts
import re
has_import = False
has_future_division = False
has_print_statement = False
globals_list = []
@villares
villares / symmetry.py
Created June 27, 2019 13:27 — forked from berinhard/symmetry.py
Pythonic Symmetry
# Author: Berin
# Sketches repo: https://github.com/berinhard/sketches
from collections import namedtuple
from abc import ABCMeta, abstractmethod
WHITE = color(235, 235, 235)
BLACK = color(27, 27, 27)
BLUE = color(55,189,182)
def setup():
@villares
villares / blink_ou_fade.ino
Created July 17, 2019 21:22
A cada dois segundos, blink ou fade
@villares
villares / analogInput.ino
Last active August 26, 2019 13:32
Garoa Dojo com Arduino
/*
Analog Input
Demonstrates analog input by reading an analog sensor on analog pin 0 and
turning on and off a light emitting diode(LED) connected to digital pin 13.
The amount of time the LED will be on and off depends on the value obtained
by analogRead().
*/
int sensorPin = A0; // select the input pin for the potentiometer
@villares
villares / exemplo_bouncy_processing.pyde
Last active September 26, 2019 15:20
Exemplo de movimento e colisão que vem no Processing Python Mode
"""
Para roder este exemplo:
https://abav.lugaralgum.com/como-instalar-o-processing-modo-python/
---
Bouncy Bubbles
based on code from Keith Peters.
Multiple-object collision.
The "bounding-box" rendering is imprecise because we've implemented springy
bodies which don't show their deformation.
@villares
villares / live_2020_03_18.pyde
Last active March 18, 2020 20:44
Live de Processing modo Python em 18/03/2020
# Instruções para baixar o Processing e instalar o modo Python em abav.lugaralgum.com/material-aulas
def setup():
""" executa no começo - isto aqui é um 'doc-string' """
size(500, 500) # tamanho do desenho - isto aqui é um comentário (meta-comentário?)
# não vamos usar cores RGB, vamos usar HSB
colorMode(HSB) # Matiz, Saturação e Brilho
noStroke() # sem contorno nas formas
def draw():
# exemplo_lista = [10, 20, 3, 13, 1]
# exemplo_tupla = (10, 22, "sim", color(0))
# [(100, 100, 5, cor), (200, 100, 10, cor), ...]
from itertools import combinations
def setup():
global dados_bolas, combos
size(500, 500)
fill(200, 200, 0) # amarelo
# ported from https://www.openprocessing.org/sketch/862451
# by @takawo https://www.openprocessing.org/user/6533
# Missing drawingContext shadowColor shadowBlur :(
from random import choice
movers = []
mover_num = 350
pallete = ["#DADCDA", "#DE200C", "#3A6DA8", "#A8BACC",
"#0A1D4E", "#CD4645", "#C0AEB5", "#838CA9"]
@villares
villares / sketch_2020_03_30z.pyde
Last active March 30, 2020 18:26
@anniek_p 's mindblowingly simple yet fiendishly difficult #mathartchallenge
"""
Annie Perkins Math Art Challenge
https://twitter.com/anniek_p/status/1244220881347502080
Peter Farrell
https://github.com/hackingmath/pygame_sketches/blob/master/binary_grid_challenge.py
Alexandre Villares
https://gist.github.com/villares/219b457c82adfd73b6664aa10cb681f2
"""
from random import choice, randint