This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def inicie_caneta(*args): | |
| global caneta | |
| caneta = True | |
| resetMatrix() | |
| if args: | |
| x, y = args | |
| translate(x, y) | |
| else: | |
| translate(width / 2, height / 2) | |
| rotate(HALF_PI) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Sugestão: uso o IDE thonny.org | |
| # precisa de um arquivo texto.txt 'ao lado' deste script | |
| from turtle import * | |
| from collections import Counter | |
| from random import randrange | |
| def fala(texto, tamanho=18, estilo="normal"): | |
| write(texto, align='center', font=("Open Sans", | |
| tamanho, estilo)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### arrastando vários círculos | |
| arrastando = None # None quer dizer nenhum círculo sendo arrastado | |
| circulos = [] # lista com coordenadas e tamanhos dos círculos | |
| def setup(): | |
| size(400, 400) | |
| strokeWeight(3) | |
| fill(0, 200) # preenchimento translúcido | |
| for _ in range(5): # vamos sortear 5 círculos |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| A simple Python graph class, demonstrating the essential facts and functionalities of graphs | |
| based on https://www.python-course.eu/graphs_python.php and https://www.python.org/doc/essays/graphs/ | |
| """ | |
| class Graph(object): | |
| def __init__(self, graph_dict=None): | |
| """ | |
| Initialize a graph object with dictionary provided, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // adapted from Khan Academy that adapts Dan Shiffman, natureofcode.com | |
| // https://pt.khanacademy.org/computing/computer-programming/programming-natural-simulations/programming-particle-systems/a/particle-systems-with-forces | |
| var gravity; | |
| var particleSystem; | |
| var repeller; | |
| function setup() { | |
| createCanvas(400, 400); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Para rodar, installe o Processing modo Python: | |
| https://abav.lugaralgum.com/como-instalar-o-processing-modo-python/ | |
| Teclas: | |
| ESPAÇO: apaga tudo | |
| c: Muda modo de cor ou cinza | |
| x: Muda paleta de cor | |
| SHIFT: apaga itens nas duas pontas do deque | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://twitter.com/FreyaHolmer/status/1319278214087258112?s=20 | |
| // FROM: https://github.com/FreyaHolmer/Mathfs/ | |
| /* | |
| TODO: YEAH INTERSECT IT IS HARD... IF ANYONE WANTS TO HELP...! | |
| - CircleFromThreePoints() depends on LineSegment2D and Intersect... | |
| - I have some lazy line segment intersection I could use | |
| but Freya's has cool Rays and infinite lines... | |
| - ... | |
| - Then I'll port everything to Processing Python mode... | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <!-- pyp5js index.html boilerplate --> | |
| <html lang=""> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>pyp5js with Pyodide Demo</title> | |
| <style> body, html, canvas {padding: 0; margin: 0; overflow: hidden;} </style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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]] |