Can I follow ‘the nature of code’ fully in python (

I really enjoy using Processing and I am really looking forward to follow the Nature of Code. I am new to the area of coding but I am wanting to focus on learning Python through processing (instead of javascript). I know that the Nature of Code uses p5.js which is an extention of processing with a physics library.

Is it possible to write out the p5.js code making use of the physics library or is that not a thing?

Hopefully that makes some sense.

submitted by /u/Gobler
[link] [comments]

Processing noob in need of advice.

Hello everybody,

I'm trying to do an array of images that display randomly and failing miserably. The problem is they are all transparent .pngs and calling background(); ruins the transparency, which I want to keep, so I can later save them with a keypress.

My question is how can I clear the previous .png before generating the next one, so they don't overlap.

I hope this makes sense.

PImage[] myImageArray = new PImage[12]; void setup() { //background (255,0); size(1024, 1024); img = createGraphics (1000,1000); for (int i=0; i<myImageArray.length; i++) { myImageArray[i] = loadImage( "A-0" + i + ".png"); } } void draw() { image(myImageArray[(int)random(12)], 0, 0, 1000, 1000); noLoop (); } void mousePressed() { loop (); } 
submitted by /u/K________________S
[link] [comments]

Inexplicable memory hunger

I was trying to create a little evolutionary algorithm. Everything works fine but slowly all my memory gets used by the process. Here comes the strange part: I identified the exact line that causes the memory usage to explode:


The problem doesn't arise when I change it to



vel.add(new PVector(0.5-brain.getout()[1],0)); 

the second one was to find out if


causes the problem. On the other hand if I put


Once again the memory usage gigantic.

I am totally desperate, please help.

submitted by /u/Maarico
[link] [comments]

Need help moving a 2D array of images

This is what I have so far, but it is not working :(

class Fish { PImage [][] fish = new PImage[5][5]; Fish() { for (int i = 0; i < fish.length; i++) { for (int h = 0; h <fish.length; h++) { fish[i][h] = loadImage("fish1.png"); } } } void fishRender() { for (int i = 0; i < fish.length; i++) { if (i == 0) fishY = 310; if (i == 1) fishY = 370; if (i == 2) fishY = 430; if (i == 3) fishY = 490; if (i == 4) fishY = 550; for (int h = 0; h < fish.length; h++) { if (h == 0) fishX = 310; if (h == 1) fishX = 370; if (h == 2) fishX = 430; if (h == 3) fishX = 490; if (h == 4) fishX = 550; image(fish[i][h], fishX, fishY, 50, 50); } } } void fishMove() { // Update the position of the shape fishX = fishX + ( speedX * directionX ); // if the shape exceeds the boundaries of the screen reverse direction by multiplying by -1 if (fishX > 550 || fishX < 50) { directionX *= -1; } } } 
submitted by /u/Fowleh
[link] [comments]

Want to add another drawing but I cant have 2 void setups what should i do

Spot[] spots;

void setup() {

size(1000, 1000);

int numSpots = 70;

int dia = width/numSpots;

spots = new Spot[numSpots];

for (int i = 0; i < spots.length; i++) {

float x = dia/2 + i*dia;

float rate = random(0.1, 2.0);

spots[i] = new Spot(x, 50, dia, rate);




void draw() {

fill(17, 2);

rect(0, 0, width, height);


for (int i=0; i < spots.length; i++) {





class Spot {

float x, y;

float diameter;

float speed;

int direction = 1;

Spot(float xpos, float ypos, float dia, float sp) {

x = xpos;

y = ypos;

diameter = dia;

speed = sp;


void move() {

y += (speed * direction);

if ((y > (height - diameter/2)) || (y < diameter/2)) {

direction *= -1;



void display() {

ellipse(x, y, diameter, diameter);



submitted by /u/LegitTacoEater
[link] [comments]

Curatorial Activism. Fighting sexism, racism, homo/lesbophobia and western-centrism one exhibition at a time

Curatorial Activism. Towards an Ethics of Curating by Curator and arts writer Maura Reilly. Forewords by Lucy R. Lippard.

It’s on amazon UK and USA.

Publisher Thames & Hudson writes: Despite decades of postcolonial, feminist, anti-racist and queer activism and theorizing, the art world continues to exclude ‘Other’ artists – those who are women, of colour and LGBTQ. Indeed, the more closely one examines the numbers, the more glaring it becomes that white, Euro-American, heterosexual, privileged and, above all, male artists continue to dominate the art world. The fight for gender and race equality continues apace.

Lilibeth Cuenca Rasmussen, Never Mind Pollock, 2009

It’s 2018 and the art world is still suffering from an over-representation of white, straight, male artists. Stats (when and where they exist) show signs of marginal improvement, but there’s no denying that old values and canons have never ceased to dominate museums, collections and auction houses at the expense of female, LGTBQ and non-white and non-Western artists.

Curatorial Activism provides us with much needed moments of self-reflection and institutional critique. In her book, Maura Reilly looks into details at the pioneering exhibitions that have bravely challenged assumptions and leveled hierarchies. She also discusses the most successful tactics for addressing inequality, charting their potential, their flaws and the difficult questions they raise: how do you avoid ghettoizing the work of Other artists? How do you give more space to non-Western artists who don’t think they should have to ‘display their identity’? How do you ensure visibility to LGTB artists who don’t want to be identified solely on the basis of their sexual orientation?

One thing this book explains eloquently is that progresses are too often followed by setbacks. One of the many examples explored in the book looks at how, in 2008, the Centre Pompidou in Paris consigned to storage most of its works by male artists and ­rehung its permanent collection to show only works by women. The elles@centrepompidou initiative didn’t encounter a massive critical success and a year after it, the works by male artists were hung again while the ones by women went back to oblivion.

Araya Rasdjarmrearnsook, Two Planets: Renoir’s Ball at the Moulin de la Galette and the Thai Villagers, 2008

Guerrilla Girls, Is it even worse in Europe?, 2016. Photo: David Parry/PA Wire

Although Curatorial Activism targets mostly curators, its content is relevant to anyone with some interest in the art world: Reilly urges museum to diversify their boards; holds private galleries responsible for perpetuating discriminatory practices; exhorts critics to draw attention to disparities and invites artists and marginalized people to make trouble and speak up. The rest of us should relentlessly question the art standards devised by white men for white men. We all have a role to play.

An easy thing to do would be to seek out and visit “alternative” art spaces that fill the void left by mainstream institutions. Reilly mentions the Studio Museum in Harlem. I’m thinking of Autograph APB located at Rivington Place in London. I try to visit their shows whenever i’m in town. Not because i’m explicitly seeking out ‘otherness’ but because their photography program is really good. Until we’ve achieved equality, the work of these organizations will remain invaluable.

Making the the art world more inclusive is an important endeavour. It feels particularly urgent today, in this general climate of reactionary and conservative politics, with a male white supremacist at the head of the US and with a Europe that seems intent on closing its borders to foreign influences.

Here’s a very short list of works i’ve discovered or re-discovered in the book:

James Luna, The Artifact Piece, 1986-1990

In 1986, Native American artist James Luna “installed’ himself in an exhibition case in the San Diego Museum of Man in a section on the Kumeyaay Indians, who once inhabited San Diego County. His performance challenged the way contemporary American museums have presented his people and culture as essentially extinct and vanished. He performed the piece in several cultural institutions.

Catherine Opie, Self-Portrait/Cutting, 1993

One of my favourite art interventions in the whole art history is Fred Wilson‘s Mining the Museum back in 1992 at the Maryland Historical Society in Baltimore. I like it so much that instead of a photo i’m copy/pasting below a video from a presentation he made a couple of years ago at the V&A in London:

A change of heart – Fred Wilson’s impact on museums

Mary Kelly, Post-Partum Document: Introduction, 1973

Philip-Lorca diCorcia, Vittorio Scarpatti, 1989

Miwa Yanagi, Yuka, from the My Grandmother series, 2000

Alfredo Jaar, La géographie, ça sert d’abord à faire la guerre, 1989

Wangechi Mutu, The End of Carrying All, 2015

General Idea (Felix Partz, Jorge Zontal and AA Bronson), Baby Makes 3, 1984-1989

Tariq Alvi, The Importance of Hanging, 2008

Inside the book:

Help: Hit collision between hook and fish

I have this game where fish are moving across the screen and you press enter to move the hook down the catch a fish. I need help to define when the hook hits one of the fish. I already have a Boolean variable called alive that will be false when the hook has hit the fish, I just don't know how i can code the constructor for this in hook.

Here is the code:


int x; int y; int c = 5; int r = 5; // c and r = columns and rows for grid of fish, int i; int j; int gameMode = 0; PImage img; int FishX = -40; int FishY = 400; int BoatX = 350; int HookY = 200; Fish fish1; Boat Boat1; Hook Hook1; Fish[][]Grid; boolean GameOverScreen=false; boolean alive = true; void setup() { fish1 = new Fish (FishX, FishY); Boat1 = new Boat (BoatX, 120); Hook1 = new Hook(BoatX + 100, HookY); Grid = new Fish[c] [r]; for (i = 0; i < c; i++) { FishX += 90; for (j = 0; j < r; j++) { FishY += 70; fish1 = new Fish (FishX, FishY); Grid[i][j] = fish1; } FishY = 400; } size(700, 800); textAlign(CENTER, CENTER); img = loadImage("background.png"); img.resize(700, 800); } void draw() { background(img); // fill(100); if (GameOverScreen) { background(0); textSize(50); fill(255); text("GAME OVER", width/2, 400); } else { Boat1.render(); Hook1.render(); if (alive == true) { for (i=0; i < c; i++) { for (j=0; j < r; j++) { Grid[i][j].render(); Grid[i][j].FlipFish(); Grid[i][j].update(); } } } } } void keyPressed() { if (keyCode == RIGHT && Boat1.x < width-100) { Boat1.x = Boat1.x + 10; Hook1.x = Hook1.x + 10; } if (keyCode == LEFT && Boat1.x > 100) { Boat1.x = Boat1.x - 10; Hook1.x = Hook1.x - 10; } if (keyCode == ENTER && HookY < 800) { Hook1.move(); } } 
submitted by /u/IkeTheTike
[link] [comments]

Processing Beginner needs Help..

Hi Guys, I need help with a task for the school that was put to us. It's about moving a square by mousePressed(), stopping it by clicking and moving it again with clicking. This should be done on the x-axis, from left to right. I messed around for a long time, but I did not come up with the solution.

So: 1. Click -> sqaure moving

  1. Click -> square stops

  2. Click -> sqaure moving

My Code to this point is:

float rectX = 0;

void setup() {



void draw () {





if ( rectX > 0 && rectX < 179 ){

rectX = rectX + 1;



void mousePressed () {

if (rectX == 0)

rectX = rectX + 1;


Would be nice if someone could help me :)

submitted by /u/MuTeRiiX
[link] [comments]