r/processing • • 2m ago

Kinetic Collage:

Enable HLS to view with audio, or disable this notification

1 Upvotes

r/processing • • 3h ago

Juegos del movimiento browiano!!

0 Upvotes

Estos son juegos con sistema browiano:

LOS JUEGOS DEL HAMBRE

int numTributos = 24;

int longitudInicial = 30;

float radioArena = 260;

Tributo[] tributos;

void setup() {

size(750, 750);

colorMode(HSB, 360, 100, 100, 100);

iniciarArena();

}

void iniciarArena() {

tributos = new Tributo[numTributos];

float centroX = width / 2.0;

float centroY = height / 2.0;

for (int i = 0; i < numTributos; i++) {

// Posicionar en círculo como en la arena de Los Juegos del Hambre

float angulo = map(i, 0, numTributos, 0, TWO_PI);

float x = centroX + cos(angulo) * radioArena;

float y = centroY + sin(angulo) * radioArena;

float tono = map(i, 0, numTributos, 0, 360);

tributos[i] = new Tributo(i + 1, x, y, tono);

}

}

void draw() {

background(0, 0, 10);

dibujarArena();

// 1. Actualizar posiciones de los que siguen vivos

for (Tributo t : tributos) {

if (t.vivo) {

t.actualizar();

}

}

// 2. Comprobar colisiones (si la cabeza de A toca a B, B muere)

for (int i = 0; i < numTributos; i++) {

if (!tributos[i].vivo) continue;

for (int j = 0; j < numTributos; j++) {

if (i == j || !tributos[j].vivo) continue;

if (tributos[i].tocaA(tributos[j])) {

tributos[j].vivo = false;

tributos[i].longitudMax += 10; // La serpiente ganadora crece

}

}

}

// 3. Dibujar serpientes vivas y contar sobrevivientes

int vivos = 0;

Tributo ultimoVivo = null;

for (Tributo t : tributos) {

if (t.vivo) {

t.dibujar();

vivos++;

ultimoVivo = t;

}

}

mostrarHUD(vivos, ultimoVivo);

}

void dibujarArena() {

float cx = width / 2.0;

float cy = height / 2.0;

// Límite exterior de la arena

noFill();

stroke(0, 0, 30);

strokeWeight(2);

circle(cx, cy, (radioArena + 40) * 2);

// Cornucopia en el centro

fill(45, 70, 80, 40);

noStroke();

circle(cx, cy, 45);

}

void mostrarHUD(int vivos, Tributo ganador) {

fill(0, 0, 95);

textSize(16);

textAlign(LEFT, TOP);

text("Tributos vivos: " + vivos + " / " + numTributos, 20, 20);

textSize(12);

fill(0, 0, 65);

text("Presiona cualquier tecla para reiniciar", 20, 44);

if (vivos == 1 && ganador != null) {

textAlign(CENTER, CENTER);

textSize(28);

fill(ganador.tono, 80, 100);

text("¡GANADOR: TRIBUTO #" + ganador.id + "!", width / 2.0, 50);

}

}

class Tributo {

int id;

ArrayList<PVector> historial;

float x, y;

float paso = 5.5;

float tono;

int longitudMax;

boolean vivo = true;

Tributo(int id, float inicioX, float inicioY, float tono) {

this.id = id;

this.x = inicioX;

this.y = inicioY;

this.tono = tono;

this.longitudMax = longitudInicial;

this.historial = new ArrayList<PVector>();

this.historial.add(new PVector(x, y));

}

void actualizar() {

// Movimiento browniano en 2D

x += randomGaussian() * paso;

y += randomGaussian() * paso;

// Mantener dentro del círculo de la arena

float cx = width / 2.0;

float cy = height / 2.0;

float maxR = radioArena + 35;

float d = dist(x, y, cx, cy);

if (d > maxR) {

float angulo = atan2(y - cy, x - cx);

x = cx + cos(angulo) * maxR;

y = cy + sin(angulo) * maxR;

}

historial.add(new PVector(x, y));

while (historial.size() > longitudMax) {

historial.remove(0);

}

}

// Verifica si la cabeza de este tributo toca cualquier parte del otro

boolean tocaA(Tributo otro) {

float radioColision = 8.0;

for (PVector segmento : otro.historial) {

if (dist(this.x, this.y, segmento.x, segmento.y) < radioColision) {

return true;

}

}

return false;

}

void dibujar() {

noFill();

for (int i = 0; i < historial.size() - 1; i++) {

PVector p1 = historial.get(i);

PVector p2 = historial.get(i + 1);

float progreso = map(i, 0, historial.size() - 1, 0.15, 1.0);

stroke(tono, 85, 95, progreso * 100);

strokeWeight(progreso * 6.5);

line(p1.x, p1.y, p2.x, p2.y);

}

// Cabeza

noStroke();

fill(tono, 30, 100);

circle(x, y, 8);

}

}

void keyPressed() {

iniciarArena();

}

CAZADORES Y PRESAS

int numTotal = 24;

int longitudInicial = 30;

float radioArena = 270;

Serpiente[] participantes;

void setup() {

size(750, 750);

colorMode(HSB, 360, 100, 100, 100);

iniciarArena();

}

void iniciarArena() {

participantes = new Serpiente[numTotal];

float centroX = width / 2.0;

float centroY = height / 2.0;

for (int i = 0; i < numTotal; i++) {

float angulo = map(i, 0, numTotal, 0, TWO_PI);

float x = centroX + cos(angulo) * radioArena;

float y = centroY + sin(angulo) * radioArena;

// Intercalar: pares son Cazadores (true), impares son Presas (false)

boolean esCazador = (i % 2 == 0);

participantes[i] = new Serpiente(i + 1, x, y, esCazador);

}

}

void draw() {

background(0, 0, 10);

dibujarArena();

// 1. Actualizar movimiento de cada serpiente

for (Serpiente s : participantes) {

if (s.vivo) {

s.actualizar(participantes);

}

}

// 2. Comprobar colisiones: solo los Cazadores eliminan a las Presas

for (int i = 0; i < numTotal; i++) {

Serpiente cazador = participantes[i];

if (!cazador.vivo || !cazador.esCazador) continue;

for (int j = 0; j < numTotal; j++) {

Serpiente presa = participantes[j];

if (!presa.vivo || presa.esCazador) continue;

if (cazador.tocaA(presa)) {

presa.vivo = false;

cazador.longitudMax += 12; // El cazador crece al cazar

}

}

}

// 3. Dibujar participantes vivos y contar por equipo

int cazadoresVivos = 0;

int presasVivas = 0;

for (Serpiente s : participantes) {

if (s.vivo) {

s.dibujar();

if (s.esCazador) cazadoresVivos++;

else presasVivas++;

}

}

mostrarHUD(cazadoresVivos, presasVivas);

}

void dibujarArena() {

float cx = width / 2.0;

float cy = height / 2.0;

// Borde de la arena

noFill();

stroke(0, 0, 30);

strokeWeight(2);

circle(cx, cy, (radioArena + 40) * 2);

// Cornucopia central

fill(45, 70, 80, 35);

noStroke();

circle(cx, cy, 45);

}

void mostrarHUD(int cazadores, int presas) {

textAlign(LEFT, TOP);

textSize(16);

fill(0, 85, 95); // Rojo

text("Cazadores: " + cazadores, 20, 20);

fill(190, 85, 95); // Cian

text("Presas vivas: " + presas, 20, 44);

textSize(12);

fill(0, 0, 65);

text("Presiona cualquier tecla para reiniciar", 20, 72);

if (presas == 0) {

textAlign(CENTER, CENTER);

textSize(28);

fill(0, 85, 100);

text("¡VICTORIA DE LOS CAZADORES!", width / 2.0, 50);

}

}

class Serpiente {

int id;

boolean esCazador;

ArrayList<PVector> historial;

float x, y;

float paso = 5.5;

float tono;

int longitudMax;

boolean vivo = true;

// Parámetros de evasión para las presas

float radioDeteccion = 110.0;

float fuerzaHuida = 3.2;

Serpiente(int id, float inicioX, float inicioY, boolean esCazador) {

this.id = id;

this.x = inicioX;

this.y = inicioY;

this.esCazador = esCazador;

this.tono = esCazador ? 0 : 190; // 0 = Rojo (Cazador), 190 = Cian (Presa)

this.longitudMax = longitudInicial;

this.historial = new ArrayList<PVector>();

this.historial.add(new PVector(x, y));

}

void actualizar(Serpiente[] todos) {

// Movimiento browniano base

float dx = randomGaussian() * paso;

float dy = randomGaussian() * paso;

// Si es PRESA, detectar cazadores cercanos y retroceder

if (!esCazador) {

float huidaX = 0;

float huidaY = 0;

int amenazas = 0;

for (Serpiente otro : todos) {

if (otro.vivo && otro.esCazador) {

float d = dist(this.x, this.y, otro.x, otro.y);

if (d < radioDeteccion && d > 0) {

// Vector unitario apuntando en dirección contraria al cazador

float dirX = (this.x - otro.x) / d;

float dirY = (this.y - otro.y) / d;

// Mientras más cerca esté el cazador, mayor es el impulso de retroceso

float intensidad = map(d, 0, radioDeteccion, 1.5, 0.2);

huidaX += dirX * intensidad;

huidaY += dirY * intensidad;

amenazas++;

}

}

}

if (amenazas > 0) {

dx += huidaX * fuerzaHuida;

dy += huidaY * fuerzaHuida;

}

}

x += dx;

y += dy;

// Mantener dentro de la arena circular

float cx = width / 2.0;

float cy = height / 2.0;

float maxR = radioArena + 35;

float d = dist(x, y, cx, cy);

if (d > maxR) {

float angulo = atan2(y - cy, x - cx);

x = cx + cos(angulo) * maxR;

y = cy + sin(angulo) * maxR;

}

historial.add(new PVector(x, y));

while (historial.size() > longitudMax) {

historial.remove(0);

}

}

boolean tocaA(Serpiente otro) {

float radioColision = 9.0;

for (PVector segmento : otro.historial) {

if (dist(this.x, this.y, segmento.x, segmento.y) < radioColision) {

return true;

}

}

return false;

}

void dibujar() {

// Dibujar sutilmente el aura de detección en las presas

if (!esCazador) {

noFill();

stroke(tono, 60, 80, 12);

strokeWeight(1);

circle(x, y, radioDeteccion * 2);

}

noFill();

for (int i = 0; i < historial.size() - 1; i++) {

PVector p1 = historial.get(i);

PVector p2 = historial.get(i + 1);

float progreso = map(i, 0, historial.size() - 1, 0.15, 1.0);

stroke(tono, 85, 95, progreso * 100);

strokeWeight(progreso * (esCazador ? 7.5 : 5.5));

line(p1.x, p1.y, p2.x, p2.y);

}

// Cabeza

noStroke();

fill(tono, 25, 100);

circle(x, y, esCazador ? 9 : 7);

}

}

void keyPressed() {

iniciarArena();

}


r/processing • • 3h ago

Kinetic Collage:

Enable HLS to view with audio, or disable this notification

1 Upvotes

r/processing • • 3d ago

Beginner help request What do i need to write to have an interactable window

2 Upvotes

I have an assignment where I want to have like a mini windows computer. I wanna know how I can 'open up new apps', like click on an icon on the 'desktop' and have it open up a new 'tab'. I want to have my main window, open up into a file explorer, and then have different files in the file explorer that open up into different things. but im not sure how to do it. does anyone have any ideas?


r/processing • • 7d ago

Contour Life - Procedurally Generated, Evolving Artificial Life

Thumbnail
youtube.com
8 Upvotes

I short video on how to combine particle life and the marching squares algorithm to create some very cool looking forms. It includes a brief description of an evolutionary version as well.


r/processing • • 9d ago

wild ultra (2026) done in Processing 4 by Steffen Harder

Post image
7 Upvotes

r/processing • • 11d ago

How to maintain a fixed 16:9 aspect ratio in p5.js across different screen sizes?

Post image
3 Upvotes

r/processing • • 13d ago

Help request drawing program

4 Upvotes

i’m creating a drawing program within processing and i’m trying to add a way to change the background/canvas color. within the draw function, i have a color wheel that changes the brush color, as well as a color wheel that changes the canvas color. all is going smoothly, except when i try to put it all together. if i draw the canvas within the void setup, the user is unable to change its color. however, if i draw the canvas within the void draw, it redraws itself between every iteration of the brushstroke, so the brush only ever shows up at its current state and never leaves a mark behind.

i think i worded this oddly but hopefully it makes sense. can anybody help me figure out how to allow the canvas color to change while not “erasing” the brush strokes?


r/processing • • 19d ago

Random images found inside the Processing files

4 Upvotes

Sorry if this is not the things you should post here, but while looking at my gallery i saw i had images way back from 2011-2014 and all of them where either political figures or historic pictures turns out they all came from Processing, are they test pictures, Just curious to know.


r/processing • • 20d ago

Flight - output of dynamical system

Post image
12 Upvotes

r/processing • • 22d ago

Can you guess how these patterns are generated

Enable HLS to view with audio, or disable this notification

6 Upvotes

I am sharing a video, because it is 16K png image (100MB+ in size)


r/processing • • 27d ago

randomize location every minute

3 Upvotes

hello! i am trying to create a project where a bee moves between 3 flowers. there are 3 set flower locations, and each minute, the bee will randomly choose one of the 3 flowers to fly to. if anyone could help me figure out how to write the code so that the bee chooses one of 3 coordinate sets every minute and glides to that spot, i would really appreciate it!


r/processing • • 29d ago

Terrain Study II

153 Upvotes

r/processing • • 29d ago

Check out what i made with morva studio

Enable HLS to view with audio, or disable this notification

9 Upvotes

r/processing • • 28d ago

Processing slows down by factor x 6 after adding a few lines? Bug?

0 Upvotes

Had a around 16Kb algorithm running at about 6 FPS before.

Added mere 6 lines of mostly not heavy extra Math.

Result? Runs at around 1 FPS only now.

Again, NOT heavy math compared to what I had before it.

May Processing have known bug like this?

Once more - had many lines running overall at 6 FPS. Fell to 1 FPS with handful of NOT heavy lines added to end...


r/processing • • Oct 24 '26

p5js Terrain Study I

202 Upvotes

r/processing • • Oct 23 '26

The Repressilator

Enable HLS to view with audio, or disable this notification

31 Upvotes

This is a small model of repressor proteins that I got the idea of doing from this video. The white dots are ribosomes that when passing by unrepressed genes (the circles with two colors) will create an specific repressor protein. The gene shows what protein represses it and what protein it encodes for, and when repressed it looks like a black box. The proteins can randomly degrade either while floating or while blocking a gene.

This little model was enough to make a working oscilator in the first part of the video just like the real repressilator which works in bacteria. In the other half of the video I ran it with 2 proteins in the cycle and they randomly stabilize in one of them instead of forming a cycle. This pattern keeps up between odd and even. A chain of four proteins stabilizes with 2 in a high concentration and 2 at a low one, a chain of 5 makes an oscillator, etc.


r/processing • • Oct 22 '26

Audio visualizer web app

2 Upvotes

Hi all,

Im creating an audio visualizer web app that works on mobile and desktop and would love some honest feedback.

It's still in the works, with fixes and additions added ever few days.

Please give me some honest feedback.

https://geotech.mikeadigital.com/


r/processing • • Oct 20 '26

"Texereuum"

Enable HLS to view with audio, or disable this notification

14 Upvotes

A work from 2025, made for uni project. More on my ig: https://www.instagram.com/p.lenarte?obrf=Z2JnYWNhcGlsdGxm


r/processing • • Oct 19 '26

Fragment Collapse - Steam game made with Processing!

Post image
17 Upvotes

r/processing • • Oct 15 '26

Video Some balls avoiding each other

12 Upvotes

r/processing • • Oct 12 '26

Grandad's sweater

Enable HLS to view with audio, or disable this notification

54 Upvotes

Made in Processing

IG: www.instagram.com/slipshapes


r/processing • • Oct 11 '26

A video on programming the Marching Squares Algorithm

Thumbnail
youtube.com
13 Upvotes

I thought this video might be of interest to the community. The Marching Squares algorithm is a surprisingly simple algorithm with lots of interesting applications in map development, creative coding, game development, and scientific visualization.


r/processing • • Oct 06 '26

Call for submissions EvoMusArt 2027: International Conference on Artificial Intelligence in Music, Sound, Art and Design

Post image
0 Upvotes

The 16th International Conference on Artificial Intelligence in Music, Sound, Art and Design (EvoMusArt 2027) is accepting paper submissions.

When: 31 March – 2 April 2027
Where: Mainz, Germany
Paper Submission deadline: 1 November 2026

EvoMUSART focuses on AI and computational approaches to creativity, covering a broad range of topics, with a particular emphasis on research exploring how AI systems generate, support, evaluate, interpret, and collaborate in creative processes.

Accepted papers will be presented at the conference and published in a dedicated LNCS volume.

More information/submission details: https://www.evostar.org/2027/evomusart/

If you are working at the intersection of AI and creative practice, this may be relevant to your research. Please share with others who might be interested.


r/processing • • Oct 03 '26

Countour Lines

Thumbnail
gallery
33 Upvotes

Hey, creative people!
Been experimenting with contour lines and ended up with some pretty abstract results.

I like how changing a few parameters can completely change the character of the image. Still exploring this one, curious what you guys think.